From 05c3710e8d953e115476c32515cfd56befe5e6f2 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 15 Jul 2020 10:47:01 +0200 Subject: [PATCH] Small fixes (in loading the settings) --- Customizations/Layers/BikePumps.ts | 54 +++++++++--------------------- Logic/OsmConnection.ts | 3 +- UI/Base/DropDownUI.ts | 3 ++ 3 files changed, 21 insertions(+), 39 deletions(-) diff --git a/Customizations/Layers/BikePumps.ts b/Customizations/Layers/BikePumps.ts index d214f1337..d53f6d87a 100644 --- a/Customizations/Layers/BikePumps.ts +++ b/Customizations/Layers/BikePumps.ts @@ -13,24 +13,34 @@ export class BikePumps extends LayerDefinition { this.name = "pomp"; this.icon = "./assets/bike_pump.svg"; - this.overpassFilter = new Or([ + this.overpassFilter = new And([ new Tag("amenity", "bicycle_repair_station"), new Tag("service:bicycle:pump", "yes"), - ]) - ] - ); + ]); this.newElementTags = [ new Tag("amenity", "bicycle_repair_station"), new Tag("service:bicycle:pump", "yes"), - // new Tag("fixme", "Toegevoegd met MapComplete, geometry nog uit te tekenen") ]; + this.maxAllowedOverlapPercentage = 10; this.minzoom = 13; - this.style = this.generateStyleFunction(); + const self = this; + this.style = (properties: any) => { + + return { + color: "#00bb00", + icon: new L.icon({ + iconUrl: self.icon, + iconSize: [40, 40] + }) + }; + }; + + this.title = new FixedText("Pomp"); this.elementsToShow = [ new ImageCarouselWithUploadConstructor(), @@ -43,37 +53,5 @@ export class BikePumps extends LayerDefinition { } - private generateStyleFunction() { - const self = this; - return function (properties: any) { - // let questionSeverity = 0; - // for (const qd of self.elementsToShow) { - // if (qd.IsQuestioning(properties)) { - // questionSeverity = Math.max(questionSeverity, qd.options.priority ?? 0); - // } - // } - - // let colormapping = { - // 0: "#00bb00", - // 1: "#00ff00", - // 10: "#dddd00", - // 20: "#ff0000" - // }; - - // let colour = colormapping[questionSeverity]; - // while (colour == undefined) { - // questionSeverity--; - // colour = colormapping[questionSeverity]; - // } - - return { - color: "#00bb00", - icon: new L.icon({ - iconUrl: self.icon, - iconSize: [40, 40] - }) - }; - }; - } } \ No newline at end of file diff --git a/Logic/OsmConnection.ts b/Logic/OsmConnection.ts index e35d2543d..686fb1650 100644 --- a/Logic/OsmConnection.ts +++ b/Logic/OsmConnection.ts @@ -126,7 +126,7 @@ export class OsmConnection { if(this.preferenceSources[key] !== undefined){ return this.preferenceSources[key]; } - const pref = new UIEventSource(undefined); + const pref = new UIEventSource(this.preferences[key]); pref.addCallback((v) => { this.SetPreference(key, v); }); @@ -169,6 +169,7 @@ export class OsmConnection { } if (this.preferences.data[k] === v) { + console.log("Not updating preference", k, " to ", v, "not changed"); return; } console.log("Updating preference", k, " to ", v); diff --git a/UI/Base/DropDownUI.ts b/UI/Base/DropDownUI.ts index 521068a23..208ea857e 100644 --- a/UI/Base/DropDownUI.ts +++ b/UI/Base/DropDownUI.ts @@ -41,6 +41,9 @@ export class DropDownUI extends UIElement { InnerUpdate() { const self = this; const e = document.getElementById("dropdown-" + this.id); + if(e === null){ + return; + } // @ts-ignore if (this.selectedElement.data !== e.value) { // @ts-ignore