diff options
| author | madelinegr <mgriswold99@gmail.com> | 2019-06-18 19:13:45 -0400 |
|---|---|---|
| committer | madelinegr <mgriswold99@gmail.com> | 2019-06-18 19:13:45 -0400 |
| commit | 4ffcff69a2fc767c6a03d46d7296b6a8c7ffd281 (patch) | |
| tree | acaa29b00d8374fb6d84d32c713536e5a6302131 /src/client/views/presentationview/PresentationElement.tsx | |
| parent | ae86fd1237873e7aa3144e7a0c6890ae60507d66 (diff) | |
Presentations Listed, Option to Change Added, and
Diffstat (limited to 'src/client/views/presentationview/PresentationElement.tsx')
| -rw-r--r-- | src/client/views/presentationview/PresentationElement.tsx | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/client/views/presentationview/PresentationElement.tsx b/src/client/views/presentationview/PresentationElement.tsx index 00dc07921..8ec6348f2 100644 --- a/src/client/views/presentationview/PresentationElement.tsx +++ b/src/client/views/presentationview/PresentationElement.tsx @@ -56,7 +56,13 @@ export enum buttonIndex { @observer export default class PresentationElement extends React.Component<PresentationElementProps> { - @observable selectedButtons: boolean[] = new Array(6); + @observable selectedButtons: boolean[]; + + + constructor(props: PresentationElementProps) { + super(props); + this.selectedButtons = new Array(6); + } /** * Getter to get the status of the buttons. @@ -67,6 +73,16 @@ export default class PresentationElement extends React.Component<PresentationEle } async componentDidMount() { + this.receiveButtonBackUp(); + + } + + async componentDidUpdate() { + this.receiveButtonBackUp(); + } + + receiveButtonBackUp = async () => { + //get the list that stores docs that keep track of buttons let castedList = Cast(this.props.presButtonBackUp.selectedButtonDocs, listSpec(Doc)); if (!castedList) { @@ -74,17 +90,21 @@ export default class PresentationElement extends React.Component<PresentationEle } //if this is the first time this doc mounts, push a doc for it to store if (castedList.length <= this.props.index) { - castedList.push(new Doc()); + let newDoc = new Doc(); + let defaultBooleanArray: boolean[] = new Array(6); + newDoc.selectedButtons = new List(defaultBooleanArray); + castedList.push(newDoc); //otherwise update the selected buttons depending on storage. } else { let curDoc: Doc = await castedList[this.props.index]; let selectedButtonOfDoc = Cast(curDoc.selectedButtons, listSpec("boolean"), null); + console.log("Debug Selected Buttons: ", this.selectedButtons, " and the selectedButtonOfDoc: ", selectedButtonOfDoc); if (selectedButtonOfDoc !== undefined) { runInAction(() => this.selectedButtons = selectedButtonOfDoc); + console.log("New Selected Buttons: ", this.selectedButtons); } } - } /** @@ -337,6 +357,8 @@ export default class PresentationElement extends React.Component<PresentationEle let p = this.props; let title = p.document.title; + console.log("Re-rendered"); + //to get currently selected presentation doc let selected = NumCast(p.mainDocument.selectedDoc, 0); |
