feat(touch_bar): zoom slider

This commit is contained in:
Elian Doran 2025-03-08 22:35:36 +02:00
parent 0fe5f79f09
commit 36eac98b4d
No known key found for this signature in database

View File

@ -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 = `\
<div class="geo-map-widget">
@ -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);
},
})
];
}
}