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

chore: next release #1671

Merged
merged 2 commits into from
Nov 1, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @vue-flow/core

## 1.41.4

### Patch Changes

- [#1670](https://github.com/bcakmakoglu/vue-flow/pull/1670) [`4bc7658`](https://github.com/bcakmakoglu/vue-flow/commit/4bc76586e1013c8a17b2a83ff32a050f2e16c350) Thanks [@bcakmakoglu](https://github.com/bcakmakoglu)! - if selection key code is true prevent pan on drag on left mouse btn

## 1.41.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-flow/core",
"version": "1.41.3",
"version": "1.41.4",
"private": false,
"license": "MIT",
"author": "Burak Cakmakoglu<[email protected]>",
Expand Down
17 changes: 9 additions & 8 deletions packages/core/src/container/Viewport/Viewport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ onMounted(() => {
return false
}

// if selection key code is true and panOnDrag tries to use left mouse button we prevent it
if (selectionKeyCode.value === true && Array.isArray(panOnDrag.value) && panOnDrag.value.includes(0) && eventButton === 0) {
return false
}

// if the pane is only movable using allowed clicks
if (
Array.isArray(shouldPanOnDrag.value) &&
Expand All @@ -230,16 +235,12 @@ onMounted(() => {
return false
}

const leftMouseBtnPanAllowed =
eventButton !== 0 || (selectionKeyCode.value === true && Array.isArray(panOnDrag.value) && !panOnDrag.value.includes(0))

// We only allow right clicks if pan on drag is set to right-click
const buttonAllowed =
leftMouseBtnPanAllowed &&
((Array.isArray(panOnDrag.value) && panOnDrag.value.includes(eventButton)) ||
(selectionKeyCode.value === true && Array.isArray(panOnDrag.value) && !panOnDrag.value.includes(0)) ||
!eventButton ||
eventButton <= 1)
(Array.isArray(shouldPanOnDrag.value) && shouldPanOnDrag.value.includes(eventButton)) ||
(selectionKeyCode.value === true && Array.isArray(shouldPanOnDrag.value) && !shouldPanOnDrag.value.includes(0)) ||
!eventButton ||
eventButton <= 1

// default filter for d3-zoom
return (!event.ctrlKey || event.type === 'wheel') && buttonAllowed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe('Viewport drag / zoom', () => {
beforeEach(() => {
cy.vueFlow({
nodes,
fitViewOnInit: false,
})
})

Expand All @@ -27,6 +28,7 @@ describe('Viewport drag / zoom', () => {
await cy.tryAssertion(() => {
cy.transformationPane()
.should('exist')
.should('not.have.css', 'transform', 'matrix(1, 0, 0, 1, 0, 0)')
.should(
'have.css',
'transform',
Expand Down
Loading