Closed Mushr0000m closed 2 years ago
@Mushr0000m I think it should work if you do following:
L.Map.ScrollWheelZoom.include({
_performZoom: function () {
var map = this._map,
zoom = map.getZoom(),
snap = this._map.options.zoomSnap || 0;
map._stop(); // stop panning and fly animations if any
// map the delta with a sigmoid function to -4..4 range leaning on -1..1
var d2 = this._delta / (this._map.options.wheelPxPerZoomLevel * 4),
d3 = 4 * Math.log(2 / (1 + Math.exp(-Math.abs(d2)))) / Math.LN2,
d4 = snap ? Math.ceil(d3 / snap) * snap : d3,
delta = map._limitZoom(zoom + (this._delta > 0 ? d4 : -d4)) - zoom;
this._delta = 0;
this._startTime = null;
if (!delta) { return; }
if (map.options.scrollWheelZoom === 'center') {
map.setZoom(zoom + delta, {animate: false});
} else {
map.setZoomAround(this._lastMousePos, zoom + delta, {animate: false});
}
}
})
Due to issue not fixed https://github.com/Leaflet/Leaflet/issues/4410 is there a way to disable the
zoomAnimation
but only for zoom with the wheel, not globaly ? Inertia on MacOs mouses and trackpads makes the zoom jumpy and weird.