Small fixes (in loading the settings)

This commit is contained in:
Pieter Vander Vennet 2020-07-15 10:47:01 +02:00
parent 54a01dfbef
commit 05c3710e8d
3 changed files with 21 additions and 39 deletions

View file

@ -13,24 +13,34 @@ export class BikePumps extends LayerDefinition {
this.name = "pomp"; this.name = "pomp";
this.icon = "./assets/bike_pump.svg"; this.icon = "./assets/bike_pump.svg";
this.overpassFilter = new Or([ this.overpassFilter =
new And([ new And([
new Tag("amenity", "bicycle_repair_station"), new Tag("amenity", "bicycle_repair_station"),
new Tag("service:bicycle:pump", "yes"), new Tag("service:bicycle:pump", "yes"),
]) ]);
]
);
this.newElementTags = [ this.newElementTags = [
new Tag("amenity", "bicycle_repair_station"), new Tag("amenity", "bicycle_repair_station"),
new Tag("service:bicycle:pump", "yes"), new Tag("service:bicycle:pump", "yes"),
// new Tag("fixme", "Toegevoegd met MapComplete, geometry nog uit te tekenen")
]; ];
this.maxAllowedOverlapPercentage = 10; this.maxAllowedOverlapPercentage = 10;
this.minzoom = 13; 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.title = new FixedText("Pomp");
this.elementsToShow = [ this.elementsToShow = [
new ImageCarouselWithUploadConstructor(), 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]
})
};
};
}
} }

View file

@ -126,7 +126,7 @@ export class OsmConnection {
if(this.preferenceSources[key] !== undefined){ if(this.preferenceSources[key] !== undefined){
return this.preferenceSources[key]; return this.preferenceSources[key];
} }
const pref = new UIEventSource<string>(undefined); const pref = new UIEventSource<string>(this.preferences[key]);
pref.addCallback((v) => { pref.addCallback((v) => {
this.SetPreference(key, v); this.SetPreference(key, v);
}); });
@ -169,6 +169,7 @@ export class OsmConnection {
} }
if (this.preferences.data[k] === v) { if (this.preferences.data[k] === v) {
console.log("Not updating preference", k, " to ", v, "not changed");
return; return;
} }
console.log("Updating preference", k, " to ", v); console.log("Updating preference", k, " to ", v);

View file

@ -41,6 +41,9 @@ export class DropDownUI extends UIElement {
InnerUpdate() { InnerUpdate() {
const self = this; const self = this;
const e = document.getElementById("dropdown-" + this.id); const e = document.getElementById("dropdown-" + this.id);
if(e === null){
return;
}
// @ts-ignore // @ts-ignore
if (this.selectedElement.data !== e.value) { if (this.selectedElement.data !== e.value) {
// @ts-ignore // @ts-ignore