forked from MapComplete/MapComplete
Fix image carousel bug
This commit is contained in:
parent
c226e15d99
commit
a19f3e61f9
7 changed files with 43 additions and 58 deletions
|
@ -8,7 +8,7 @@ import DeleteImage from "./DeleteImage";
|
|||
|
||||
export class ImageCarousel extends UIElement{
|
||||
|
||||
public readonly slideshow: SlideShow;
|
||||
public readonly slideshow: UIElement;
|
||||
|
||||
constructor(tags: UIEventSource<any>, imagePrefix: string = "image", loadSpecial: boolean =true) {
|
||||
super(tags);
|
||||
|
@ -29,7 +29,7 @@ export class ImageCarousel extends UIElement{
|
|||
});
|
||||
|
||||
this.slideshow = new SlideShow(uiElements).HideOnEmpty(true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
InnerRender(): string {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {UIEventSource} from "../../Logic/UIEventSource";
|
||||
import {UIElement} from "../UIElement";
|
||||
import {FixedUiElement} from "../Base/FixedUiElement";
|
||||
import Combine from "../Base/Combine";
|
||||
|
||||
export class SlideShow extends UIElement {
|
||||
|
||||
|
@ -22,6 +23,7 @@ export class SlideShow extends UIElement {
|
|||
this._currentSlide.setData(this._embeddedElements.data.length - 1);
|
||||
});
|
||||
|
||||
this.dumbMode = false;
|
||||
const self = this;
|
||||
this._prev = new FixedUiElement("<div class='prev-button'>" +
|
||||
"<div class='vspan'></div>" +
|
||||
|
@ -43,6 +45,7 @@ export class SlideShow extends UIElement {
|
|||
}
|
||||
|
||||
InnerRender(): string {
|
||||
console.log("Inner rendering")
|
||||
if (this._embeddedElements.data.length == 0) {
|
||||
return "";
|
||||
}
|
||||
|
@ -63,11 +66,11 @@ export class SlideShow extends UIElement {
|
|||
}
|
||||
slides += " <div class=\"slide " + state + "\">" + embeddedElement.Render() + "</div>\n";
|
||||
}
|
||||
return "<div class='image-slideshow'>"
|
||||
+ this._prev.Render()
|
||||
+ "<div class='slides'>" + slides + "</div>"
|
||||
+ this._next.Render()
|
||||
+ "</div>";
|
||||
return new Combine(["<div class='image-slideshow'>"
|
||||
, this._prev
|
||||
, "<div class='slides'>", slides, "</div>"
|
||||
, this._next
|
||||
, "</div>"]).Render();
|
||||
}
|
||||
|
||||
public MoveTo(index: number) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue