From 36eac98b4d5bf96de6d5d9cc9bce8b99dc906c5e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 8 Mar 2025 22:35:36 +0200 Subject: [PATCH] feat(touch_bar): zoom slider --- src/public/app/widgets/geo_map.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/public/app/widgets/geo_map.ts b/src/public/app/widgets/geo_map.ts index fabefcdc9..eef72a748 100644 --- a/src/public/app/widgets/geo_map.ts +++ b/src/public/app/widgets/geo_map.ts @@ -1,6 +1,7 @@ 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 = `\
@@ -59,4 +60,22 @@ export default class GeoMapWidget extends NoteContextAwareWidget { }); } + buildTouchBarCommand({ TouchBar }: CommandListenerData<"buildTouchBar">) { + const map = this.map; + if (!map) { + return; + } + + return [ + new TouchBar.TouchBarSlider({ + label: "Zoom", + minValue: map.getMinZoom(), + maxValue: map.getMaxZoom(), + change(newValue) { + map.setZoom(newValue); + }, + }) + ]; + } + }