From 4fbb88e1019f1813a3bf0ed9d92e5c57eb435cdc Mon Sep 17 00:00:00 2001 From: madelinegr Date: Tue, 26 Feb 2019 17:43:12 -0500 Subject: pres view active and updating --- src/fields/KeyStore.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'src/fields/KeyStore.ts') diff --git a/src/fields/KeyStore.ts b/src/fields/KeyStore.ts index a3b39735d..61a2a1ce2 100644 --- a/src/fields/KeyStore.ts +++ b/src/fields/KeyStore.ts @@ -26,4 +26,5 @@ export namespace KeyStore { export const Caption = new Key("Caption"); export const ActiveFrame = new Key("ActiveFrame"); export const DocumentText = new Key("DocumentText"); + export const PresentationView = new Key("PresentationView"); } -- cgit v1.2.3-70-g09d2 From d9076d48a17a4ec2a5b4f4dbd82160bd10f1af22 Mon Sep 17 00:00:00 2001 From: madelinegr Date: Mon, 18 Mar 2019 20:11:07 -0400 Subject: got back and next somewhat working --- src/client/views/PresentationView.scss | 17 ++++++++++- src/client/views/PresentationView.tsx | 53 ++++++++++++++++++++++++++++++++-- src/fields/KeyStore.ts | 1 + 3 files changed, 67 insertions(+), 4 deletions(-) (limited to 'src/fields/KeyStore.ts') diff --git a/src/client/views/PresentationView.scss b/src/client/views/PresentationView.scss index cf49797ce..7c5677f0d 100644 --- a/src/client/views/PresentationView.scss +++ b/src/client/views/PresentationView.scss @@ -50,4 +50,19 @@ padding-bottom: 1px; font-size: 15px; float:left; - } \ No newline at end of file + } + + .presentation-next{ + float: right; + } + .presentation-back{ + float: left; + } + .presentation-next:hover{ + transition: all .1s; + background: #AAAAAA +} +.presentation-back:hover{ + transition: all .1s; + background: #AAAAAA +} \ No newline at end of file diff --git a/src/client/views/PresentationView.tsx b/src/client/views/PresentationView.tsx index e2a83e701..ca7111155 100644 --- a/src/client/views/PresentationView.tsx +++ b/src/client/views/PresentationView.tsx @@ -59,15 +59,30 @@ class PresentationViewItem extends React.Component { renderChild(document: Document) { let title = document.GetT(KeyStore.Title, TextField); + //to get currently selected presentation doc + let selected = this.props.Document.GetNumber(KeyStore.SelectedDoc, 0); + // if the title hasn't loaded, immediately return the div if (!title || title === "") { return
; } // finally, if it's a normal document, then render it as such. else { - return
  • -
    this.openDoc(document)}>{title.Data}
    -
    this.RemoveDoc(document)}>X
  • ; + const children = this.props.Document.GetT>(KeyStore.Data, ListField); + if (children && children !== "" && children.Data[selected] == document) { + //this doc is selected + const styles = { + background: "gray" + } + return
  • +
    this.openDoc(document)}>{title.Data}
    +
    this.RemoveDoc(document)}>X
  • ; + } else { + return
  • +
    this.openDoc(document)}>{title.Data}
    +
    this.RemoveDoc(document)}>X
  • ; + } + } } @@ -93,6 +108,34 @@ export class PresentationView extends React.Component { @observable collapsed: boolean = false; closePresentation = action(() => this.props.Document.SetNumber(KeyStore.Width, 0)); + next = () => { + const current = this.props.Document.GetNumber(KeyStore.SelectedDoc, 0); + const allDocs = this.props.Document.GetT>(KeyStore.Data, ListField); + if (allDocs && allDocs !== "" && current < allDocs.Data.length + 1) { + //can move forwards + this.props.Document.SetNumber(KeyStore.SelectedDoc, current + 1); + const doc = allDocs.Data[current + 1]; + let docView = DocumentManager.Instance.getDocumentView(doc); + if (docView) { + docView.focus(); + } + } + + }; + back = () => { + const current = this.props.Document.GetNumber(KeyStore.SelectedDoc, 0); + const allDocs = this.props.Document.GetT>(KeyStore.Data, ListField); + if (allDocs && allDocs !== "" && current - 1 >= 0) { + //can move forwards + this.props.Document.SetNumber(KeyStore.SelectedDoc, current - 1); + const doc = allDocs.Data[current - 1]; + let docView = DocumentManager.Instance.getDocumentView(doc); + if (docView) { + docView.focus(); + } + } + + }; private ref: React.RefObject; @@ -126,12 +169,16 @@ export class PresentationView extends React.Component { titleStr = title.Data; } let width = this.props.Document.GetNumber(KeyStore.Width, 0); + + //TODO: next and back should be icons return (
    {titleStr}
    X
    +
    back
    +
    next
      diff --git a/src/fields/KeyStore.ts b/src/fields/KeyStore.ts index d9ba251ae..2f9eb7715 100644 --- a/src/fields/KeyStore.ts +++ b/src/fields/KeyStore.ts @@ -36,4 +36,5 @@ export namespace KeyStore { export const CurPage = new Key("CurPage"); export const NumPages = new Key("NumPages"); export const Ink = new Key("Ink"); + export const SelectedDoc = new Key("SelectedDoc"); } -- cgit v1.2.3-70-g09d2