forked from MapComplete/MapComplete
Some work on stabilizing the popups, WIP
This commit is contained in:
parent
8f8ef690a4
commit
1f4b06ae55
5 changed files with 55 additions and 44 deletions
|
@ -12,7 +12,7 @@ import ScrollableFullScreen from "../Base/ScrollableFullScreen";
|
|||
export default class FeatureInfoBox extends UIElement {
|
||||
private _component: ScrollableFullScreen;
|
||||
|
||||
constructor(
|
||||
private constructor(
|
||||
tags: UIEventSource<any>,
|
||||
layerConfig: LayerConfig,
|
||||
onClose: () => void
|
||||
|
@ -75,6 +75,21 @@ export default class FeatureInfoBox extends UIElement {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static featureInfoboxCache : Map<LayerConfig, Map<UIEventSource<any>, FeatureInfoBox>> = new Map<LayerConfig, Map<UIEventSource<any>, FeatureInfoBox>>();
|
||||
static construct(tags: UIEventSource<any>, layer: LayerConfig, onClose: () => void) {
|
||||
let innerMap = FeatureInfoBox.featureInfoboxCache.get(layer);
|
||||
if(innerMap === undefined){
|
||||
innerMap = new Map<UIEventSource<any>, FeatureInfoBox>();
|
||||
FeatureInfoBox.featureInfoboxCache.set(layer, innerMap);
|
||||
}
|
||||
|
||||
let featureInfoBox = innerMap.get(tags);
|
||||
if(featureInfoBox === undefined){
|
||||
featureInfoBox = new FeatureInfoBox(tags, layer, onClose);
|
||||
innerMap.set(tags, featureInfoBox);
|
||||
}
|
||||
return featureInfoBox;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ export default class TagRenderingQuestion extends UIElement {
|
|||
this._tags = tags;
|
||||
this._configuration = configuration;
|
||||
this._cancelButton = cancelButton;
|
||||
this._question = new SubstitutedTranslation(this._configuration.question, tags)
|
||||
this._question = SubstitutedTranslation.construct(this._configuration.question, tags)
|
||||
.SetClass("question-text");
|
||||
if (configuration === undefined) {
|
||||
throw "A question is needed for a question visualization"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue