aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/presentationview/PresentationView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/presentationview/PresentationView.tsx')
-rw-r--r--src/client/views/presentationview/PresentationView.tsx54
1 files changed, 51 insertions, 3 deletions
diff --git a/src/client/views/presentationview/PresentationView.tsx b/src/client/views/presentationview/PresentationView.tsx
index edbbeb8f9..b3d4beaf4 100644
--- a/src/client/views/presentationview/PresentationView.tsx
+++ b/src/client/views/presentationview/PresentationView.tsx
@@ -1,6 +1,6 @@
import { observer } from "mobx-react";
import React = require("react");
-import { observable, action, runInAction, reaction } from "mobx";
+import { observable, action, runInAction, reaction, autorun } from "mobx";
import "./PresentationView.scss";
import { DocumentManager } from "../../util/DocumentManager";
import { Utils } from "../../../Utils";
@@ -65,6 +65,7 @@ export class PresentationView extends React.Component<PresViewProps> {
constructor(props: PresViewProps) {
super(props);
PresentationView.Instance = this;
+ // autorun(() => console.log("Updated: ", this.presElementsMappings));
}
//The first lifecycle function that gets called to set up the current presentation.
@@ -231,6 +232,7 @@ export class PresentationView extends React.Component<PresViewProps> {
//checking if any of the group members had used zooming in
currentsArray.forEach((doc: Doc) => {
+ //let presElem: PresentationElement | undefined = this.presElementsMappings.get(doc);
if (this.presElementsMappings.get(doc)!.selected[buttonIndex.Show]) {
zoomOut = true;
return;
@@ -326,6 +328,8 @@ export class PresentationView extends React.Component<PresViewProps> {
if (curDocPresId !== undefined) {
if (this.groupMappings.has(curDocPresId)) {
let currentDocGroup = this.groupMappings.get(curDocPresId)!;
+ Array.from(this.presElementsMappings.keys()).map(doc => console.log(doc[Id]));
+ console.log("\n");
currentDocGroup.forEach((doc: Doc, index: number) => {
let selectedButtons: boolean[] = this.presElementsMappings.get(doc)!.selected;
if (selectedButtons[buttonIndex.Navigate]) {
@@ -419,9 +423,33 @@ export class PresentationView extends React.Component<PresViewProps> {
}
//removing it from the backUp of selected Buttons
+ // let castedList = Cast(this.presButtonBackUp.selectedButtonDocs, listSpec(Doc));
+ // if (castedList) {
+ // castedList.forEach(async (doc, indexOfDoc) => {
+ // let curDoc = await doc;
+ // let curDocId = StrCast(curDoc.docId);
+ // if (curDocId === removedDoc[Id]) {
+ // if (castedList) {
+ // castedList.splice(indexOfDoc, 1);
+ // return;
+ // }
+ // }
+ // });
+
+ // }
+ //removing it from the backUp of selected Buttons
+
let castedList = Cast(this.presButtonBackUp.selectedButtonDocs, listSpec(Doc));
if (castedList) {
- castedList.splice(index, 1);
+ for (let doc of castedList) {
+ let curDoc = await doc;
+ let curDocId = StrCast(curDoc.docId);
+ if (curDocId === removedDoc[Id]) {
+ castedList.splice(castedList.indexOf(curDoc), 1);
+ break;
+
+ }
+ }
}
//removing it from the backup of groups
@@ -447,6 +475,19 @@ export class PresentationView extends React.Component<PresViewProps> {
}
}
+ public removeDocByRef = (doc: Doc) => {
+ let indexOfDoc = this.childrenDocs.indexOf(doc);
+ const value = FieldValue(Cast(this.curPresentation.data, listSpec(Doc)));
+ if (value) {
+ value.splice(indexOfDoc, 1)[0];
+ }
+ //this.RemoveDoc(indexOfDoc, true);
+ if (indexOfDoc !== - 1) {
+ return true;
+ }
+ return false;
+ }
+
//The function that is called when a document is clicked or reached through next or back.
//it'll also execute the necessary actions if presentation is playing.
@action
@@ -752,6 +793,11 @@ export class PresentationView extends React.Component<PresViewProps> {
this.curPresentation.title = newTitle;
}
+ addPressElem = (keyDoc: Doc, elem: PresentationElement) => {
+ this.presElementsMappings.set(keyDoc, elem);
+ // console.log(keyDoc, " : ", elem, " => ", this.presElementsMappings.size);
+ }
+
render() {
@@ -782,11 +828,13 @@ export class PresentationView extends React.Component<PresViewProps> {
deleteDocument={this.RemoveDoc}
gotoDocument={this.gotoDocument}
groupMappings={this.groupMappings}
- presElementsMappings={this.presElementsMappings}
+ PresElementsMappings={this.presElementsMappings}
setChildrenDocs={this.setChildrenDocs}
presStatus={this.presStatus}
presButtonBackUp={this.presButtonBackUp}
presGroupBackUp={this.presGroupBackUp}
+ removeDocByRef={this.removeDocByRef}
+ clearElemMap={() => this.presElementsMappings.clear()}
/>
</div>
);