diff options
author | Jenny Yu <jennyyu212@outlook.com> | 2022-06-08 21:20:01 -0700 |
---|---|---|
committer | Jenny Yu <jennyyu212@outlook.com> | 2022-06-08 21:20:01 -0700 |
commit | e08c690dbeca3e58b1bc0d387df0287f60f58b7a (patch) | |
tree | 964f8cdaac5767371c917e10b71719c826730aa2 /src | |
parent | 80bffa352450c384538dedad626d5a52b7950bc4 (diff) |
fix: remove recording from overlay when deleting slide
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/trails/PresBox.tsx | 3 | ||||
-rw-r--r-- | src/client/views/nodes/trails/PresElementBox.tsx | 24 |
2 files changed, 12 insertions, 15 deletions
diff --git a/src/client/views/nodes/trails/PresBox.tsx b/src/client/views/nodes/trails/PresBox.tsx index 591480023..fe7b5c8c4 100644 --- a/src/client/views/nodes/trails/PresBox.tsx +++ b/src/client/views/nodes/trails/PresBox.tsx @@ -327,10 +327,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() { navigateToView = (targetDoc: Doc, activeItem: Doc) => { clearTimeout(this._navTimer); const bestTarget = DocumentManager.Instance.getFirstDocumentView(targetDoc)?.props.Document; - if (bestTarget) console.log(bestTarget.title, bestTarget.type); - else console.log("no best target"); bestTarget && runInAction(() => { - console.log(bestTarget.title, bestTarget.type); if (bestTarget.type === DocumentType.PDF || bestTarget.type === DocumentType.WEB || bestTarget.type === DocumentType.RTF || bestTarget._viewType === CollectionViewType.Stacking) { bestTarget._viewTransition = activeItem.presTransition ? `transform ${activeItem.presTransition}ms` : 'all 0.5s'; bestTarget._scrollTop = activeItem.presPinViewScroll; diff --git a/src/client/views/nodes/trails/PresElementBox.tsx b/src/client/views/nodes/trails/PresElementBox.tsx index f56ca5471..a2d76978a 100644 --- a/src/client/views/nodes/trails/PresElementBox.tsx +++ b/src/client/views/nodes/trails/PresElementBox.tsx @@ -261,11 +261,12 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() { @undoBatch removeItem = action((e: React.MouseEvent) => { + e.stopPropagation(); this.props.removeDocument?.(this.rootDoc); if (PresBox.Instance._selectedArray.has(this.rootDoc)) { PresBox.Instance._selectedArray.delete(this.rootDoc); } - e.stopPropagation(); + this.removeAllRecordingInOverlay() }); // set the value/title of the individual pres element @@ -318,10 +319,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() { return isInOverlay } - @undoBatch - @action - hideRecording = (e: React.PointerEvent) => { - e.stopPropagation() + removeAllRecordingInOverlay = () => { DocListCast((Doc.UserDoc().myOverlayDocs as Doc).data).forEach((doc) => { if (doc.slides === this.rootDoc) { Doc.RemoveDocFromList((Doc.UserDoc().myOverlayDocs as Doc), undefined, doc); @@ -331,13 +329,15 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() { @undoBatch @action + hideRecording = (e: React.PointerEvent) => { + e.stopPropagation() + this.removeAllRecordingInOverlay() + } + + @undoBatch + @action showRecording = (activeItem: Doc) => { - // Remove every recording that already exists in overlay view - DocListCast((Doc.UserDoc().myOverlayDocs as Doc).data).forEach((doc) => { - if (doc.slides !== null) { - Doc.RemoveDocFromList((Doc.UserDoc().myOverlayDocs as Doc), undefined, doc); - } - }) + this.removeAllRecordingInOverlay() if (activeItem.recording) { // if we already have an existing recording Doc.AddDocToList((Doc.UserDoc().myOverlayDocs as Doc), undefined, Cast(activeItem.recording, Doc, null)); @@ -363,7 +363,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() { // if we dont have any recording const recording = Docs.Create.WebCamDocument("", { _width: 400, _height: 200, - hideDocumentButtonBar: true, + // hideDocumentButtonBar: true, hideDecorationTitle: true, hideOpenButton: true, // hideDeleteButton: true, |