aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2020-10-22 23:29:04 +0800
committerGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2020-10-22 23:29:04 +0800
commit73719c344b15cf778b2ca66c41a5e89d57d68d1a (patch)
tree91b267ea25574a56e733d482cdc851f3688cc999 /src
parente14a9b40f265528a9d03815346ee594f42e04751 (diff)
Fixed key events not working anymore
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/PresBox.tsx8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx
index 411c4f541..d05674d69 100644
--- a/src/client/views/nodes/PresBox.tsx
+++ b/src/client/views/nodes/PresBox.tsx
@@ -152,6 +152,8 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
updateCurrentPresentation = () => {
Doc.UserDoc().activePresentation = this.rootDoc;
+ document.addEventListener("keydown", this.keyEvents, true);
+ this.selectPres();
PresBox.Instance = this;
}
@@ -186,7 +188,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
activeItem.playNow = false;
// Case 3: No more frames in current doc and next slide is defined, therefore move to next slide
} else if (this.childDocs[this.itemIndex + 1] !== undefined) {
- if (activeNext.presPinView) setTimeout(() => this.selectPres(), 0);
+ if (activeNext.presPinView || activeNext.presentationTargetDoc === this.layoutDoc.presCollection) setTimeout(() => this.updateCurrentPresentation(), 0);
else this.selectPres();
const nextSelected = this.itemIndex + 1;
if (targetDoc.type === DocumentType.AUDIO) { if (AudioBox.Instance._ele) AudioBox.Instance.pause(); }
@@ -218,7 +220,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
const prevTargetDoc = Cast(prevItem.presentationTargetDoc, Doc, null);
const lastFrame = Cast(targetDoc.lastFrame, "number", null);
const curFrame = NumCast(targetDoc._currentFrame);
- if (prevItem.presPinView) setTimeout(() => this.selectPres(), 0);
+ if (prevItem.presPinView || prevTargetDoc === this.layoutDoc.presCollection) { setTimeout(() => this.updateCurrentPresentation(), 0); }
else this.selectPres();
if (lastFrame !== undefined && curFrame >= 1) {
this.prevKeyframe(targetDoc, activeItem);
@@ -636,7 +638,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
@action
selectElement = (doc: Doc) => {
this.gotoDocument(this.childDocs.indexOf(doc), NumCast(this.itemIndex));
- if (doc.presPinView) setTimeout(() => this.selectPres(), 0);
+ if (doc.presPinView || doc.presentationTargetDoc === this.layoutDoc.presCollection) setTimeout(() => this.updateCurrentPresentation(), 0);
else this.selectPres();
}