aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/presentationview
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-09-30 20:56:10 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-09-30 20:56:10 -0400
commit8790670f8e2173dd2a578500b3f03ad08ef793f2 (patch)
tree13f21a197b83753b2fc287e68ed1b9a59ee44e03 /src/client/views/presentationview
parent3a2ac5286e556be726440547309937945f650393 (diff)
switching presentatons to be colllections
Diffstat (limited to 'src/client/views/presentationview')
-rw-r--r--src/client/views/presentationview/PresElementBox.scss1
-rw-r--r--src/client/views/presentationview/PresElementBox.tsx46
2 files changed, 26 insertions, 21 deletions
diff --git a/src/client/views/presentationview/PresElementBox.scss b/src/client/views/presentationview/PresElementBox.scss
index c7d846718..51f2d2ab8 100644
--- a/src/client/views/presentationview/PresElementBox.scss
+++ b/src/client/views/presentationview/PresElementBox.scss
@@ -1,6 +1,7 @@
.presElementBox-item {
padding: 10px;
display: inline-block;
+ pointer-events: all;
width: 100%;
outline-color: maroon;
outline-style: dashed;
diff --git a/src/client/views/presentationview/PresElementBox.tsx b/src/client/views/presentationview/PresElementBox.tsx
index 1b4c841e7..7692800c3 100644
--- a/src/client/views/presentationview/PresElementBox.tsx
+++ b/src/client/views/presentationview/PresElementBox.tsx
@@ -12,11 +12,11 @@ import { DocumentType } from "../../documents/DocumentTypes";
import { DragManager, dropActionType, SetupDrag } from "../../util/DragManager";
import { SelectionManager } from "../../util/SelectionManager";
import { Transform } from "../../util/Transform";
+import { CollectionViewType } from '../collections/CollectionBaseView';
import { DocumentView } from "../nodes/DocumentView";
-import React = require("react");
+import { FieldView, FieldViewProps } from '../nodes/FieldView';
import "./PresElementBox.scss";
-import { FieldViewProps, FieldView } from '../nodes/FieldView';
-import { PresBox } from '../nodes/PresBox';
+import React = require("react");
library.add(faArrowUp);
@@ -25,26 +25,22 @@ library.add(faLocationArrow);
library.add(fileRegular as any);
library.add(faSearch);
library.add(faArrowDown);
-
-interface PresElementProps {
- presBox: PresBox;
-}
-
/**
* This class models the view a document added to presentation will have in the presentation.
* It involves some functionality for its buttons and options.
*/
@observer
-export class PresElementBox extends React.Component<PresElementProps & FieldViewProps> {
+export class PresElementBox extends React.Component<FieldViewProps> {
public static LayoutString() { return FieldView.LayoutString(PresElementBox); }
private header?: HTMLDivElement | undefined;
private listdropDisposer?: DragManager.DragDropDisposer;
private presElRef: React.RefObject<HTMLDivElement> = React.createRef();
+ private _embedHeight = 100;
- @computed get myIndex() { return DocListCast(this.props.presBox.props.Document[this.props.presBox.props.fieldKey]).indexOf(this.props.Document) }
- @computed get presentationDoc() { return this.props.presBox.props.Document; }
- @computed get presentationFieldKey() { return this.props.presBox.props.fieldKey; }
+ @computed get myIndex() { return DocListCast(this.presentationDoc[this.presentationFieldKey]).indexOf(this.props.Document); }
+ @computed get presentationDoc() { return this.props.Document.presBox as Doc; }
+ @computed get presentationFieldKey() { return StrCast(this.props.Document.presBoxKey); }
@computed get currentIndex() { return NumCast(this.presentationDoc.selectedDoc); }
@computed get showButton() { return BoolCast(this.props.Document.showButton); }
@computed get navButton() { return BoolCast(this.props.Document.navButton); }
@@ -266,12 +262,12 @@ export class PresElementBox extends React.Component<PresElementProps & FieldView
let scale = () => 175 / NumCast(this.props.Document.nativeWidth, 175);
return (
<div className="presElementBox-embedded" style={{
- height: propDocHeight === 0 ? 100 : propDocHeight * scale(),
+ height: propDocHeight === 0 ? this._embedHeight : propDocHeight * scale(),
width: propDocWidth === 0 ? "auto" : propDocWidth * scale(),
}}>
<DocumentView
fitToBox={StrCast(this.props.Document.type).indexOf(DocumentType.COL) !== -1}
- Document={this.props.Document.target as Doc}
+ Document={this.props.Document.target}
addDocument={returnFalse}
removeDocument={returnFalse}
ruleProvider={undefined}
@@ -300,6 +296,7 @@ export class PresElementBox extends React.Component<PresElementProps & FieldView
render() {
let p = this.props;
+ let treecontainer = this.props.ContainingCollectionDoc && this.props.ContainingCollectionDoc.viewType === CollectionViewType.Tree;
let className = "presElementBox-item" + (this.currentIndex === this.myIndex ? " presElementBox-selected" : "");
let dropAction = StrCast(this.props.Document.dropAction) as dropActionType;
let onItemDown = SetupDrag(this.presElRef, () => p.Document, this.move, dropAction, this.presentationDoc[Id], true);
@@ -310,18 +307,25 @@ export class PresElementBox extends React.Component<PresElementProps & FieldView
onPointerDown={onItemDown}
style={{ outlineWidth: Doc.IsBrushed(p.Document) ? `1px` : "0px", }}
onClick={e => p.focus(p.Document)}>
- <strong className="presElementBox-name">
- {`${this.myIndex + 1}. ${p.Document.title}`}
- </strong>
- <button className="presElementBox-icon" onPointerDown={e => e.stopPropagation()} onClick={e => this.props.removeDocument && this.props.removeDocument(p.Document)}>X</button>
- <br />
+ {treecontainer ? (null) : <>
+ <strong className="presElementBox-name">
+ {`${this.myIndex + 1}. ${p.Document.title}`}
+ </strong>
+ <button className="presElementBox-icon" onPointerDown={e => e.stopPropagation()} onClick={e => this.props.removeDocument && this.props.removeDocument(p.Document)}>X</button>
+ <br />
+ </>
+ }
<button title="Zoom" className={"presElementBox-interaction" + (this.showButton ? "-selected" : "")} onPointerDown={(e) => e.stopPropagation()} onClick={this.onZoomDocumentClick}><FontAwesomeIcon icon={"search"} /></button>
<button title="Navigate" className={"presElementBox-interaction" + (this.navButton ? "-selected" : "")} onPointerDown={(e) => e.stopPropagation()} onClick={this.onNavigateDocumentClick}><FontAwesomeIcon icon={"location-arrow"} /></button>
<button title="Hide Til Presented" className={"presElementBox-interaction" + (this.hideTillShownButton ? "-selected" : "")} onPointerDown={(e) => e.stopPropagation()} onClick={this.onHideDocumentUntilPressClick}><FontAwesomeIcon icon={fileSolid} /></button>
<button title="Fade After Presented" className={"presElementBox-interaction" + (this.fadeButton ? "-selected" : "")} onPointerDown={(e) => e.stopPropagation()} onClick={this.onFadeDocumentAfterPresentedClick}><FontAwesomeIcon icon={faFileDownload} /></button>
<button title="Hide After Presented" className={"presElementBox-interaction" + (this.hideAfterButton ? "-selected" : "")} onPointerDown={(e) => e.stopPropagation()} onClick={this.onHideDocumentAfterPresentedClick}><FontAwesomeIcon icon={faFileDownload} /></button>
- <button title="Group With Up" className={"presElementBox-interaction" + (this.groupButton ? "-selected" : "")} onPointerDown={(e) => e.stopPropagation()} onClick={action(() => this.groupButton = !this.groupButton)}> <FontAwesomeIcon icon={"arrow-up"} /> </button>
- <button title="Expand Inline" className={"presElementBox-interaction" + (this.embedInline ? "-selected" : "")} onPointerDown={(e) => e.stopPropagation()} onClick={action(() => this.embedInline = !this.embedInline)}><FontAwesomeIcon icon={"arrow-down"} /></button>
+ <button title="Group With Up" className={"presElementBox-interaction" + (this.groupButton ? "-selected" : "")} onPointerDown={(e) => e.stopPropagation()} onClick={action((e: any) => { e.stopPropagation(); this.groupButton = !this.groupButton; })}> <FontAwesomeIcon icon={"arrow-up"} /> </button>
+ <button title="Expand Inline" className={"presElementBox-interaction" + (this.embedInline ? "-selected" : "")} onPointerDown={(e) => e.stopPropagation()} onClick={action((e: any) => {
+ this.embedInline = !this.embedInline;
+ this.props.Document.height = NumCast(this.props.Document.height) + (this.embedInline ? 1 : -1) * this._embedHeight;
+ e.stopPropagation();
+ })}><FontAwesomeIcon icon={"arrow-down"} /></button>
<br />
{this.renderEmbeddedInline()}