aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/MainView.tsx2
-rw-r--r--src/client/views/presentationview/PresentationElement.tsx24
-rw-r--r--src/client/views/presentationview/PresentationList.tsx2
-rw-r--r--src/client/views/presentationview/PresentationModeMenu.scss30
-rw-r--r--src/client/views/presentationview/PresentationModeMenu.tsx92
-rw-r--r--src/client/views/presentationview/PresentationView.scss2
-rw-r--r--src/client/views/presentationview/PresentationView.tsx116
7 files changed, 238 insertions, 30 deletions
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index 53be0278e..0dbb241e4 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -267,7 +267,7 @@ export class MainView extends React.Component {
zoomToScale={emptyFunction}
getScale={returnOne}
/>}
- {castRes ? <PresentationView Documents={castRes} key="presentation" /> : null}
+ {castRes ? <PresentationView addDocTab={this.addDocTabFunc} Documents={castRes} key="presentation" /> : null}
</div>
}
</Measure>;
diff --git a/src/client/views/presentationview/PresentationElement.tsx b/src/client/views/presentationview/PresentationElement.tsx
index fdddf0e41..05a70f79a 100644
--- a/src/client/views/presentationview/PresentationElement.tsx
+++ b/src/client/views/presentationview/PresentationElement.tsx
@@ -8,7 +8,7 @@ import "./PresentationView.scss";
import { Utils, emptyFunction, returnFalse, returnOne } from "../../../Utils";
import { library } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faFile as fileSolid, faFileDownload, faLocationArrow, faArrowUp, faSearch } from '@fortawesome/free-solid-svg-icons';
+import { faFile as fileSolid, faFileDownload, faLocationArrow, faArrowUp, faSearch, faArrowRight } from '@fortawesome/free-solid-svg-icons';
import { faFile as fileRegular } from '@fortawesome/free-regular-svg-icons';
import { List } from "../../../new_fields/List";
import { listSpec } from "../../../new_fields/Schema";
@@ -28,6 +28,7 @@ library.add(fileSolid);
library.add(faLocationArrow);
library.add(fileRegular as any);
library.add(faSearch);
+library.add(faArrowRight);
interface PresentationElementProps {
mainDocument: Doc;
@@ -54,6 +55,7 @@ export enum buttonIndex {
FadeAfter = 3,
HideAfter = 4,
Group = 5,
+ OpenRight = 6
}
@@ -76,7 +78,7 @@ export default class PresentationElement extends React.Component<PresentationEle
constructor(props: PresentationElementProps) {
super(props);
- this.selectedButtons = new Array(6);
+ this.selectedButtons = new Array(7);
this.presElRef = React.createRef();
}
@@ -140,7 +142,7 @@ export default class PresentationElement extends React.Component<PresentationEle
if (!foundDoc) {
let newDoc = new Doc();
- let defaultBooleanArray: boolean[] = new Array(6);
+ let defaultBooleanArray: boolean[] = new Array(7);
newDoc.selectedButtons = new List(defaultBooleanArray);
newDoc.docId = this.props.document[Id];
castedList.push(newDoc);
@@ -402,6 +404,18 @@ export default class PresentationElement extends React.Component<PresentationEle
}
+ @action
+ onRightTabClick = (e: React.MouseEvent) => {
+ e.stopPropagation();
+ if (this.selectedButtons[buttonIndex.OpenRight]) {
+ this.selectedButtons[buttonIndex.OpenRight] = false;
+ // action maybe
+ } else {
+ this.selectedButtons[buttonIndex.OpenRight] = true;
+ }
+ this.autoSaveButtonChange(buttonIndex.OpenRight);
+ }
+
/**
* Creating a drop target for drag and drop when called.
*/
@@ -637,7 +651,7 @@ export default class PresentationElement extends React.Component<PresentationEle
*/
getSelectedButtonsOfDoc = async (paramDoc: Doc) => {
let castedList = Cast(this.props.presButtonBackUp.selectedButtonDocs, listSpec(Doc));
- let foundSelectedButtons: boolean[] = new Array(6);
+ let foundSelectedButtons: boolean[] = new Array(7);
//if this is the first time this doc mounts, push a doc for it to store
for (let doc of castedList!) {
@@ -887,6 +901,8 @@ export default class PresentationElement extends React.Component<PresentationEle
this.changeGroupStatus();
this.onGroupClick(p.document, p.index, this.selectedButtons[buttonIndex.Group]);
}}> <FontAwesomeIcon icon={"arrow-up"} /> </button>
+ <button title="Open Right" className={this.selectedButtons[buttonIndex.OpenRight] ? "presentation-interaction-selected" : "presentation-interaction"} onPointerDown={(e) => e.stopPropagation()} onClick={this.onRightTabClick}><FontAwesomeIcon icon={"arrow-right"} /></button>
+
<br />
{this.renderEmbeddedInline()}
</div>
diff --git a/src/client/views/presentationview/PresentationList.tsx b/src/client/views/presentationview/PresentationList.tsx
index 2d63d41b5..2a31137af 100644
--- a/src/client/views/presentationview/PresentationList.tsx
+++ b/src/client/views/presentationview/PresentationList.tsx
@@ -95,7 +95,7 @@ export default class PresentationViewList extends React.Component<PresListProps>
this.props.PresElementsMappings.set(doc, e);
}
}}
- key={doc[Id]}
+ key={doc[Id] + index}
mainDocument={this.props.mainDocument}
document={doc}
index={index}
diff --git a/src/client/views/presentationview/PresentationModeMenu.scss b/src/client/views/presentationview/PresentationModeMenu.scss
new file mode 100644
index 000000000..336f43d20
--- /dev/null
+++ b/src/client/views/presentationview/PresentationModeMenu.scss
@@ -0,0 +1,30 @@
+.presMenu-cont {
+ position: fixed;
+ z-index: 10000;
+ height: 35px;
+ background: #323232;
+ box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.25);
+ border-radius: 0px 6px 6px 6px;
+ overflow: hidden;
+ display: flex;
+
+ .presMenu-button {
+ background-color: transparent;
+ width: 35px;
+ height: 35px;
+ }
+
+ .presMenu-button:hover {
+ background-color: #121212;
+ }
+
+ .presMenu-dragger {
+ height: 100%;
+ transition: width .2s;
+ background-image: url("https://logodix.com/logo/1020374.png");
+ background-size: 90% 100%;
+ background-repeat: no-repeat;
+ background-position: left center;
+ }
+
+} \ No newline at end of file
diff --git a/src/client/views/presentationview/PresentationModeMenu.tsx b/src/client/views/presentationview/PresentationModeMenu.tsx
new file mode 100644
index 000000000..b3edeb1e2
--- /dev/null
+++ b/src/client/views/presentationview/PresentationModeMenu.tsx
@@ -0,0 +1,92 @@
+import React = require("react");
+import { observable, action, runInAction } from "mobx";
+import "./PresentationModeMenu.scss";
+import { observer } from "mobx-react";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+
+export interface PresModeMenuProps {
+ next: () => void;
+ back: () => void;
+ presStatus: boolean;
+ startOrResetPres: () => void;
+ closePresMode: () => void;
+}
+
+@observer
+export default class PresModeMenu extends React.Component<PresModeMenuProps> {
+
+ @observable private _top: number = 20;
+ @observable private _right: number = 0;
+ @observable private _opacity: number = 1;
+ @observable private _transition: string = "opacity 0.5s";
+ @observable private _transitionDelay: string = "";
+ //@observable private Pinned: boolean = false;
+
+
+ private _mainCont: React.RefObject<HTMLDivElement> = React.createRef();
+
+ @action
+ pointerEntered = (e: React.PointerEvent) => {
+ this._transition = "opacity 0.1s";
+ this._transitionDelay = "";
+ this._opacity = 1;
+ }
+
+ @action
+ dragging = (e: PointerEvent) => {
+ this._right -= e.movementX;
+ this._top += e.movementY;
+
+ e.stopPropagation();
+ e.preventDefault();
+ }
+
+ dragEnd = (e: PointerEvent) => {
+ document.removeEventListener("pointermove", this.dragging);
+ document.removeEventListener("pointerup", this.dragEnd);
+ e.stopPropagation();
+ e.preventDefault();
+ }
+
+ dragStart = (e: React.PointerEvent) => {
+ document.removeEventListener("pointermove", this.dragging);
+ document.addEventListener("pointermove", this.dragging);
+ document.removeEventListener("pointerup", this.dragEnd);
+ document.addEventListener("pointerup", this.dragEnd);
+ let clientRect = this._mainCont.current!.getBoundingClientRect();
+
+ // runInAction(() => this._left = (clientRect.width - e.nativeEvent.offsetX) + clientRect.left);
+ // runInAction(() => this._top = e.nativeEvent.offsetY);
+
+ e.stopPropagation();
+ e.preventDefault();
+ }
+
+ renderPlayPauseButton = () => {
+ if (this.props.presStatus) {
+ return <button title="Reset Presentation" className="presMenu-button" onClick={this.props.startOrResetPres}><FontAwesomeIcon icon="stop" /></button>;
+ } else {
+ return <button title="Start Presentation From Start" className="presMenu-button" onClick={this.props.startOrResetPres}><FontAwesomeIcon icon="play" /></button>;
+ }
+ }
+
+ render() {
+ return (
+ <div className="presMenu-cont" onPointerEnter={this.pointerEntered} ref={this._mainCont}
+ style={{ right: this._right, top: this._top, opacity: this._opacity, transition: this._transition, transitionDelay: this._transitionDelay }}>
+ <button title="Back" className="presMenu-button" onClick={this.props.back}><FontAwesomeIcon icon={"arrow-left"} /></button>
+ {this.renderPlayPauseButton()}
+ <button title="Next" className="presMenu-button" onClick={this.props.next}><FontAwesomeIcon icon={"arrow-right"} /></button>
+ <button className="presMenu-button" title="Close Presentation Menu" onClick={this.props.closePresMode}>
+ <FontAwesomeIcon icon="times" size="lg" />
+ </button>
+ <div className="presMenu-dragger" onPointerDown={this.dragStart} style={{ width: "20px" }} />
+ </div >
+ );
+ }
+
+
+
+
+} \ No newline at end of file
diff --git a/src/client/views/presentationview/PresentationView.scss b/src/client/views/presentationview/PresentationView.scss
index ee413f379..97cbd4a24 100644
--- a/src/client/views/presentationview/PresentationView.scss
+++ b/src/client/views/presentationview/PresentationView.scss
@@ -66,7 +66,7 @@
padding-bottom: 3px;
font-size: 25px;
display: inline-block;
- width: calc(100% - 160px);
+ width: calc(100% - 200px);
}
.presentation-icon {
diff --git a/src/client/views/presentationview/PresentationView.tsx b/src/client/views/presentationview/PresentationView.tsx
index de6c8ff82..70d86624c 100644
--- a/src/client/views/presentationview/PresentationView.tsx
+++ b/src/client/views/presentationview/PresentationView.tsx
@@ -4,7 +4,7 @@ import { observable, action, runInAction, reaction, autorun } from "mobx";
import "./PresentationView.scss";
import { DocumentManager } from "../../util/DocumentManager";
import { Utils } from "../../../Utils";
-import { Doc, DocListCast, DocListCastAsync } from "../../../new_fields/Doc";
+import { Doc, DocListCast, DocListCastAsync, WidthSym } from "../../../new_fields/Doc";
import { listSpec } from "../../../new_fields/Schema";
import { Cast, NumCast, FieldValue, PromiseValue, StrCast, BoolCast } from "../../../new_fields/Types";
import { Id } from "../../../new_fields/FieldSymbols";
@@ -12,11 +12,12 @@ import { List } from "../../../new_fields/List";
import PresentationElement, { buttonIndex } from "./PresentationElement";
import { library } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faArrowRight, faArrowLeft, faPlay, faStop, faPlus, faTimes, faMinus, faEdit } from '@fortawesome/free-solid-svg-icons';
+import { faArrowRight, faArrowLeft, faPlay, faStop, faPlus, faTimes, faMinus, faEdit, faEye } from '@fortawesome/free-solid-svg-icons';
import { Docs } from "../../documents/Documents";
import { undoBatch, UndoManager } from "../../util/UndoManager";
import PresentationViewList from "./PresentationList";
import { ContextMenu } from "../ContextMenu";
+import PresModeMenu from "./PresentationModeMenu";
library.add(faArrowLeft);
library.add(faArrowRight);
@@ -26,10 +27,12 @@ library.add(faPlus);
library.add(faTimes);
library.add(faMinus);
library.add(faEdit);
+library.add(faEye);
export interface PresViewProps {
Documents: List<Doc>;
+ addDocTab: (doc: Doc) => void;
}
const expandedWidth = 400;
@@ -63,7 +66,8 @@ export class PresentationView extends React.Component<PresViewProps> {
//Variable that holds reference to title input, so that new presentations get titles assigned.
@observable titleInputElement: HTMLInputElement | undefined;
@observable PresTitleChangeOpen: boolean = false;
- @observable PresViewWidth: number | undefined;
+ @observable presMode: boolean = false;
+
//initilize class variables
constructor(props: PresViewProps) {
@@ -360,11 +364,21 @@ export class PresentationView extends React.Component<PresViewProps> {
//checking if curDoc has navigation open
let curDocButtons = this.presElementsMappings.get(curDoc)!.selected;
if (curDocButtons[buttonIndex.Navigate]) {
- DocumentManager.Instance.jumpToDocument(curDoc, false);
+ // if (curDocButtons[buttonIndex.OpenRight]) {
+ // DocumentManager.Instance.jumpToDocument(curDoc, false);
+ // } else {
+ // DocumentManager.Instance.jumpToDocument(curDoc, false, undefined, this.props.addDocTab);
+ // }
+ this.jumpToTabOrRight(curDocButtons, curDoc);
} else if (curDocButtons[buttonIndex.Show]) {
let curScale = DocumentManager.Instance.getScaleOfDocView(this.childrenDocs[fromDoc]);
- //awaiting jump so that new scale can be found, since jumping is async
- await DocumentManager.Instance.jumpToDocument(curDoc, true);
+ if (curDocButtons[buttonIndex.OpenRight]) {
+ //awaiting jump so that new scale can be found, since jumping is async
+ await DocumentManager.Instance.jumpToDocument(curDoc, true);
+ } else {
+ await DocumentManager.Instance.jumpToDocument(curDoc, false, undefined, this.props.addDocTab);
+ }
+
let newScale = DocumentManager.Instance.getScaleOfDocView(curDoc);
curDoc.viewScale = newScale;
@@ -377,9 +391,15 @@ export class PresentationView extends React.Component<PresViewProps> {
return;
}
let curScale = DocumentManager.Instance.getScaleOfDocView(this.childrenDocs[fromDoc]);
+ let curDocButtons = this.presElementsMappings.get(docToJump)!.selected;
- //awaiting jump so that new scale can be found, since jumping is async
- await DocumentManager.Instance.jumpToDocument(docToJump, willZoom);
+
+ if (curDocButtons[buttonIndex.OpenRight]) {
+ //awaiting jump so that new scale can be found, since jumping is async
+ await DocumentManager.Instance.jumpToDocument(docToJump, willZoom);
+ } else {
+ await DocumentManager.Instance.jumpToDocument(docToJump, willZoom, undefined, this.props.addDocTab);
+ }
let newScale = DocumentManager.Instance.getScaleOfDocView(curDoc);
curDoc.viewScale = newScale;
//saving the scale that user was on
@@ -389,6 +409,15 @@ export class PresentationView extends React.Component<PresViewProps> {
}
+ jumpToTabOrRight = (curDocButtons: boolean[], curDoc: Doc) => {
+ if (curDocButtons[buttonIndex.OpenRight]) {
+ DocumentManager.Instance.jumpToDocument(curDoc, false);
+ } else {
+ console.log("Open in tab!!");
+ DocumentManager.Instance.jumpToDocument(curDoc, false, undefined, this.props.addDocTab);
+ }
+ }
+
/**
* Async function that supposedly return the doc that is located at given index.
*/
@@ -578,18 +607,35 @@ export class PresentationView extends React.Component<PresViewProps> {
//The function that starts or resets presentaton functionally, depending on status flag.
@action
- startOrResetPres = () => {
+ startOrResetPres = async () => {
if (this.presStatus) {
this.resetPresentation();
} else {
this.presStatus = true;
- this.startPresentation(0);
+ let startIndex = await this.findStartDocument();
+ this.startPresentation(startIndex);
const current = NumCast(this.curPresentation.selectedDoc);
- this.gotoDocument(0, current);
+ this.gotoDocument(startIndex, current);
}
this.curPresentation.presStatus = this.presStatus;
}
+ findStartDocument = async () => {
+ let docAtZero = await this.getDocAtIndex(0);
+ if (docAtZero === undefined) {
+ return 0;
+ }
+ let docAtZeroPresId = StrCast(docAtZero.presentId);
+
+ if (this.groupMappings.has(docAtZeroPresId)) {
+ let group = this.groupMappings.get(docAtZeroPresId)!;
+ let lastDoc = group[group.length - 1];
+ return this.childrenDocs.indexOf(lastDoc);
+ } else {
+ return 0;
+ }
+ }
+
//The function that resets the presentation by removing every action done by it. It also
//stops the presentaton.
@action
@@ -808,9 +854,9 @@ export class PresentationView extends React.Component<PresViewProps> {
this.presElementsMappings.set(keyDoc, elem);
}
- //_downsize = 0;
+ _downsize = 0;
onPointerDown = (e: React.PointerEvent) => {
- //this._downsize = e.clientX;
+ this._downsize = e.clientX;
document.removeEventListener("pointermove", this.onPointerMove);
document.removeEventListener("pointerup", this.onPointerUp);
document.addEventListener("pointermove", this.onPointerMove);
@@ -821,15 +867,16 @@ export class PresentationView extends React.Component<PresViewProps> {
@action
onPointerMove = (e: PointerEvent) => {
- this.curPresentation.width = Math.max(window.innerWidth - e.clientX, 255);
+ this.curPresentation.width = Math.max(window.innerWidth - e.clientX, 300);
}
@action
onPointerUp = (e: PointerEvent) => {
- //this.isPointerDown = false;
- // if (Math.abs(e.clientX - this._downsize) < 4) {
- // if (this.flyoutWidth < 5) this.flyoutWidth = 250;
- // else this.flyoutWidth = 0;
- // }
+ if (Math.abs(e.clientX - this._downsize) < 4) {
+ let presWidth = NumCast(this.curPresentation.width);
+ if (presWidth - 300 !== 0) {
+ this.curPresentation.width = 0;
+ }
+ }
document.removeEventListener("pointermove", this.onPointerMove);
document.removeEventListener("pointerup", this.onPointerUp);
}
@@ -839,17 +886,38 @@ export class PresentationView extends React.Component<PresViewProps> {
e.preventDefault();
let width = NumCast(this.curPresentation.width);
if (width === 0) {
- this.curPresentation.width = 255;
- } else {
+ this.curPresentation.width = 300;
+ }
+ }
+ @action
+ openPresMode = () => {
+ if (!this.presMode) {
this.curPresentation.width = 0;
+ this.presMode = true;
+ }
+ }
+
+ @action
+ closePresMode = () => {
+ if (this.presMode) {
+ this.presMode = false;
+ this.curPresentation.width = 300;
+ }
+
+ }
+
+ renderPresMode = () => {
+ if (this.presMode) {
+ return <PresModeMenu next={this.next} back={this.back} startOrResetPres={this.startOrResetPres} presStatus={this.presStatus} closePresMode={this.closePresMode} />;
+ } else {
+ return (null);
}
+
}
render() {
let width = NumCast(this.curPresentation.width);
- this.PresViewWidth = width;
-
return (
<div>
@@ -857,6 +925,7 @@ export class PresentationView extends React.Component<PresViewProps> {
<div className="presentationView-heading">
{this.renderSelectOrPresSelection()}
<button title="Close Presentation" className='presentation-icon' onClick={this.closePresentation}><FontAwesomeIcon icon={"times"} /></button>
+ <button title="Open Presentation Mode" className="presentation-icon" style={{ marginRight: 10 }} onClick={this.openPresMode}><FontAwesomeIcon icon={"eye"} /></button>
<button title="Add Presentation" className="presentation-icon" style={{ marginRight: 10 }} onClick={() => {
runInAction(() => { if (this.PresTitleChangeOpen) { this.PresTitleChangeOpen = false; } });
runInAction(() => this.PresTitleInputOpen ? this.PresTitleInputOpen = false : this.PresTitleInputOpen = true);
@@ -892,6 +961,7 @@ export class PresentationView extends React.Component<PresViewProps> {
onPointerDown={this.onPointerDown} onClick={this.togglePresView}>
<span title="library View Dragger" style={{ width: "100%", height: "100%", position: "absolute" }} />
</div>
+ {this.renderPresMode()}
</div>
);
}