diff --git a/src/public/app/widgets/geo_map.ts b/src/public/app/widgets/geo_map.ts index 76ff7d0eb..b9f14c3ef 100644 --- a/src/public/app/widgets/geo_map.ts +++ b/src/public/app/widgets/geo_map.ts @@ -1,7 +1,6 @@ import type { Map } from "leaflet"; import library_loader from "../services/library_loader.js"; import NoteContextAwareWidget from "./note_context_aware_widget.js"; -import type { CommandListenerData } from "../components/app_context.js"; const TPL = `\
@@ -62,27 +61,4 @@ export default class GeoMapWidget extends NoteContextAwareWidget { }); } - buildTouchBarCommand({ TouchBar }: CommandListenerData<"buildTouchBar">) { - const map = this.map; - if (!map) { - return; - } - - return [ - new TouchBar.TouchBarSlider({ - label: "Zoom", - value: map.getZoom(), - minValue: map.getMinZoom(), - maxValue: map.getMaxZoom(), - change(newValue) { - map.setZoom(newValue); - }, - }), - new TouchBar.TouchBarButton({ - label: "New geo note", - click: () => this.parent?.triggerEvent("geoMapCreateChildNote", { ntxId: this.ntxId }) - }) - ]; - } - } diff --git a/src/public/app/widgets/type_widgets/geo_map.ts b/src/public/app/widgets/type_widgets/geo_map.ts index dddccbac8..9c86bbf48 100644 --- a/src/public/app/widgets/type_widgets/geo_map.ts +++ b/src/public/app/widgets/type_widgets/geo_map.ts @@ -5,7 +5,7 @@ import TypeWidget from "./type_widget.js"; import server from "../../services/server.js"; import toastService from "../../services/toast.js"; import dialogService from "../../services/dialog.js"; -import type { EventData } from "../../components/app_context.js"; +import type { CommandListenerData, EventData } from "../../components/app_context.js"; import { t } from "../../services/i18n.js"; import attributes from "../../services/attributes.js"; import asset_path from "../../../../services/asset_path.js"; @@ -381,4 +381,27 @@ export default class GeoMapTypeWidget extends TypeWidget { this.moveMarker(noteId, null); } + buildTouchBarCommand({ TouchBar }: CommandListenerData<"buildTouchBar">) { + const map = this.geoMapWidget.map; + if (!map) { + return; + } + + return [ + new TouchBar.TouchBarSlider({ + label: "Zoom", + value: map.getZoom(), + minValue: map.getMinZoom(), + maxValue: map.getMaxZoom(), + change(newValue) { + map.setZoom(newValue); + }, + }), + new TouchBar.TouchBarButton({ + label: "New geo note", + click: () => this.triggerCommand("geoMapCreateChildNote", { ntxId: this.ntxId }) + }) + ]; + } + }