Refactor bview to Stimulus (mostly)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user