diff --git a/apps/client/src/widgets/type_widgets/geo_map.ts b/apps/client/src/widgets/type_widgets/geo_map.ts index 22022878f..65abbc094 100644 --- a/apps/client/src/widgets/type_widgets/geo_map.ts +++ b/apps/client/src/widgets/type_widgets/geo_map.ts @@ -127,34 +127,25 @@ export default class GeoMapTypeWidget extends TypeWidget { } async #onMapInitialized(L: Leaflet) { - this.L = L; - const map = this.geoMapWidget.map; - if (!map) { - throw new Error(t("geo-map.unable-to-load-map")); - } + // this.L = L; - // Restore markers. - await this.#reloadMarkers(); + // // Restore markers. + // await this.#reloadMarkers(); - // 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); - const updateFn = () => this.spacedUpdate.scheduleUpdate(); - map.on("moveend", updateFn); - map.on("zoomend", updateFn); - map.on("click", (e) => this.#onMapClicked(e)); + // if (hasTouchBar) { + // map.on("zoom", () => { + // if (!this.ignoreNextZoomEvent) { + // this.triggerCommand("refreshTouchBar"); + // } - if (hasTouchBar) { - map.on("zoom", () => { - if (!this.ignoreNextZoomEvent) { - this.triggerCommand("refreshTouchBar"); - } - - this.ignoreNextZoomEvent = false; - }); - } + // this.ignoreNextZoomEvent = false; + // }); + // } } async #reloadMarkers() { @@ -311,24 +302,6 @@ export default class GeoMapTypeWidget extends TypeWidget { await attributes.setLabel(noteId, LOCATION_ATTRIBUTE, value); } - getData(): any { - const map = this.geoMapWidget.map; - if (!map) { - return; - } - - const data: MapData = { - view: { - center: map.getBounds().getCenter(), - zoom: map.getZoom() - } - }; - - return { - content: JSON.stringify(data) - }; - } - async geoMapCreateChildNoteEvent({ ntxId }: EventData<"geoMapCreateChildNote">) { if (!this.isNoteContext(ntxId)) { return; 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 a7c3ad77c..9684094a9 100644 --- a/apps/client/src/widgets/view_widgets/geo_view/index.ts +++ b/apps/client/src/widgets/view_widgets/geo_view/index.ts @@ -1,6 +1,8 @@ import ViewMode, { ViewModeArgs } from "../view_mode.js"; import L from "leaflet"; import type { LatLng, Map } from "leaflet"; +import SpacedUpdate from "../../../services/spaced_update.js"; +import { t } from "../../../services/i18n.js"; const TPL = /*html*/`