Fix personal theme

This commit is contained in:
Pieter Vander Vennet 2022-02-24 03:48:28 +01:00
parent 80c24bddca
commit 696375fec9
4 changed files with 5 additions and 24 deletions

View file

@ -23,7 +23,7 @@ export abstract class Conversion<TIn, TOut> {
throw fixed.errors.join("\n\n"); throw fixed.errors.join("\n\n");
} }
fixed.information?.forEach(i => console.log(" ", i)) fixed.information?.forEach(i => console.log(" ", i))
const yellow = (s) => "\x1b[33m"+s+"\x1b[0m" const yellow = (s) => "\x1b[33m"+s+"\x1b[0m"
const red = s => '\x1b[31m'+s+'\x1b[0m' const red = s => '\x1b[31m'+s+'\x1b[0m'
fixed.warnings?.forEach(w => console.warn(red(`<!> `), yellow (w))) fixed.warnings?.forEach(w => console.warn(red(`<!> `), yellow (w)))

View file

@ -141,24 +141,6 @@ class AddDefaultLayers extends DesugaringStep<LayoutConfigJson> {
json.layers = [...json.layers] json.layers = [...json.layers]
const alreadyLoaded = new Set(json.layers.map(l => l["id"])) const alreadyLoaded = new Set(json.layers.map(l => l["id"]))
if (json.id === "personal") {
json.layers = []
for (const publicLayer of AllKnownLayouts.AllPublicLayers()) {
const id = publicLayer.id
const config = state.sharedLayers.get(id)
if (Constants.added_by_default.indexOf(id) >= 0) {
continue;
}
if (config === undefined) {
// This is a layer which is coded within a public theme, not as separate .json
continue
}
json.layers.push(config)
}
const publicIds = AllKnownLayouts.AllPublicLayers().map(l => l.id)
publicIds.map(id => state.sharedLayers.get(id))
}
for (const layerName of Constants.added_by_default) { for (const layerName of Constants.added_by_default) {
const v = state.sharedLayers.get(layerName) const v = state.sharedLayers.get(layerName)
if (v === undefined) { if (v === undefined) {
@ -306,7 +288,7 @@ class ApplyOverrideAll extends DesugaringStep<LayoutConfigJson> {
delete json.overrideAll delete json.overrideAll
const newLayers = [] const newLayers = []
for (let layer of json.layers) { for (let layer of json.layers) {
layer = {...<LayerConfigJson>layer} layer = Utils.Clone(<LayerConfigJson>layer)
Utils.Merge(overrideAll, layer) Utils.Merge(overrideAll, layer)
newLayers.push(layer) newLayers.push(layer)
} }
@ -419,7 +401,6 @@ class PreparePersonalTheme extends DesugaringStep<LayoutConfigJson> {
} }
json.layers = Array.from(this._state.sharedLayers.keys()).filter(l => Constants.priviliged_layers.indexOf(l) < 0) json.layers = Array.from(this._state.sharedLayers.keys()).filter(l => Constants.priviliged_layers.indexOf(l) < 0)
return {result: json}; return {result: json};
} }

View file

@ -37,10 +37,10 @@
"startLon": 0, "startLon": 0,
"startZoom": 0, "startZoom": 0,
"widenFactor": 1.2, "widenFactor": 1.2,
"#note": "The 'overpassMaxZoom' should be exactly the same as or less then the overrideAll", "#note": "The 'overpassMaxZoom' should be exactly the same as or less then the minzzom in overrideAll",
"overpassMaxZoom": 15, "overpassMaxZoom": 15,
"overrideAll": { "overrideAll": {
"minZoom": 16, "minzoom": 17,
"syncSelection": "theme", "syncSelection": "theme",
"shownByDefault": false "shownByDefault": false
}, },

View file

@ -752,7 +752,7 @@
}, },
"6": { "6": {
"override": { "override": {
"=name": "Healtch and social places without etymology information" "=name": "Health and social places without etymology information"
} }
}, },
"7": { "7": {