File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
packages/core/src/composables Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @vue-flow/core " : patch
3
+ ---
4
+
5
+ Use calculated drag distance to trigger drag-click.
Original file line number Diff line number Diff line change @@ -229,8 +229,19 @@ export function useDrag(params: UseDragParams) {
229
229
}
230
230
231
231
const eventEnd = ( event : UseDragEvent ) => {
232
- if ( ! dragging . value && ! multiSelectionActive . value ) {
233
- onClick ?.( event . sourceEvent )
232
+ if ( ! dragStarted && ! dragging . value && ! multiSelectionActive . value ) {
233
+ const pointerPos = getPointerPosition ( event )
234
+
235
+ const x = pointerPos . xSnapped - ( lastPos . x ?? 0 )
236
+ const y = pointerPos . ySnapped - ( lastPos . y ?? 0 )
237
+ const distance = Math . sqrt ( x * x + y * y )
238
+
239
+ // dispatch a click event if the node was attempted to be dragged but the threshold was not exceeded
240
+ if ( distance !== 0 && distance <= nodeDragThreshold . value ) {
241
+ onClick ?.( event . sourceEvent )
242
+ }
243
+
244
+ return
234
245
}
235
246
236
247
dragging . value = false
You can’t perform that action at this time.
0 commit comments