feat(touch_bar): reflect new note state

This commit is contained in:
Elian Doran 2025-03-08 23:21:13 +02:00
parent cbbe10ba67
commit a3c58834d1
No known key found for this signature in database

View File

@ -280,6 +280,7 @@ export default class GeoMapTypeWidget extends TypeWidget {
#changeState(newState: State) { #changeState(newState: State) {
this._state = newState; this._state = newState;
this.geoMapWidget.$container.toggleClass("placing-note", newState === State.NewNote); this.geoMapWidget.$container.toggleClass("placing-note", newState === State.NewNote);
this.triggerCommand("refreshTouchBar");
} }
async #onMapClicked(e: LeafletMouseEvent) { async #onMapClicked(e: LeafletMouseEvent) {
@ -396,22 +397,31 @@ export default class GeoMapTypeWidget extends TypeWidget {
return; return;
} }
return [ switch (this._state) {
new TouchBar.TouchBarSlider({ case State.Normal:
label: "Zoom", return [
value: map.getZoom(), new TouchBar.TouchBarSlider({
minValue: map.getMinZoom(), label: "Zoom",
maxValue: map.getMaxZoom(), value: map.getZoom(),
change(newValue) { minValue: map.getMinZoom(),
that.ignoreNextZoomEvent = true; maxValue: map.getMaxZoom(),
map.setZoom(newValue); change(newValue) {
}, that.ignoreNextZoomEvent = true;
}), map.setZoom(newValue);
new TouchBar.TouchBarButton({ },
label: "New geo note", }),
click: () => this.triggerCommand("geoMapCreateChildNote", { ntxId: this.ntxId }) new TouchBar.TouchBarButton({
}) label: "New geo note",
]; click: () => this.triggerCommand("geoMapCreateChildNote", { ntxId: this.ntxId })
})
];
case State.NewNote:
return [
new TouchBar.TouchBarSpacer({ size: "flexible" }),
new TouchBar.TouchBarLabel({ label: "New note" })
]
}
} }
} }