@@ -76,6 +76,8 @@ const shouldPanOnScroll = toRef(() => panKeyPressed.value || panOnScroll.value)
7676
7777const isSelecting = toRef (() => selectionKeyPressed .value || (selectionKeyCode .value === true && shouldPanOnDrag .value !== true ))
7878
79+ const connectionInProgress = toRef (() => connectionStartHandle .value !== null )
80+
7981onMounted (() => {
8082 if (! viewportRef .value ) {
8183 warn (' Viewport element is missing' )
@@ -163,6 +165,7 @@ onMounted(() => {
163165 const zoomScroll = zoomKeyPressed .value || zoomOnScroll .value
164166 const pinchZoom = zoomOnPinch .value && event .ctrlKey
165167 const eventButton = (event as MouseEvent ).button
168+ const isWheelEvent = event .type === ' wheel'
166169
167170 if (
168171 eventButton === 1 &&
@@ -182,30 +185,35 @@ onMounted(() => {
182185 return false
183186 }
184187
188+ // we want to disable pinch-zooming while making a connection
189+ if (connectionInProgress .value && ! isWheelEvent ) {
190+ return false
191+ }
192+
185193 // if zoom on double click is disabled, we prevent the double click event
186194 if (! zoomOnDoubleClick .value && event .type === ' dblclick' ) {
187195 return false
188196 }
189197
190198 // if the target element is inside an element with the nowheel class, we prevent zooming
191- if (isWrappedWithClass (event , noWheelClassName .value ) && event . type === ' wheel ' ) {
199+ if (isWrappedWithClass (event , noWheelClassName .value ) && isWheelEvent ) {
192200 return false
193201 }
194202
195203 // if the target element is inside an element with the nopan class, we prevent panning
196204 if (
197205 isWrappedWithClass (event , noPanClassName .value ) &&
198- (event . type !== ' wheel ' || (shouldPanOnScroll .value && event . type === ' wheel ' && ! zoomKeyPressed .value ))
206+ (! isWheelEvent || (shouldPanOnScroll .value && isWheelEvent && ! zoomKeyPressed .value ))
199207 ) {
200208 return false
201209 }
202210
203- if (! zoomOnPinch .value && event .ctrlKey && event . type === ' wheel ' ) {
211+ if (! zoomOnPinch .value && event .ctrlKey && isWheelEvent ) {
204212 return false
205213 }
206214
207215 // when there is no scroll handling enabled, we prevent all wheel events
208- if (! zoomScroll && ! shouldPanOnScroll .value && ! pinchZoom && event . type === ' wheel ' ) {
216+ if (! zoomScroll && ! shouldPanOnScroll .value && ! pinchZoom && isWheelEvent ) {
209217 return false
210218 }
211219
@@ -242,7 +250,7 @@ onMounted(() => {
242250 eventButton <= 1
243251
244252 // default filter for d3-zoom
245- return (! event .ctrlKey || panKeyPressed .value || event . type === ' wheel ' ) && buttonAllowed
253+ return (! event .ctrlKey || panKeyPressed .value || isWheelEvent ) && buttonAllowed
246254 })
247255
248256 watch (
@@ -414,7 +422,7 @@ export default {
414422 :is-selecting =" isSelecting"
415423 :selection-key-pressed =" selectionKeyPressed"
416424 :class =" {
417- connecting: !!connectionStartHandle ,
425+ connecting: connectionInProgress ,
418426 dragging: paneDragging,
419427 draggable: panOnDrag === true || (Array.isArray(panOnDrag) && panOnDrag.includes(0)),
420428 }"
0 commit comments