More cleanup of code: remove the overly complicated layer selection

This commit is contained in:
Pieter Vander Vennet 2020-09-13 03:29:44 +02:00
parent 257194c063
commit 9777a2666b
13 changed files with 199 additions and 304 deletions

View file

@ -8,6 +8,8 @@ import {
TagDependantUIElementConstructor
} from "../../Customizations/UIElementConstructor";
import Translation from "../i18n/Translation";
import Combine from "../Base/Combine";
import DeleteImage from "./DeleteImage";
export class ImageCarouselConstructor implements TagDependantUIElementConstructor {
IsKnown(properties: any): boolean {
@ -34,16 +36,21 @@ export class ImageCarouselConstructor implements TagDependantUIElementConstructo
export class ImageCarousel extends TagDependantUIElement {
public readonly searcher: ImageSearcher;
public readonly slideshow: SlideShow;
constructor(tags: UIEventSource<any>) {
super(tags);
this.searcher = new ImageSearcher(tags);
const uiElements = this.searcher.map((imageURLS: string[]) => {
const searcher : UIEventSource<{url:string}[]> = new ImageSearcher(tags);
const uiElements = searcher.map((imageURLS: {key: string, url:string}[]) => {
const uiElements: UIElement[] = [];
for (const url of imageURLS) {
const image = ImageSearcher.CreateImageElement(url);
let image = ImageSearcher.CreateImageElement(url.url);
if(url.key !== undefined){
image = new Combine([
image,
new DeleteImage(url.key, tags)
]);
}
uiElements.push(image);
}
return uiElements;