fix(core): drag position update

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2022-12-20 00:38:56 +01:00
committed by Braks
parent 6df5746064
commit dd1b15029d
4 changed files with 12 additions and 26 deletions
+1 -13
View File
@@ -27,7 +27,6 @@ export function getDragItems(
markRaw({
id: n.id,
position: n.position || { x: 0, y: 0 },
computedPosition: n.computedPosition || { x: 0, y: 0, z: 1 },
distance: {
x: mousePos.x - n.computedPosition?.x || 0,
y: mousePos.y - n.computedPosition?.y || 0,
@@ -106,18 +105,7 @@ export const calcNextPosition = (
const clampedPos = clampPosition(nextPosition, extent)
const parentPosition = { x: 0, y: 0 }
if (parentNode) {
parentPosition.x = parentNode.computedPosition.x
parentPosition.y = parentNode.computedPosition.y
}
return {
position: {
x: clampedPos.x - parentPosition.x,
y: clampedPos.y - parentPosition.y,
},
computedPosition: clampedPos,
position: clampedPos,
}
}