File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
packages/core/src/container/Viewport Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,11 @@ const selectionKeyPressed = useKeyPress(selectionKeyCode)
66
66
67
67
const zoomKeyPressed = useKeyPress (zoomActivationKeyCode )
68
68
69
- const shouldPanOnDrag = toRef (() => ! selectionKeyPressed .value && (panKeyPressed .value || panOnDrag .value ))
69
+ const shouldPanOnDrag = toRef (
70
+ () =>
71
+ (! selectionKeyPressed .value || (selectionKeyPressed .value && selectionKeyCode .value === true )) &&
72
+ (panKeyPressed .value || panOnDrag .value ),
73
+ )
70
74
71
75
const shouldPanOnScroll = toRef (() => panKeyPressed .value || panOnScroll .value )
72
76
@@ -226,9 +230,16 @@ onMounted(() => {
226
230
return false
227
231
}
228
232
233
+ const leftMouseBtnPanAllowed =
234
+ eventButton !== 0 || (selectionKeyCode .value === true && Array .isArray (panOnDrag .value ) && ! panOnDrag .value .includes (0 ))
235
+
229
236
// We only allow right clicks if pan on drag is set to right-click
230
237
const buttonAllowed =
231
- (Array .isArray (shouldPanOnDrag .value ) && shouldPanOnDrag .value .includes (eventButton )) || ! eventButton || eventButton <= 1
238
+ leftMouseBtnPanAllowed &&
239
+ ((Array .isArray (panOnDrag .value ) && panOnDrag .value .includes (eventButton )) ||
240
+ (selectionKeyCode .value === true && Array .isArray (panOnDrag .value ) && ! panOnDrag .value .includes (0 )) ||
241
+ ! eventButton ||
242
+ eventButton <= 1 )
232
243
233
244
// default filter for d3-zoom
234
245
return (! event .ctrlKey || event .type === ' wheel' ) && buttonAllowed
You can’t perform that action at this time.
0 commit comments