From e4bd0a61a3c21179bd84d7f42b60b12a94886385 Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 10 Nov 2022 15:02:41 -0500 Subject: fixed restarting presentation by hitting play at end of presentation --- src/client/views/nodes/trails/PresBox.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/trails/PresBox.tsx b/src/client/views/nodes/trails/PresBox.tsx index ccf19efc9..88cb3ce1d 100644 --- a/src/client/views/nodes/trails/PresBox.tsx +++ b/src/client/views/nodes/trails/PresBox.tsx @@ -634,19 +634,21 @@ export class PresBox extends ViewBoxBaseComponent() { //The function that starts or resets presentaton functionally, depending on presStatus of the layoutDoc @action - startAutoPres = (startSlide: number) => { + startAutoPres = async (startSlide: number) => { this.layoutDoc.presStatus = PresStatus.Autoplay; - this.startPresentation(startSlide); + if (startSlide + 1 === this.childDocs.length) { + this.gotoDocument(0); + await new Promise(res => setTimeout(() => res(), NumCast(this.activeItem.presDuration, this.activeItem.type === DocumentType.SCRIPTING ? 0 : 2500) + NumCast(this.activeItem.presTransition))); + } + this.startPresentation(startSlide + 1 === this.childDocs.length ? 0 : startSlide); clearTimeout(this._presTimer); const func = (itemIndex: number) => { if (itemIndex === this.next()) this.layoutDoc.presStatus = PresStatus.Manual; - else - this._presTimer = setTimeout( - () => this.layoutDoc.presStatus !== PresStatus.Manual && func(this.itemIndex), - NumCast(this.activeItem.presDuration, this.activeItem.type === DocumentType.SCRIPTING ? 0 : 2500) + NumCast(this.activeItem.presTransition) - ); + this._presTimer = setTimeout( + () => this.layoutDoc.presStatus !== PresStatus.Manual && func(this.itemIndex), + NumCast(this.activeItem.presDuration, this.activeItem.type === DocumentType.SCRIPTING ? 0 : 2500) + NumCast(this.activeItem.presTransition) + ); }; - func(this.itemIndex); }; -- cgit v1.2.3-70-g09d2