Skip to content

Commit aaff7f3

Browse files
committed
chore(core): cleanup
Signed-off-by: braks <[email protected]>
1 parent 033c4d4 commit aaff7f3

File tree

4 files changed

+22
-63
lines changed

4 files changed

+22
-63
lines changed

packages/core/src/composables/useGetPointerPosition.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { getEventPosition, isUseDragEvent, pointToRendererPoint, snapPosition } from '../utils'
1+
import { getEventPosition, snapPosition } from '@xyflow/system'
2+
import { isUseDragEvent, pointToRendererPoint } from '../utils'
23
import type { MouseTouchEvent } from '../types'
34
import { useVueFlow } from './useVueFlow'
45
import type { UseDragEvent } from './useDrag'

packages/core/src/composables/useHandle.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import type { Connection, ConnectionInProgress, HandleElement, HandleType, Mouse
55
import {
66
getClosestHandle,
77
getConnectionStatus,
8+
getHandle,
9+
getHandlePosition,
810
getHandleType,
11+
isConnectionValid,
912
isValidHandle,
1013
oppositePosition,
1114
pointToRendererPoint,
@@ -212,7 +215,11 @@ export function useHandle({
212215
isValid,
213216
to:
214217
closestHandle && isValid
215-
? rendererPointToPoint({ x: closestHandle.x, y: closestHandle.y }, viewport.value)
218+
? rendererPointToPoint({ x: closestHandle.x, y: closestHandle.y }, [
219+
viewport.value.x,
220+
viewport.value.y,
221+
viewport.value.zoom,
222+
])
216223
: connectionPosition,
217224
toHandle: result.toHandle,
218225
toPosition: isValid && result.toHandle ? result.toHandle.position : oppositePosition[fromHandle.position],

packages/core/src/utils/drag.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { markRaw } from 'vue'
2+
import type { UseDragEvent } from '@xyflow/system'
23
import { clampPosition } from '@xyflow/system'
34
import type {
45
Actions,
@@ -12,6 +13,10 @@ import type {
1213
} from '../types'
1314
import { ErrorCode, VueFlowError, isParentSelected } from '.'
1415

16+
export function isUseDragEvent(event: any): event is UseDragEvent {
17+
return 'sourceEvent' in event
18+
}
19+
1520
export function hasSelector(target: Element, selector: string, node: Element): boolean {
1621
let current = target
1722

pnpm-lock.yaml

Lines changed: 7 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)