From ff78ab650af813350e8f0d1e8d078acce5e95d7f Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 8 Mar 2025 23:25:06 +0200 Subject: [PATCH] feat(touch_bar): use disabled button for geomap --- .../app/widgets/type_widgets/geo_map.ts | 42 ++++++++----------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/src/public/app/widgets/type_widgets/geo_map.ts b/src/public/app/widgets/type_widgets/geo_map.ts index 5ada5c7f5..6b478f130 100644 --- a/src/public/app/widgets/type_widgets/geo_map.ts +++ b/src/public/app/widgets/type_widgets/geo_map.ts @@ -397,31 +397,23 @@ export default class GeoMapTypeWidget extends TypeWidget { return; } - switch (this._state) { - case State.Normal: - return [ - new TouchBar.TouchBarSlider({ - label: "Zoom", - value: map.getZoom(), - minValue: map.getMinZoom(), - maxValue: map.getMaxZoom(), - change(newValue) { - that.ignoreNextZoomEvent = true; - map.setZoom(newValue); - }, - }), - 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" }) - ] - } + return [ + new TouchBar.TouchBarSlider({ + label: "Zoom", + value: map.getZoom(), + minValue: map.getMinZoom(), + maxValue: map.getMaxZoom(), + change(newValue) { + that.ignoreNextZoomEvent = true; + map.setZoom(newValue); + }, + }), + new TouchBar.TouchBarButton({ + label: "New geo note", + click: () => this.triggerCommand("geoMapCreateChildNote", { ntxId: this.ntxId }), + enabled: (this._state === State.Normal) + }) + ]; } }