Make metatagging lazy (fix #503), fix null-distances (#504), various other small fixes

This commit is contained in:
Pieter Vander Vennet 2021-10-10 23:38:09 +02:00
parent 15ff38a098
commit d894b13023
12 changed files with 271 additions and 191 deletions

View file

@ -27,6 +27,7 @@ import ShowDataMultiLayer from "./ShowDataLayer/ShowDataMultiLayer";
import Minimap from "./Base/Minimap";
import AllImageProviders from "../Logic/ImageProviders/AllImageProviders";
import WikipediaBox from "./WikipediaBox";
import SimpleMetaTagger from "../Logic/SimpleMetaTagger";
export interface SpecialVisualization {
funcName: string,
@ -45,14 +46,26 @@ export default class SpecialVisualizations {
docs: "Prints all key-value pairs of the object - used for debugging",
args: [],
constr: ((state: State, tags: UIEventSource<any>) => {
const calculatedTags = [].concat(
SimpleMetaTagger.lazyTags,
... state.layoutToUse.layers.map(l => l.calculatedTags?.map(c => c[0]) ?? []))
return new VariableUiElement(tags.map(tags => {
const parts = [];
for (const key in tags) {
if (!tags.hasOwnProperty(key)) {
continue;
continue
}
parts.push([key, tags[key] ?? "<b>undefined</b>"]);
}
for(const key of calculatedTags){
const value = tags[key]
if(value === undefined){
continue
}
parts.push([ "<i>"+key+"</i>", value ])
}
return new Table(
["key", "value"],
parts