From d15fccb1d82391c9dbdb189e0e1e35fd80256e1c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 6 Jul 2025 18:36:36 +0300 Subject: [PATCH] chore(views/geomap): integrate context menu options --- .../src/widgets/type_widgets/geo_map.ts | 27 +++---------------- .../widgets/view_widgets/geo_view/index.ts | 16 +++++++++++ 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/apps/client/src/widgets/type_widgets/geo_map.ts b/apps/client/src/widgets/type_widgets/geo_map.ts index dd4714470..9ef2cc489 100644 --- a/apps/client/src/widgets/type_widgets/geo_map.ts +++ b/apps/client/src/widgets/type_widgets/geo_map.ts @@ -49,10 +49,10 @@ export default class GeoMapTypeWidget extends TypeWidget { async #onMapInitialized(L: Leaflet) { // this.L = L; - // // This fixes an issue with the map appearing cut off at the beginning, due to the container not being properly attached - // setTimeout(() => { - // map.invalidateSize(); - // }, 100); + // This fixes an issue with the map appearing cut off at the beginning, due to the container not being properly attached + setTimeout(() => { + map.invalidateSize(); + }, 100); } @@ -63,23 +63,4 @@ export default class GeoMapTypeWidget extends TypeWidget { // await this.#reloadMarkers(); } - entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { - - } - - openGeoLocationEvent({ noteId, event }: EventData<"openGeoLocation">) { - const marker = this.currentMarkerData[noteId]; - if (!marker) { - return; - } - - const latLng = this.currentMarkerData[noteId].getLatLng(); - const url = `geo:${latLng.lat},${latLng.lng}`; - link.goToLinkExt(event, url); - } - - deleteFromMapEvent({ noteId }: EventData<"deleteFromMap">) { - // this.moveMarker(noteId, null); - } - } diff --git a/apps/client/src/widgets/view_widgets/geo_view/index.ts b/apps/client/src/widgets/view_widgets/geo_view/index.ts index 89a1f6111..5791ecf38 100644 --- a/apps/client/src/widgets/view_widgets/geo_view/index.ts +++ b/apps/client/src/widgets/view_widgets/geo_view/index.ts @@ -11,6 +11,7 @@ import dialog from "../../../services/dialog.js"; import server from "../../../services/server.js"; import attributes from "../../../services/attributes.js"; import { moveMarker } from "./editing.js"; +import link from "../../../services/link.js"; // TODO: Deduplicate interface CreateChildResponse { @@ -313,6 +314,21 @@ export default class GeoView extends ViewMode { this.#changeState(State.Normal); } + openGeoLocationEvent({ noteId, event }: EventData<"openGeoLocation">) { + const marker = this.currentMarkerData[noteId]; + if (!marker) { + return; + } + + const latLng = this.currentMarkerData[noteId].getLatLng(); + const url = `geo:${latLng.lat},${latLng.lng}`; + link.goToLinkExt(event, url); + } + + deleteFromMapEvent({ noteId }: EventData<"deleteFromMap">) { + moveMarker(noteId, null); + } + buildTouchBarCommand({ TouchBar }: CommandListenerData<"buildTouchBar">) { const map = this.map; const that = this;