Merge pull request #12330 from ahocevar/emulated-event
Do not require PointerEvent constructor
This commit is contained in:
@@ -8,6 +8,7 @@ import MapBrowserEventType from './MapBrowserEventType.js';
|
|||||||
import PointerEventType from './pointer/EventType.js';
|
import PointerEventType from './pointer/EventType.js';
|
||||||
import Target from './events/Target.js';
|
import Target from './events/Target.js';
|
||||||
import {DEVICE_PIXEL_RATIO, PASSIVE_EVENT_LISTENERS} from './has.js';
|
import {DEVICE_PIXEL_RATIO, PASSIVE_EVENT_LISTENERS} from './has.js';
|
||||||
|
import {VOID} from './functions.js';
|
||||||
import {listen, unlistenByKey} from './events.js';
|
import {listen, unlistenByKey} from './events.js';
|
||||||
|
|
||||||
class MapBrowserEventHandler extends Target {
|
class MapBrowserEventHandler extends Target {
|
||||||
@@ -244,11 +245,12 @@ class MapBrowserEventHandler extends Target {
|
|||||||
);
|
);
|
||||||
this.dispatchEvent(newEvent);
|
this.dispatchEvent(newEvent);
|
||||||
|
|
||||||
this.down_ = new PointerEvent(pointerEvent.type, pointerEvent);
|
// Store a copy of the down event
|
||||||
Object.defineProperty(this.down_, 'target', {
|
this.down_ = /** @type {PointerEvent} */ ({});
|
||||||
writable: false,
|
for (const property in pointerEvent) {
|
||||||
value: pointerEvent.target,
|
const value = pointerEvent[property];
|
||||||
});
|
this.down_[property] = typeof value === 'function' ? VOID : value;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.dragListenerKeys_.length === 0) {
|
if (this.dragListenerKeys_.length === 0) {
|
||||||
const doc = this.map_.getOwnerDocument();
|
const doc = this.map_.getOwnerDocument();
|
||||||
|
|||||||
Reference in New Issue
Block a user