Fix image carousel bug

This commit is contained in:
Pieter Vander Vennet 2020-11-02 18:59:21 +01:00
parent c226e15d99
commit a19f3e61f9
7 changed files with 43 additions and 58 deletions

View file

@ -16,11 +16,13 @@ export class FeatureInfoBox extends UIElement {
private _questionBox : UIElement;
constructor(
feature: any,
tags: UIEventSource<any>,
layerConfig: LayerConfig
) {
super();
if(layerConfig === undefined){
throw "Undefined layerconfig"
}
this._tags = tags;
this._layerConfig = layerConfig;

View file

@ -9,25 +9,37 @@ import {SubstitutedTranslation} from "../SpecialVisualizations";
export default class TagRenderingAnswer extends UIElement {
private _tags: UIEventSource<any>;
private _configuration: TagRenderingConfig;
private _content: UIElement;
constructor(tags: UIEventSource<any>,
configuration: TagRenderingConfig) {
constructor(tags: UIEventSource<any>, configuration: TagRenderingConfig) {
super(tags);
this._tags = tags;
this._configuration = configuration;
const self = this;
tags.addCallbackAndRun(tags => {
if (tags === undefined) {
self._content = undefined
return;
}
const tr = this._configuration.GetRenderValue(tags);
if (tr === undefined) {
self._content = undefined
return
}
self._content = new SubstitutedTranslation(tr, self._tags)
})
}
InnerRender(): string {
if(this._configuration.condition !== undefined){
if(!this._configuration.condition.matchesProperties(this._tags.data)){
if (this._configuration.condition !== undefined) {
if (!this._configuration.condition.matchesProperties(this._tags.data)) {
return "";
}
}
const tr = this._configuration.GetRenderValue(this._tags.data);
if(tr === undefined){
if(this._content === undefined){
return "";
}
return new SubstitutedTranslation(tr, this._tags).Render();
return this._content.Render();
}
}