First part of a huge refactoring

This commit is contained in:
Pieter Vander Vennet 2021-12-21 18:35:31 +01:00
parent 0c22b15c8d
commit 11150a258d
56 changed files with 1425 additions and 1324 deletions

View file

@ -4,9 +4,13 @@ import {Utils} from "../../Utils";
import LZString from "lz-string";
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig";
/**
* Gives an overview of themes that are installed in the user preferences
*/
export default class InstalledThemes {
public installedThemes: UIEventSource<{ layout: LayoutConfig; definition: string }[]>;
constructor(osmConnection: OsmConnection) {
this.installedThemes = osmConnection.preferencesHandler.preferences.map<{ layout: LayoutConfig, definition: string }[]>(allPreferences => {
const installedThemes: { layout: LayoutConfig, definition: string }[] = [];

View file

@ -10,7 +10,7 @@ import RelationsTracker from "../Osm/RelationsTracker";
import {BBox} from "../BBox";
import Loc from "../../Models/Loc";
import LayerConfig from "../../Models/ThemeConfig/LayerConfig";
import AllKnownLayers from "../../Customizations/AllKnownLayers";
import Constants from "../../Models/Constants";
export default class OverpassFeatureSource implements FeatureSource {
@ -122,7 +122,7 @@ export default class OverpassFeatureSource implements FeatureSource {
if (typeof (layer) === "string") {
throw "A layer was not expanded!"
}
if(AllKnownLayers.priviliged_layers.indexOf(layer.id) >= 0){
if(Constants.priviliged_layers.indexOf(layer.id) >= 0){
continue
}
if (this.state.locationControl.data.zoom < layer.minzoom) {

View file

@ -29,7 +29,7 @@ export default class TitleHandler {
}
if (layer.source.osmTags.matchesProperties(tags)) {
const tagsSource = state.allElements.getEventSourceById(tags.id) ?? new UIEventSource<any>(tags)
const title = new TagRenderingAnswer(tagsSource, layer.title)
const title = new TagRenderingAnswer(tagsSource, layer.title, {})
return new Combine([defaultTitle, " | ", title]).ConstructElement()?.innerText ?? defaultTitle;
}
}