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> {
const pref = this.osmConnection
.GetPreference(key)
return this.osmConnection
.GetPreference(key, layer.shownByDefault + "")
.sync(v => {
if (v === undefined) {
return undefined
@ -367,8 +367,6 @@ export default class MapState extends UserRelatedState {
}
return "" + b;
})
pref.setData(layer.shownByDefault)
return pref
}
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.addCallbackAndRun(_ => {
console.log("IsDisplayed?",layer.id, isDisplayed.data, layer.shownByDefault)
})
const flayer: FilteredLayer = {
isDisplayed: isDisplayed,
isDisplayed,
layerDef: layer,
appliedFilters: new UIEventSource<Map<string, FilterState>>(new Map<string, FilterState>())
};

View file

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