chore(core): cleanup

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-04-11 20:28:02 +02:00
committed by Braks
parent 27d62b29b7
commit 7a55cb992d
+3 -8
View File
@@ -18,7 +18,6 @@ interface UseDragParams {
}
function useDrag(params: UseDragParams) {
const {
vueFlowRef,
snapToGrid,
@@ -60,7 +59,7 @@ function useDrag(params: UseDragParams) {
const getPointerPosition = useGetPointerPosition()
const updateNodes = ({ x, y }: XYPosition, onBeforeUpdate: (position: XYPosition) => XYPosition = (xyPos) => xyPos) => {
const updateNodes = ({ x, y }: XYPosition) => {
lastPos = { x, y }
let hasChange = false
@@ -73,7 +72,7 @@ function useDrag(params: UseDragParams) {
nextPosition.y = snapGrid[1] * Math.round(nextPosition.y / snapGrid[1])
}
let { computedPosition } = calcNextPosition(
const { computedPosition } = calcNextPosition(
n,
nextPosition,
emits.error,
@@ -81,8 +80,6 @@ function useDrag(params: UseDragParams) {
n.parentNode ? findNode(n.parentNode) : undefined,
)
computedPosition = onBeforeUpdate(computedPosition)
// we want to make sure that we only fire a change event when there is a change
hasChange = hasChange || n.position.x !== computedPosition.x || n.position.y !== computedPosition.y
@@ -128,10 +125,8 @@ function useDrag(params: UseDragParams) {
Math.round(transform.x) !== Math.round(previousTransform.x) ||
Math.round(transform.y) !== Math.round(previousTransform.y)
) {
previousTransform = transform
updateNodes(nextPos)
previousTransform = transform
lastPos = nextPos
}
})