fix(core): calculate position and computedPos correctly in calcNextPosition
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -94,7 +94,7 @@ function useDrag(params: UseDragParams) {
|
||||
nextPosition.y = snapY * Math.round(nextPosition.y / snapY)
|
||||
}
|
||||
|
||||
const { position } = calcNextPosition(
|
||||
const { computedPosition } = calcNextPosition(
|
||||
n,
|
||||
nextPosition,
|
||||
nodeExtent,
|
||||
@@ -104,7 +104,7 @@ function useDrag(params: UseDragParams) {
|
||||
// we want to make sure that we only fire a change event when there is a changes
|
||||
hasChange = hasChange || n.position.x !== nextPosition.x || n.position.y !== nextPosition.y
|
||||
|
||||
n.position = position
|
||||
n.position = computedPosition
|
||||
|
||||
return n
|
||||
})
|
||||
|
||||
@@ -16,11 +16,16 @@ function useUpdateNodePositions() {
|
||||
const nodeUpdates = getSelectedNodes.value.map((n) => {
|
||||
const nextPosition = { x: n.computedPosition.x + positionDiffX, y: n.computedPosition.y + positionDiffY }
|
||||
|
||||
const updatedPos = calcNextPosition(n, nextPosition, nodeExtent.value, n.parentNode ? findNode(n.parentNode) : undefined)
|
||||
const { computedPosition } = calcNextPosition(
|
||||
n,
|
||||
nextPosition,
|
||||
nodeExtent.value,
|
||||
n.parentNode ? findNode(n.parentNode) : undefined,
|
||||
)
|
||||
|
||||
return {
|
||||
id: n.id,
|
||||
position: updatedPos.position,
|
||||
position: computedPosition,
|
||||
from: n.position,
|
||||
distance: { x: positionDiff.x, y: positionDiff.y },
|
||||
dimensions: n.dimensions,
|
||||
|
||||
Reference in New Issue
Block a user