diff options
-rw-r--r-- | src/client/util/RecordingApi.ts | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/client/util/RecordingApi.ts b/src/client/util/RecordingApi.ts index b2432af6b..3c375f663 100644 --- a/src/client/util/RecordingApi.ts +++ b/src/client/util/RecordingApi.ts @@ -22,7 +22,7 @@ type Movement = { docId: string, } -type tabReactionFunction = (res : { x: number; y: number; scale: number; key: string; }) => void; +type tabReactionFunction = (res : { x: number; y: number; scale: number; key: string; d: any }) => void; export type Presentation = { @@ -94,7 +94,7 @@ export class RecordingApi { if (this.recordingFFViews.has(key)) { console.warn('addFFViewTest : key already in map'); return; } const disposeFunc = reaction( - () => ({ x: NumCast(doc.panX, -1), y: NumCast(doc.panY, -1), scale: NumCast(doc.viewScale, 0), key: doc[Id] }), + () => ({ x: NumCast(doc.panX, -1), y: NumCast(doc.panY, -1), scale: NumCast(doc.viewScale, 0), key: doc[Id], d: doc }), (res) => reactionFunc(res), ); @@ -350,6 +350,7 @@ export class RecordingApi { Doc.UserDoc().presentationMode = 'watching'; // setup the reaction on tabs that will pause the video if the user interacts with a tab + // this.initTabWatcher((res) => console.log(res)); // TODO: consider this bug at the end of the clip on seek // this.videoBox = videoBox || null; @@ -377,7 +378,8 @@ export class RecordingApi { // TODO: make sure the cahce still hs the id // TODO: if they are open, set them to their first move // this will load the cache, so getCachedRefFields won't have to reach server - DocServer.GetRefFields([...docIds]).then(refFields => { + let docIds2 = [...docIds]; + DocServer.GetRefFields(docIds2).then(refFields => { console.log('refFields', refFields) const openTab = (docId: string) : DocumentView | undefined => { @@ -393,6 +395,18 @@ export class RecordingApi { return DocumentManager.Instance.getDocumentView(doc); } + const views = docIds2.map(docId => openTab(docId)); + const views2 = views.filter(view => view?.ComponentView).map(view => view?.ComponentView as CollectionFreeFormView); + console.log('all views', views, 'allFFviews', views2) + + const disposers = views2.map(ccFFView => { + return reaction(() => ({coords: ccFFView._pullCoords, drag: ccFFView.setPan}), (res) => console.log(res)); + }); + + console.log(disposers) + + + // make timers that will execute each movement at the correct replay time this.timers = filteredMovements.map(movement => { const timeDiff = movement.time - timeViewed * 1000 @@ -406,7 +420,10 @@ export class RecordingApi { zoomAndPan(movement, collectionFFView as CollectionFreeFormView); } // if last movement, presentation is done -> set the instance var - if (movement === filteredMovements[filteredMovements.length - 1]) RecordingApi.Instance._isPlaying = false; + if (movement === filteredMovements[filteredMovements.length - 1]) { + RecordingApi.Instance._isPlaying = false; + this.removeAllRecordingFFViews(); + } }, timeDiff) }); }) |