Better fix for changing pointer ids on event target change

This commit is contained in:
Andreas Hocevar
2022-06-15 16:29:07 +02:00
parent 307e9892fc
commit f99dc1e9ec
2 changed files with 15 additions and 13 deletions

View File

@@ -195,16 +195,6 @@ class PointerInteraction extends Interaction {
const id = event.pointerId.toString();
if (mapBrowserEvent.type == MapBrowserEventType.POINTERUP) {
delete this.trackedPointers_[id];
for (const pointerId in this.trackedPointers_) {
if (this.trackedPointers_[pointerId].target !== event.target) {
// Some platforms assign a new pointerId when the target changes.
// If this happens, delete one tracked pointer. If there is more
// than one tracked pointer for the old target, it will be cleared
// by subsequent POINTERUP events from other pointers.
delete this.trackedPointers_[pointerId];
break;
}
}
} else if (mapBrowserEvent.type == MapBrowserEventType.POINTERDOWN) {
this.trackedPointers_[id] = event;
} else if (id in this.trackedPointers_) {