fix(core): non-passive wheel event listener violation

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-03-22 20:09:05 +01:00
committed by Braks
parent 95b346d224
commit e7c39b065d
@@ -162,8 +162,9 @@ onMounted(() => {
watchEffect(() => { watchEffect(() => {
if (panOnScroll && !zoomKeyPressed.value && !userSelectionActive) { if (panOnScroll && !zoomKeyPressed.value && !userSelectionActive) {
d3Selection d3Selection.on(
.on('wheel', (event: WheelEvent) => { 'wheel.zoom',
(event: WheelEvent) => {
if (isWrappedWithClass(event, noWheelClassName)) { if (isWrappedWithClass(event, noWheelClassName)) {
return false return false
} }
@@ -190,18 +191,22 @@ onMounted(() => {
const deltaY = panOnScrollMode === PanOnScrollMode.Horizontal ? 0 : event.deltaY * deltaNormalize const deltaY = panOnScrollMode === PanOnScrollMode.Horizontal ? 0 : event.deltaY * deltaNormalize
d3Zoom.translateBy(d3Selection, -(deltaX / currentZoom) * panOnScrollSpeed, -(deltaY / currentZoom) * panOnScrollSpeed) d3Zoom.translateBy(d3Selection, -(deltaX / currentZoom) * panOnScrollSpeed, -(deltaY / currentZoom) * panOnScrollSpeed)
}) },
.on('wheel.zoom', null) { passive: false },
)
} else if (typeof d3ZoomHandler !== 'undefined') { } else if (typeof d3ZoomHandler !== 'undefined') {
d3Selection d3Selection.on(
.on('wheel', (event: WheelEvent) => { 'wheel.zoom',
function (event: WheelEvent, d) {
if (!preventScrolling || isWrappedWithClass(event, noWheelClassName)) { if (!preventScrolling || isWrappedWithClass(event, noWheelClassName)) {
return null return null
} }
event.preventDefault() event.preventDefault()
}) d3ZoomHandler.call(this, event, d)
.on('wheel.zoom', d3ZoomHandler) },
{ passive: false },
)
} }
}) })