New graphs; disable optimazation

This commit is contained in:
Pieter Vander Vennet 2021-03-12 13:48:49 +01:00
parent 8c5d4ed78f
commit 2bb50561fe
17 changed files with 62 additions and 21 deletions

View file

@ -14,12 +14,13 @@ export default class ScrollableFullScreen extends UIElement {
private _component: UIElement;
private _fullscreencomponent: UIElement;
constructor(title: (() => UIElement), content: (() => UIElement), isShown: UIEventSource<boolean> = new UIEventSource<boolean>(false)) {
constructor(title: ((mode: string) => UIElement), content: ((mode: string) => UIElement),
isShown: UIEventSource<boolean> = new UIEventSource<boolean>(false)) {
super();
this.isShown = isShown;
this._component = this.BuildComponent(title(), content(), isShown);
this._fullscreencomponent = this.BuildComponent(title(), content(), isShown);
this._component = this.BuildComponent(title("desktop"), content("desktop"), isShown);
this._fullscreencomponent = this.BuildComponent(title("mobile"), content("mobile"), isShown);
this.dumbMode = false;
const self = this;
isShown.addCallback(isShown => {

View file

@ -17,7 +17,9 @@ export default class FeatureInfoBox extends ScrollableFullScreen {
tags: UIEventSource<any>,
layerConfig: LayerConfig
) {
super(() => FeatureInfoBox.GenerateTitleBar(tags, layerConfig),() => FeatureInfoBox.GenerateContent(tags, layerConfig));
super((mode:string) => FeatureInfoBox.GenerateTitleBar(tags, layerConfig, mode),
(mode:string) => FeatureInfoBox.GenerateContent(tags, layerConfig, mode));
if (layerConfig === undefined) {
throw "Undefined layerconfig";
}
@ -46,7 +48,8 @@ export default class FeatureInfoBox extends ScrollableFullScreen {
}
private static GenerateContent(tags: UIEventSource<any>,
layerConfig: LayerConfig): UIElement {
layerConfig: LayerConfig,
mode: string): UIElement {
let questionBox: UIElement = undefined;

View file

@ -38,7 +38,8 @@ export default class TagRenderingQuestion extends UIElement {
constructor(tags: UIEventSource<any>,
configuration: TagRenderingConfig,
afterSave?: () => void,
cancelButton?: UIElement) {
cancelButton?: UIElement
) {
super(tags);
this._tags = tags;
this._configuration = configuration;

View file

@ -6,9 +6,11 @@ import Combine from "./Base/Combine";
import State from "../State";
import {FixedUiElement} from "./Base/FixedUiElement";
import SpecialVisualizations from "./SpecialVisualizations";
import {Utils} from "../Utils";
export class SubstitutedTranslation extends UIElement {
private static cachedTranslations: Map<Translation, Map<UIEventSource<any>, SubstitutedTranslation>> = new Map<Translation, Map<UIEventSource<any>, SubstitutedTranslation>>();
private static cachedTranslations:
Map<string, Map<Translation, Map<UIEventSource<any>, SubstitutedTranslation>>> = new Map<string, Map<Translation, Map<UIEventSource<any>, SubstitutedTranslation>>>();
private readonly tags: UIEventSource<any>;
private readonly translation: Translation;
private content: UIElement[];
@ -32,20 +34,26 @@ export class SubstitutedTranslation extends UIElement {
this.SetClass("w-full")
}
private static GenerateMap(){
return new Map<UIEventSource<any>, SubstitutedTranslation>()
}
private static GenerateSubCache(){
return new Map<Translation, Map<UIEventSource<any>, SubstitutedTranslation>>();
}
public static construct(
translation: Translation,
tags: UIEventSource<any>): SubstitutedTranslation {
if (!this.cachedTranslations.has(translation)) {
this.cachedTranslations.set(translation, new Map<UIEventSource<any>, SubstitutedTranslation>());
}
const innerMap = this.cachedTranslations.get(translation);
/* let cachedTranslations = Utils.getOrSetDefault(SubstitutedTranslation.cachedTranslations, SubstitutedTranslation.GenerateSubCache);
const innerMap = Utils.getOrSetDefault(cachedTranslations, translation, SubstitutedTranslation.GenerateMap);
const cachedTranslation = innerMap.get(tags);
if (cachedTranslation !== undefined) {
return cachedTranslation;
}
}*/
const st = new SubstitutedTranslation(translation, tags);
innerMap.set(tags, st);
// innerMap.set(tags, st);
return st;
}