From 66af5cc5ca5cfd126c8a02c442b00b604f081522 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 22 Jul 2020 17:54:59 +0200 Subject: [PATCH] Some cleanups --- UI/Img.ts | 10 ++++++++++ index.ts | 60 +++++++++++++++++++++++-------------------------------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/UI/Img.ts b/UI/Img.ts index c4636f7..72ca2ba 100644 --- a/UI/Img.ts +++ b/UI/Img.ts @@ -10,5 +10,15 @@ export class Img { ""; + static closedFilterButton: string = ` + + + + ` + + static openFilterButton: string = ` + + ` + } diff --git a/index.ts b/index.ts index 9b971ae..b971e53 100644 --- a/index.ts +++ b/index.ts @@ -28,6 +28,7 @@ import {DropDown} from "./UI/Input/DropDown"; import {FixedUiElement} from "./UI/Base/FixedUiElement"; import {LayerSelection} from "./UI/LayerSelection"; import Combine from "./UI/Base/Combine"; +import {Img} from "./UI/Img"; // --------------------- Read the URL parameters ----------------- @@ -210,6 +211,30 @@ for (const layer of layoutToUse.layers) { const layerUpdater = new LayerUpdater(bm, minZoom, flayers); +// --------------- Setting up filter ui -------- + +// buttons + +const closedFilterButton = ``; + +const openFilterButton = ` +`; + +// basemap dropdown + +let baseLayerOptions = []; + +for (const key in BaseLayers.baseLayers) { + baseLayerOptions.push({value: {name: key, layer: BaseLayers.baseLayers[key]}, shown: key}); +} + +if (flayers.length > 1) { + new CheckBox(new Combine([`

Maplayers

`, new LayerSelection(flayers), new DropDown(`Background map`, baseLayerOptions, bm.CurrentLayer), openFilterButton]), closedFilterButton).AttachTo("filter__selection"); +} else { + new CheckBox(new Combine([new DropDown(`Background map`, baseLayerOptions, bm.CurrentLayer), openFilterButton]), closedFilterButton).AttachTo("filter__selection"); +} + + // ------------------ Setup various UI elements ------------ let languagePicker = new DropDown(" ", layoutToUse.supportedLanguages.map(lang => { @@ -306,40 +331,5 @@ new GeoLocationHandler(bm).AttachTo("geolocate-button"); locationControl.ping(); -// --------------- Setting up filter ui -------- - -// buttons - -const closedFilterButton = ` - -`; - -const openFilterButton = ` -`; - -// basemap dropdown - -let baseLayerOptions = []; - -Object.entries(BaseLayers.baseLayers).forEach(([key, value], i) => { - baseLayerOptions.push({value: {name: key, layer: value}, shown: key}); -}); - -// popup -if (flayers.length > 1) { - new CheckBox(new Combine([`

Maplayers

`, new LayerSelection(flayers), new DropDown(`Background map`, baseLayerOptions, bm.CurrentLayer), openFilterButton]), closedFilterButton).AttachTo("filter__selection"); -} else { - new CheckBox(new Combine([new DropDown(`Background map`, baseLayerOptions, bm.CurrentLayer), openFilterButton]), closedFilterButton).AttachTo("filter__selection"); -}