Fix popups immideately closing again on mobile (Fixes #551)

This commit is contained in:
Lukas Rieger (Blue) 2024-06-11 19:02:24 +02:00
parent 4bb9c0a81d
commit 7ac9698b96
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6
2 changed files with 8 additions and 5 deletions

View File

@ -58,7 +58,7 @@ export class PopupMarker extends Marker {
this.animation = null;
this.events.addEventListener('bluemapMapInteraction', this.onMapInteraction);
this.events.addEventListener('bluemapMapInteraction', evt => window.setTimeout(() => this.onMapInteraction(evt)));
window.addEventListener("mousedown", this.removeHandler);
window.addEventListener("touchstart", this.removeHandler, { passive: true });

View File

@ -139,10 +139,13 @@ export class LabelPopup extends CSS2DObject {
window.removeEventListener("mousewheel", removeHandler);
};
window.addEventListener("mousedown", removeHandler);
window.addEventListener("touchstart", removeHandler, { passive: true });
window.addEventListener("keydown", removeHandler);
window.addEventListener("mousewheel", removeHandler);
// add listeners delayed to prevent closing
window.setTimeout(() => {
window.addEventListener("mousedown", removeHandler);
window.addEventListener("touchstart", removeHandler, { passive: true });
window.addEventListener("keydown", removeHandler);
window.addEventListener("mousewheel", removeHandler);
}, 100);
}
}