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.
This commit is contained in:
Maximilian Krög
2021-04-19 00:22:20 +02:00
parent cf7213c5cb
commit bb5e0773ae

View File

@@ -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).