Make sure horizontal-only scroll events can be translated into map pans (close #7659)

This commit is contained in:
Quincy Morgan
2020-06-04 13:29:45 -04:00
parent d6fc0ca619
commit 572ce0a787
2 changed files with 7 additions and 11 deletions
+6 -6
View File
@@ -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) {
+1 -5
View File
@@ -212,13 +212,9 @@ export function utilZoomPan() {
g.mouse[1] = t.invert(g.mouse[0] = p);
}
clearTimeout(g.wheel);
}
// If this wheel event wont 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();