Small improvements

This commit is contained in:
pietervdvn 2021-09-07 00:23:00 +02:00
parent e889d1eff1
commit 780d353c8d
6 changed files with 8 additions and 9 deletions

View file

@ -148,7 +148,6 @@ export default class OverpassFeatureSource implements FeatureSource {
const bounds = this._leafletMap.data?.getBounds(); const bounds = this._leafletMap.data?.getBounds();
if(bounds === undefined){ if(bounds === undefined){
console.log("Leaflet map not yet initialized; retrying later")
return; return;
} }
@ -189,7 +188,6 @@ export default class OverpassFeatureSource implements FeatureSource {
function countDown() { function countDown() {
window?.setTimeout( window?.setTimeout(
function () { function () {
console.log("Countdown: ", self.timeout.data)
if (self.timeout.data > 1) { if (self.timeout.data > 1) {
self.timeout.setData(self.timeout.data - 1); self.timeout.setData(self.timeout.data - 1);
window.setTimeout( window.setTimeout(

View file

@ -2,7 +2,7 @@ import { Utils } from "../Utils";
export default class Constants { export default class Constants {
public static vNumber = "0.9.4"; public static vNumber = "0.9.5";
// The user journey states thresholds when a new feature gets unlocked // The user journey states thresholds when a new feature gets unlocked
public static userJourney = { public static userJourney = {

View file

@ -18,6 +18,7 @@ export default class FilterConfig {
if(json.options.map === undefined){ if(json.options.map === undefined){
throw `A filter was given where the options aren't a list at ${context}` throw `A filter was given where the options aren't a list at ${context}`
} }
this.options = json.options.map((option, i) => { this.options = json.options.map((option, i) => {
const question = Translations.T( const question = Translations.T(
option.question, option.question,
@ -27,6 +28,9 @@ export default class FilterConfig {
option.osmTags ?? {and: []}, option.osmTags ?? {and: []},
`${context}.options-[${i}].osmTags` `${context}.options-[${i}].osmTags`
); );
if(question === undefined){
throw `Invalid filter: no question given at ${context}[${i}]`
}
return {question: question, osmTags: osmTags}; return {question: question, osmTags: osmTags};
}); });

View file

@ -7,6 +7,7 @@ import {Utils} from "../../Utils";
import LayerConfig from "./LayerConfig"; import LayerConfig from "./LayerConfig";
import {Unit} from "../Unit"; import {Unit} from "../Unit";
import {Denomination} from "../Denomination"; import {Denomination} from "../Denomination";
import {LayerConfigJson} from "./Json/LayerConfigJson";
export default class LayoutConfig { export default class LayoutConfig {
public readonly id: string; public readonly id: string;
@ -208,8 +209,7 @@ export default class LayoutConfig {
if (shared === undefined) { if (shared === undefined) {
throw `Unknown shared/builtin layer ${name} at ${context}.layers[${i}]. Available layers are ${Array.from(AllKnownLayers.sharedLayersJson.keys()).join(", ")}`; throw `Unknown shared/builtin layer ${name} at ${context}.layers[${i}]. Available layers are ${Array.from(AllKnownLayers.sharedLayersJson.keys()).join(", ")}`;
} }
// @ts-ignore let newLayer: LayerConfigJson = Utils.Merge(layer["override"], JSON.parse(JSON.stringify(shared))); // We make a deep copy of the shared layer, in order to protect it from changes
let newLayer: LayerConfigJson = Utils.Merge(layer.override, JSON.parse(JSON.stringify(shared))); // We make a deep copy of the shared layer, in order to protect it from changes
if (json.overrideAll !== undefined) { if (json.overrideAll !== undefined) {
newLayer = Utils.Merge(json.overrideAll, newLayer); newLayer = Utils.Merge(json.overrideAll, newLayer);
} }

View file

@ -180,7 +180,6 @@ export default class OpeningHoursPickerTable extends InputElement<OpeningHour[]>
oh.endMinutes = 0; oh.endMinutes = 0;
} }
self.source.data.push(oh); self.source.data.push(oh);
console.log("Created ", oh)
} }
self.source.ping(); self.source.ping();

View file

@ -221,9 +221,7 @@ export class Utils {
const sourceV = source[key]; const sourceV = source[key];
const targetV = target[key] const targetV = target[key]
if (sourceV?.length !== undefined && targetV?.length !== undefined && key.startsWith("+")) { if (typeof sourceV === "object") {
target[key] = targetV.concat(sourceV)
} else if (typeof sourceV === "object") {
if (sourceV === null) { if (sourceV === null) {
target[key] = null target[key] = null
} else if (targetV === undefined) { } else if (targetV === undefined) {