From 572ce0a787bc4a8ba7a32a485111ffc959b1a9db Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Thu, 4 Jun 2020 13:29:45 -0400 Subject: [PATCH] Make sure horizontal-only scroll events can be translated into map pans (close #7659) --- modules/renderer/map.js | 12 ++++++------ modules/util/zoom_pan.js | 6 +----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/modules/renderer/map.js b/modules/renderer/map.js index 37c8e14c5..e8b729f06 100644 --- a/modules/renderer/map.js +++ b/modules/renderer/map.js @@ -451,12 +451,6 @@ export function rendererMap(context) { var y = eventTransform.y; var k = eventTransform.k; - if (_transformStart.x === x && - _transformStart.y === y && - _transformStart.k === k) { - return; // no change - } - // Special handling of 'wheel' events: // They might be triggered by the user scrolling the mouse wheel, // or 2-finger pinch/zoom gestures, the transform may need adjustment. @@ -575,6 +569,12 @@ export function rendererMap(context) { } + if (_transformStart.x === x && + _transformStart.y === y && + _transformStart.k === k) { + return; // no change + } + var withinEditableZoom = map.withinEditableZoom(); if (_lastWithinEditableZoom !== withinEditableZoom) { if (_lastWithinEditableZoom !== undefined) { diff --git a/modules/util/zoom_pan.js b/modules/util/zoom_pan.js index ef21b9494..2d6e47896 100644 --- a/modules/util/zoom_pan.js +++ b/modules/util/zoom_pan.js @@ -212,13 +212,9 @@ export function utilZoomPan() { g.mouse[1] = t.invert(g.mouse[0] = p); } clearTimeout(g.wheel); - } - - // If this wheel event won’t trigger a transform change, ignore it. - else if (t.k === k) return; // Otherwise, capture the mouse point and location at the start. - else { + } else { g.mouse = [p, t.invert(p)]; d3_interrupt(this); g.start();