From 9be39218dfe529ecbd4698472b9f2b015335a71c Mon Sep 17 00:00:00 2001 From: netil Date: Fri, 7 Jun 2024 16:36:31 +0900 Subject: [PATCH] fix(zoom): Remove unused wheel listener - Remove unused mouse wheel event bind, where added as part of workaound for chrome - Apply code format Ref #3791 --- src/ChartInternal/interactions/zoom.ts | 4 ---- src/module/util.ts | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ChartInternal/interactions/zoom.ts b/src/ChartInternal/interactions/zoom.ts index 129b64567..3e5f5c006 100644 --- a/src/ChartInternal/interactions/zoom.ts +++ b/src/ChartInternal/interactions/zoom.ts @@ -332,10 +332,6 @@ export default { const {config, $el: {eventRect}} = $$; const behaviour = config.zoom_type === "drag" ? $$.zoomBehaviour : $$.zoom; - // Since Chrome 89, wheel zoom not works properly - // Applying the workaround: https://github.com/d3/d3-zoom/issues/231#issuecomment-802305692 - $$.$el.svg.on("wheel", () => {}); - eventRect?.call(behaviour) .on("dblclick.zoom", null); }, diff --git a/src/module/util.ts b/src/module/util.ts index 3cfd1f378..9cfd89c2f 100644 --- a/src/module/util.ts +++ b/src/module/util.ts @@ -835,7 +835,8 @@ function convertInputType(mouse: boolean, touch: boolean): "mouse" | "touch" | n // Check if agent has mouse using any-hover, touch devices (e.g iPad) with external mouse will return true as long as mouse is connected // https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs // Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/ - const hasMouse = mouse && (matchMedia?.("any-hover:hover").matches || matchMedia?.("any-pointer:fine").matches); + const hasMouse = mouse && + (matchMedia?.("any-hover:hover").matches || matchMedia?.("any-pointer:fine").matches); // fallback to 'mouse' if no input type is detected. return (hasMouse && "mouse") || (hasTouch && "touch") || "mouse";