Skip to content

Commit

Permalink
fix: align drag preview/sticker properly
Browse files Browse the repository at this point in the history
Closes #596
  • Loading branch information
Skaiir committed Sep 13, 2024
1 parent c4af692 commit 5df7f0c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/form-js-editor/src/features/dragging/Dragging.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,35 @@ export class Dragging {

return !target.classList.contains(DRAG_NO_DROP_CLS);
},

transformOffset: (offset, event, element) => {
if (element.classList.contains(DRAG_ROW_MOVE_CLS)) {
const rowOffset = {
x: -5,
y: -60,
};

return {
left: event.clientX + rowOffset.x,
top: event.clientY + rowOffset.y,
};
}

if (element.classList.contains(DRAG_MOVE_CLS)) {
const iconOffset = {
x: -5,
y: -15,
};

return {
left: event.clientX + iconOffset.x,
top: event.clientY + iconOffset.y,
};
}

return offset;
},

slideFactorX: 10,
slideFactorY: 5,
};
Expand Down

0 comments on commit 5df7f0c

Please sign in to comment.