From bb5e0773aee4dacb2984a659bf06259bbb73d0f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Mon, 19 Apr 2021 00:22:20 +0200 Subject: [PATCH] Move tolerance should not increase with higher pixel ratio Browsers already handle the scaling, no need to multiply this again. This now also allows setting a moveTolerance of zero which was not possible before. In the isMoving_ method the condition is distance > tolerance so this will work. --- src/ol/MapBrowserEventHandler.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ol/MapBrowserEventHandler.js b/src/ol/MapBrowserEventHandler.js index cfd3851c44..f35ad17811 100644 --- a/src/ol/MapBrowserEventHandler.js +++ b/src/ol/MapBrowserEventHandler.js @@ -7,7 +7,7 @@ import MapBrowserEvent from './MapBrowserEvent.js'; import MapBrowserEventType from './MapBrowserEventType.js'; import PointerEventType from './pointer/EventType.js'; import Target from './events/Target.js'; -import {DEVICE_PIXEL_RATIO, PASSIVE_EVENT_LISTENERS} from './has.js'; +import {PASSIVE_EVENT_LISTENERS} from './has.js'; import {VOID} from './functions.js'; import {listen, unlistenByKey} from './events.js'; @@ -54,9 +54,7 @@ class MapBrowserEventHandler extends Target { * @type {number} * @private */ - this.moveTolerance_ = moveTolerance - ? moveTolerance * DEVICE_PIXEL_RATIO - : DEVICE_PIXEL_RATIO; + this.moveTolerance_ = moveTolerance === undefined ? 1 : moveTolerance; /** * The most recent "down" type event (or null if none have occurred).