start of layer dropdown

This commit is contained in:
Bavo Vanderghote 2020-07-22 15:44:47 +02:00
parent db9ac0eaf0
commit 3dec5bcd06
2 changed files with 25 additions and 31 deletions

View file

@ -3,7 +3,7 @@ import {Changes} from "./Logic/Changes";
import {ElementStorage} from "./Logic/ElementStorage"; import {ElementStorage} from "./Logic/ElementStorage";
import {UIEventSource} from "./UI/UIEventSource"; import {UIEventSource} from "./UI/UIEventSource";
import {UserBadge} from "./UI/UserBadge"; import {UserBadge} from "./UI/UserBadge";
import {Basemap} from "./Logic/Basemap"; import {Basemap, BaseLayers} from "./Logic/Basemap";
import {PendingChanges} from "./UI/PendingChanges"; import {PendingChanges} from "./UI/PendingChanges";
import {CenterMessageBox} from "./UI/CenterMessageBox"; import {CenterMessageBox} from "./UI/CenterMessageBox";
import {Helpers} from "./Helpers"; import {Helpers} from "./Helpers";
@ -334,4 +334,16 @@ const openFilterButton = `
new CheckBox(new Combine([new LayerSelection(flayers), openFilterButton]), closedFilterButton).AttachTo("filter__selection") new CheckBox(new Combine([new LayerSelection(flayers), openFilterButton]), closedFilterButton).AttachTo("filter__selection")
// --------------- Setting up basemap dropdown --------
let baseLayerOptions = [];
Object.entries(BaseLayers.baseLayers).forEach(([key, value], i) => {
console.log(key, value, i);
baseLayerOptions.push({value: {name: key, layer: value}, shown: key});
});
console.log(bm.CurrentLayer.data);
new DropDown(`label`, baseLayerOptions, bm.CurrentLayer).AttachTo("filter__selection");

38
test.ts
View file

@ -1,32 +1,14 @@
import { DropDown } from "./UI/Input/DropDown"; import { DropDown } from "./UI/Input/DropDown";
import Locale from "./UI/i18n/Locale"; import { BaseLayers, Basemap } from "./Logic/Basemap";
import Combine from "./UI/Base/Combine";
import Translations from "./UI/i18n/Translations";
import {TagRenderingOptions} from "./Customizations/TagRendering";
import {UIEventSource} from "./UI/UIEventSource";
import {Tag} from "./Logic/TagsFilter";
import {Changes} from "./Logic/Changes";
import {OsmConnection} from "./Logic/OsmConnection";
import Translation from "./UI/i18n/Translation";
console.log("Hello world") let baseLayerOptions = [];
Locale.language.setData("en");
let languagePicker = new DropDown("", ["en", "nl"].map(lang => { Object.entries(BaseLayers.baseLayers).forEach(([key, value], i) => {
return {value: lang, shown: lang} // console.log(key, value, i);
} baseLayerOptions.push({value: i, shown: key});
), Locale.language).AttachTo("maindiv"); });
console.log(Basemap);
let tags = new UIEventSource({ new DropDown(`label`, baseLayerOptions, Basemap.CurrentLayer).AttachTo("maindiv");
x:"y"
})
new TagRenderingOptions({
mappings: [{k: new Tag("x","y"), txt: new Translation({en: "ENG", nl: "NED"})}]
}).construct({
tags: tags,
changes: new Changes(
"cs",
new OsmConnection(true)
)
}).AttachTo("extradiv")