Refactor bview to Stimulus (mostly)

This commit is contained in:
2026-09-20 12:57:05 +02:00
parent cc590afa54
commit 5942cf37b4
6 changed files with 93 additions and 27 deletions
+9 -2
View File
@@ -2,7 +2,13 @@ import { Controller } from "@hotwired/stimulus"
import { GisState } from '../state.js';
export default class extends Controller {
static targets = ['bar'];
static targets = ['bar', 'legend'];
openView() {
this.barTarget.classList.remove('is-hidden');
this.legendTarget.classList.remove('is-hidden');
GisState.map._container.classList.add('bview-active');
}
closeView(event) {
// Don't do anything if ESC keyboard event
@@ -10,7 +16,8 @@ export default class extends Controller {
if (event instanceof KeyboardEvent && !GisState.bViewActive) return;
this.resetMap();
this.barTarget.remove();
this.barTarget.classList.add('is-hidden');
this.legendTarget.classList.add('is-hidden');
GisState.bViewActive = false;
}