show popup after content has been rendered, fixes popup placement, see #124

This commit is contained in:
vcoppe
2024-10-01 16:56:13 +02:00
parent 572d206c2c
commit 3262dec7d3
3 changed files with 20 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ import { getElevation, resetCursor, setGrabbingCursor, setPointerCursor, setScis
import { selectedWaypoint } from "$lib/components/toolbar/tools/Waypoint.svelte";
import { MapPin, Square } from "lucide-static";
import { getSymbolKey, symbols } from "$lib/assets/symbols";
import { tick } from "svelte";
const colors = [
'#ff0000',
@@ -394,13 +395,18 @@ export class GPXLayer {
showWaypointPopup(waypoint: Waypoint) {
if (get(currentPopupWaypoint) !== null) {
this.hideWaypointPopup();
} else if (waypoint === get(currentPopupWaypoint)?.[0]) {
return;
}
let marker = this.markers[waypoint._data.index];
if (marker) {
currentPopupWaypoint.set([waypoint, this.fileId]);
marker.setPopup(waypointPopup);
marker.togglePopup();
this.map.on('mousemove', this.maybeHideWaypointPopupBinded);
tick().then(() => {
// Show popup once the content component has been rendered
marker.setPopup(waypointPopup);
marker.togglePopup();
this.map.on('mousemove', this.maybeHideWaypointPopupBinded);
});
}
}