Some tweaks

This commit is contained in:
pietervdvn 2022-07-26 16:51:00 +02:00
parent 88c6c676d6
commit 6d99dd5045
3 changed files with 22 additions and 13 deletions

View file

@ -354,8 +354,8 @@ export default class MapState extends UserRelatedState {
} }
private getPref(key: string, layer: LayerConfig): UIEventSource<boolean> { private getPref(key: string, layer: LayerConfig): UIEventSource<boolean> {
const pref = this.osmConnection return this.osmConnection
.GetPreference(key) .GetPreference(key, layer.shownByDefault + "")
.sync(v => { .sync(v => {
if (v === undefined) { if (v === undefined) {
return undefined return undefined
@ -367,8 +367,6 @@ export default class MapState extends UserRelatedState {
} }
return "" + b; return "" + b;
}) })
pref.setData(layer.shownByDefault)
return pref
} }
private InitializeFilteredLayers() { private InitializeFilteredLayers() {
@ -389,9 +387,12 @@ export default class MapState extends UserRelatedState {
isDisplayed = QueryParameters.GetBooleanQueryParameter("layer-" + layer.id, layer.shownByDefault, "Wether or not layer " + layer.id + " is shown") isDisplayed = QueryParameters.GetBooleanQueryParameter("layer-" + layer.id, layer.shownByDefault, "Wether or not layer " + layer.id + " is shown")
} }
isDisplayed.addCallbackAndRun(_ => {
console.log("IsDisplayed?",layer.id, isDisplayed.data, layer.shownByDefault)
})
const flayer: FilteredLayer = { const flayer: FilteredLayer = {
isDisplayed: isDisplayed, isDisplayed,
layerDef: layer, layerDef: layer,
appliedFilters: new UIEventSource<Map<string, FilterState>>(new Map<string, FilterState>()) appliedFilters: new UIEventSource<Map<string, FilterState>>(new Map<string, FilterState>())
}; };

View file

@ -24,7 +24,6 @@
"builtin": "bike_repair_station", "builtin": "bike_repair_station",
"override": { "override": {
"minzoom": 15, "minzoom": 15,
"name": null,
"shownByDefault": false, "shownByDefault": false,
"mapRendering": [ "mapRendering": [
{ {
@ -45,7 +44,6 @@
{ {
"builtin": "bike_shop", "builtin": "bike_shop",
"override": { "override": {
"name": null,
"shownByDefault": false "shownByDefault": false
} }
}, },
@ -86,7 +84,7 @@
"mapRendering": [ "mapRendering": [
{ {
"icon": "./assets/themes/onwheels/entrance.svg", "icon": "./assets/themes/onwheels/entrance.svg",
"iconSize": "40,40,bottom" "iconSize": "40,40,center"
} }
], ],
"syncSelection": "theme-only", "syncSelection": "theme-only",
@ -193,13 +191,13 @@
{ {
"builtin": "picnic_table", "builtin": "picnic_table",
"override": { "override": {
"name": null,
"shownByDefault": false "shownByDefault": false
} }
}, },
{ {
"builtin": "school", "builtin": "school",
"override": { "override": {
"shownByDefault": false,
"mapRendering": [ "mapRendering": [
{ {
"label": null "label": null
@ -241,6 +239,7 @@
"builtin": "pharmacy", "builtin": "pharmacy",
"override": { "override": {
"minzoom": 15, "minzoom": 15,
"shownByDefault": false,
"mapRendering": [ "mapRendering": [
{ {
"icon": "./assets/themes/onwheels/pharmacy.svg", "icon": "./assets/themes/onwheels/pharmacy.svg",
@ -252,6 +251,7 @@
}, },
{ {
"builtin": "doctors", "builtin": "doctors",
"shownByDefault": false,
"override": { "override": {
"minzoom": 15, "minzoom": 15,
"mapRendering": [ "mapRendering": [
@ -266,6 +266,7 @@
"builtin": "hospital", "builtin": "hospital",
"override": { "override": {
"minzoom": 15, "minzoom": 15,
"shownByDefault": false,
"mapRendering": [ "mapRendering": [
{ {
"icon": "./assets/themes/onwheels/hospital.svg", "icon": "./assets/themes/onwheels/hospital.svg",
@ -308,6 +309,7 @@
"builtin": "hotel", "builtin": "hotel",
"override": { "override": {
"minzoom": 15, "minzoom": 15,
"shownByDefault": false,
"mapRendering": [ "mapRendering": [
{ {
"icon": "./assets/themes/onwheels/hotel.svg", "icon": "./assets/themes/onwheels/hotel.svg",
@ -372,7 +374,8 @@
"and": [ "and": [
"entrance=", "entrance=",
"kerb=", "kerb=",
"current_view!=yes" "current_view!=yes",
"door="
] ]
}, },
"render": { "render": {

11
test.ts
View file

@ -1,4 +1,9 @@
import LevelSelector from "./UI/Input/LevelSelector";
import {UIEventSource} from "./Logic/UIEventSource";
new LevelSelector(new UIEventSource(["0","1","2","2.5","x","3"])).AttachTo("maindiv")
import * as onwheels from "./assets/generated/themes/onwheels.json"
import FeaturePipelineState from "./Logic/State/FeaturePipelineState";
import LayoutConfig from "./Models/ThemeConfig/LayoutConfig";
const layout = new LayoutConfig(<any> onwheels, true)
new FeaturePipelineState(layout)