Skip to content

Commit

Permalink
adjust origin for orientation
Browse files Browse the repository at this point in the history
  • Loading branch information
glennsl committed Jan 21, 2020
1 parent 460eb7a commit 8735d1c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Components/ContextMenu.re
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,16 @@ module Make = (()) => {
switch (maybeModel, maybeRef) {
| (Some(model), Some(node)) =>
if (model.id == id) {
let (x, y, _, _) =
let (x, y, width, _) =
Math.BoundingBox2d.getBounds(node#getBoundingBox());

let x =
switch (orientation) {
| (_, `Left) => x
| (_, `Middle) => x -. width /. 2.
| (_, `Right) => x -. width
};

let placement =
Some({
x: int_of_float(x) + offsetX,
Expand Down

0 comments on commit 8735d1c

Please sign in to comment.