From 5fa9729d6a051cc45d84ea8f843b131754c7e6e2 Mon Sep 17 00:00:00 2001 From: itskovacs Date: Sat, 6 Sep 2025 21:50:50 +0200 Subject: [PATCH] :lipstick: Map: long press on mobile --- .../app/components/dashboard/dashboard.component.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/src/app/components/dashboard/dashboard.component.ts b/src/src/app/components/dashboard/dashboard.component.ts index 2067b8b..90837fa 100644 --- a/src/src/app/components/dashboard/dashboard.component.ts +++ b/src/src/app/components/dashboard/dashboard.component.ts @@ -193,7 +193,7 @@ export class DashboardComponent implements OnInit, AfterViewInit { initMap(): void { if (!this.settings) return; - + const isTouch = "ontouchstart" in window; const contentMenuItems = [ { text: "Add Point of Interest", @@ -203,7 +203,15 @@ export class DashboardComponent implements OnInit, AfterViewInit { }, }, ]; - this.map = createMap(contentMenuItems, this.settings?.tile_layer); + this.map = createMap( + isTouch ? [] : contentMenuItems, + this.settings?.tile_layer, + ); + if (isTouch) { + this.map.on("contextmenu", (e: any) => { + this.addPlaceModal(e); + }); + } this.map.setView(L.latLng(this.settings.map_lat, this.settings.map_lng)); this.map.on("moveend zoomend", () => this.setVisibleMarkers()); this.markerClusterGroup = createClusterGroup().addTo(this.map);