Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): avoid triggering edge update when mouse btn is not left #663

Merged
merged 2 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/few-walls-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@vue-flow/core': patch
---

Avoid triggering edge update when mouse button is not left
8 changes: 6 additions & 2 deletions packages/core/src/components/Edges/EdgeWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,16 @@ const EdgeWrapper = defineComponent({
}

function handleEdgeUpdater(event: MouseEvent, isSourceHandle: boolean) {
if (event.button !== 0) return

updating = true

nodeId.value = isSourceHandle ? edge.target : edge.source
handleId.value = (isSourceHandle ? edge.targetHandle : edge.sourceHandle) ?? ''
type.value = isSourceHandle ? 'target' : 'source'

edgeUpdaterType.value = type.value

mouseEvent.value = event

hooks.emit.updateStart({ event, edge })
Expand Down Expand Up @@ -274,12 +280,10 @@ const EdgeWrapper = defineComponent({
}

function onEdgeUpdaterSourceMouseDown(event: MouseEvent) {
updating = true
handleEdgeUpdater(event, true)
}

function onEdgeUpdaterTargetMouseDown(event: MouseEvent) {
updating = true
handleEdgeUpdater(event, false)
}

Expand Down