nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit 4e4e1173bac509cd494e32d887f2a773dda8c945
parent 9b27339b5917eb8135f77b4a882b7e75108c924b
Author: Sergej Orlov <wladimirych@gmail.com>
Date:   Sat, 21 Jan 2023 16:47:18 +0100

Fix map zooming 2 levels on each mouse wheel "tick"

This fixes issue on Linux in Chrome and Firefox.

Diffstat:
Msrc/lib/leaflet.fixes/index.js | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/lib/leaflet.fixes/index.js b/src/lib/leaflet.fixes/index.js @@ -100,6 +100,15 @@ function addTooltipDelay() { }; } +// Should become obsolete when https://github.com/Leaflet/Leaflet/issues/4696 is done +function fixDoubleZoomOnMouseWheel() { + const origGetWheelDelta = L.DomEvent.getWheelDelta; + L.DomEvent.getWheelDelta = function(e) { + const delta = origGetWheelDelta(e); + return Math.sign(delta) * Math.min(Math.abs(delta), 60); + }; +} + function fixAll() { fixPanAnimationBug(); fixTouchDetection(); @@ -108,6 +117,7 @@ function fixAll() { fixVectorMarkerWorldJump(); allowControlHorizontalStacking(); addTooltipDelay(); + fixDoubleZoomOnMouseWheel(); } export {fixAll};