fix(core): allow pinch-zoom if preventScrolling is disabled
This commit is contained in:
@@ -255,6 +255,14 @@ onMounted(() => {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const zoomScroll = zoomKeyPressed.value || zoomOnScroll.value
|
||||||
|
const pinchZoom = zoomOnPinch.value && event.ctrlKey
|
||||||
|
|
||||||
|
const scrollEventEnabled = !preventScrolling.value || shouldPanOnScroll.value || zoomScroll || pinchZoom
|
||||||
|
|
||||||
|
if (!scrollEventEnabled) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopImmediatePropagation()
|
event.stopImmediatePropagation()
|
||||||
|
|
||||||
@@ -323,7 +331,9 @@ onMounted(() => {
|
|||||||
d3Selection.on(
|
d3Selection.on(
|
||||||
'wheel.zoom',
|
'wheel.zoom',
|
||||||
function (this: any, event: WheelEvent, d: any) {
|
function (this: any, event: WheelEvent, d: any) {
|
||||||
if (!preventScrolling.value || isWrappedWithClass(event, noWheelClassName.value)) {
|
// we still want to enable pinch zooming even if preventScrolling is set to false
|
||||||
|
const invalidEvent = !preventScrolling.value && event.type === 'wheel' && !event.ctrlKey
|
||||||
|
if (invalidEvent || isWrappedWithClass(event, noWheelClassName.value)) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user