Only create pointermove when someone listens

This commit is contained in:
ahocevar
2019-08-29 22:35:51 +02:00
parent fe83d1b32c
commit 20df00a4e8

View File

@@ -270,9 +270,11 @@ class MapBrowserEventHandler extends EventTarget {
* @private
*/
relayEvent_(pointerEvent) {
const dragging = !!(this.down_ && this.isMoving_(pointerEvent));
this.dispatchEvent(new MapBrowserPointerEvent(
pointerEvent.type, this.map_, pointerEvent, dragging));
if (this.map_.hasListener(pointerEvent.type)) {
const dragging = !!(this.down_ && this.isMoving_(pointerEvent));
this.dispatchEvent(new MapBrowserPointerEvent(
pointerEvent.type, this.map_, pointerEvent, dragging));
}
}
/**