From e8f23ca09b04870ae8b265526d912c2244176bb0 Mon Sep 17 00:00:00 2001
From: geireann <60007097+geireann@users.noreply.github.com>
Date: Tue, 1 Dec 2020 22:11:26 +0800
Subject: Removed temp presProperties
---
.../views/presentationview/PresProperties.tsx | 492 ---------------------
1 file changed, 492 deletions(-)
delete mode 100644 src/client/views/presentationview/PresProperties.tsx
(limited to 'src')
diff --git a/src/client/views/presentationview/PresProperties.tsx b/src/client/views/presentationview/PresProperties.tsx
deleted file mode 100644
index edad41861..000000000
--- a/src/client/views/presentationview/PresProperties.tsx
+++ /dev/null
@@ -1,492 +0,0 @@
-import React from "react";
-import { action, computed, observable, reaction } from "mobx";
-import { Doc } from "../../../fields/Doc";
-import { BoolCast, Cast, NumCast } from "../../../fields/Types";
-import { undoBatch, UndoManager } from "../../util/UndoManager";
-import { PresBox, PresColor, PresEffect, PresMovement } from "../nodes/PresBox";
-import { DocumentType } from "../../documents/DocumentTypes";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { CollectionViewType } from "../collections/CollectionView";
-import { Tooltip } from "@material-ui/core";
-
-
-export class PresProperties {
-
- @observable public static Instance: PresProperties;
-
- @computed get pres(): PresBox { return PresBox.Instance; }
-
- @computed get activeItem() { return Cast(this.pres.childDocs[NumCast(PresBox.Instance.rootDoc._itemIndex)], Doc, null); }
- @computed get targetDoc() { return Cast(this.pres.activeItem?.presentationTargetDoc, Doc, null); }
-
- @computed get scrollable(): boolean {
- if (this.targetDoc.type === DocumentType.PDF || this.targetDoc.type === DocumentType.WEB || this.targetDoc.type === DocumentType.RTF || this.targetDoc._viewType === CollectionViewType.Stacking) return true;
- else return false;
- }
- @computed get panable(): boolean {
- if ((this.targetDoc.type === DocumentType.COL && this.targetDoc._viewType === CollectionViewType.Freeform) || this.targetDoc.type === DocumentType.IMG) return true;
- else return false;
- }
-
-
- @observable private openMovementDropdown: boolean = false;
- @observable private openEffectDropdown: boolean = false;
-
- _batch: UndoManager.Batch | undefined = undefined;
-
-
- @computed get effectDirection(): string {
- let effect = '';
- switch (this.targetDoc.presEffectDirection) {
- case 'left': effect = "Enter from left"; break;
- case 'right': effect = "Enter from right"; break;
- case 'top': effect = "Enter from top"; break;
- case 'bottom': effect = "Enter from bottom"; break;
- default: effect = "Enter from center"; break;
- }
- return effect;
- }
-
- @undoBatch
- @action
- updateHideBefore = (activeItem: Doc) => {
- activeItem.presHideBefore = !activeItem.presHideBefore;
- Array.from(this.pres._selectedArray.keys()).forEach((doc) => doc.presHideBefore = activeItem.presHideBefore);
- }
-
- @undoBatch
- @action
- updateHideAfter = (activeItem: Doc) => {
- activeItem.presHideAfter = !activeItem.presHideAfter;
- Array.from(this.pres._selectedArray.keys()).forEach((doc) => doc.presHideAfter = activeItem.presHideAfter);
- }
-
- @undoBatch
- @action
- updateOpenDoc = (activeItem: Doc) => {
- activeItem.openDocument = !activeItem.openDocument;
- Array.from(this.pres._selectedArray.keys()).forEach((doc) => {
- doc.openDocument = activeItem.openDocument;
- });
- }
-
- /**
- * When the movement dropdown is changes
- */
- @undoBatch
- updateMovement = action((movement: any, all?: boolean) => {
- const array: any[] = all ? this.pres.childDocs : Array.from(this.pres._selectedArray.keys());
- array.forEach((doc) => {
- switch (movement) {
- case PresMovement.Zoom: //Pan and zoom
- doc.presMovement = PresMovement.Zoom;
- break;
- case PresMovement.Pan: //Pan
- doc.presMovement = PresMovement.Pan;
- break;
- case PresMovement.Jump: //Jump Cut
- doc.presJump = true;
- doc.presMovement = PresMovement.Jump;
- break;
- case PresMovement.None: default:
- doc.presMovement = PresMovement.None;
- break;
- }
- });
- });
-
- @undoBatch
- @action
- updateEffect = (effect: any, all?: boolean) => {
- const array: any[] = all ? this.pres.childDocs : Array.from(this.pres._selectedArray.keys());
- array.forEach((doc) => {
- const tagDoc = Cast(doc.presentationTargetDoc, Doc, null);
- switch (effect) {
- case PresEffect.Bounce:
- tagDoc.presEffect = PresEffect.Bounce;
- break;
- case PresEffect.Fade:
- tagDoc.presEffect = PresEffect.Fade;
- break;
- case PresEffect.Flip:
- tagDoc.presEffect = PresEffect.Flip;
- break;
- case PresEffect.Roll:
- tagDoc.presEffect = PresEffect.Roll;
- break;
- case PresEffect.Rotate:
- tagDoc.presEffect = PresEffect.Rotate;
- break;
- case PresEffect.None: default:
- tagDoc.presEffect = PresEffect.None;
- break;
- }
- });
- }
-
- @undoBatch
- @action
- updateEffectDirection = (effect: any, all?: boolean) => {
- const array: any[] = all ? this.pres.childDocs : Array.from(this.pres._selectedArray.keys());
- array.forEach((doc) => {
- const tagDoc = Cast(doc.presentationTargetDoc, Doc, null);
- switch (effect) {
- case PresEffect.Left:
- tagDoc.presEffectDirection = PresEffect.Left;
- break;
- case PresEffect.Right:
- tagDoc.presEffectDirection = PresEffect.Right;
- break;
- case PresEffect.Top:
- tagDoc.presEffectDirection = PresEffect.Top;
- break;
- case PresEffect.Bottom:
- tagDoc.presEffectDirection = PresEffect.Bottom;
- break;
- case PresEffect.Center: default:
- tagDoc.presEffectDirection = PresEffect.Center;
- break;
- }
- });
- }
-
- // Converts seconds to ms and updates presTransition
- setTransitionTime = (number: String, change?: number) => {
- let timeInMS = Number(number) * 1000;
- if (change) timeInMS += change;
- if (timeInMS < 100) timeInMS = 100;
- if (timeInMS > 10000) timeInMS = 10000;
- Array.from(PresBox.Instance._selectedArray.keys()).forEach((doc) => doc.presTransition = timeInMS);
- }
-
- // Converts seconds to ms and updates presDuration
- setDurationTime = (number: String, change?: number) => {
- let timeInMS = Number(number) * 1000;
- if (change) timeInMS += change;
- if (timeInMS < 100) timeInMS = 100;
- if (timeInMS > 20000) timeInMS = 20000;
- Array.from(PresBox.Instance._selectedArray.keys()).forEach((doc) => doc.presDuration = timeInMS);
- }
-
- setMovementName = action((movement: any, activeItem: Doc): string => {
- let output: string = 'none';
- switch (movement) {
- case PresMovement.Zoom: output = 'Pan & Zoom'; break; //Pan and zoom
- case PresMovement.Pan: output = 'Pan'; break; //Pan
- case PresMovement.Jump: output = 'Jump cut'; break; //Jump Cut
- case PresMovement.None: output = 'No Movement'; break; //None
- default: output = 'Zoom'; activeItem.presMovement = 'zoom'; break; //default set as zoom
- }
- return output;
- });
-
- @computed get transitionDropdown() {
- const activeItem: Doc = this.activeItem;
- const targetDoc: Doc = this.targetDoc;
- const isPresCollection: boolean = (targetDoc === this.pres.layoutDoc.presCollection);
- const isPinWithView: boolean = BoolCast(activeItem.presPinView);
- if (activeItem && targetDoc) {
- const transitionSpeed = activeItem.presTransition ? NumCast(activeItem.presTransition) / 1000 : 0.5;
- let duration = activeItem.presDuration ? NumCast(activeItem.presDuration) / 1000 : 2;
- if (activeItem.type === DocumentType.AUDIO) duration = NumCast(activeItem.duration);
- const effect = targetDoc.presEffect ? targetDoc.presEffect : 'None';
- activeItem.presMovement = activeItem.presMovement ? activeItem.presMovement : 'Zoom';
- return (
-
e.stopPropagation()} onPointerUp={e => e.stopPropagation()} onClick={action(e => { e.stopPropagation(); this.openMovementDropdown = false; this.openEffectDropdown = false; })}>
-
- Movement
- {isPresCollection || (isPresCollection && isPinWithView) ?
-
- {this.scrollable ? "Scroll to pinned view" : !isPinWithView ? "No movement" : "Pan & Zoom to pinned view"}
-
- :
-
{ e.stopPropagation(); this.openMovementDropdown = !this.openMovementDropdown; })} style={{ borderBottomLeftRadius: this.openMovementDropdown ? 0 : 5, border: this.openMovementDropdown ? `solid 2px ${PresColor.DarkBlue}` : 'solid 1px black' }}>
- {this.setMovementName(activeItem.presMovement, activeItem)}
-
-
e.stopPropagation()} style={{ display: this.openMovementDropdown ? "grid" : "none" }}>
-
e.stopPropagation()} onClick={() => this.updateMovement(PresMovement.None)}>None
-
e.stopPropagation()} onClick={() => this.updateMovement(PresMovement.Zoom)}>Pan {"&"} Zoom
-
e.stopPropagation()} onClick={() => this.updateMovement(PresMovement.Pan)}>Pan
-
e.stopPropagation()} onClick={() => this.updateMovement(PresMovement.Jump)}>Jump cut
-
-
- }
-
-
Transition Speed
-
- this.setTransitionTime(e.target.value))} /> s
-
-
-
this.setTransitionTime(String(transitionSpeed), 1000))}>
-
-
-
this.setTransitionTime(String(transitionSpeed), -1000))}>
-
-
-
-
-
this._batch = UndoManager.StartBatch("presTransition")}
- onPointerUp={() => this._batch?.end()}
- onChange={(e: React.ChangeEvent
) => {
- e.stopPropagation();
- this.setTransitionTime(e.target.value);
- }} />
-
-
-
- Visibility {"&"} Duration
-
- {isPresCollection ? (null) :
{"Hide before presented"}
>}> this.updateHideBefore(activeItem)}>Hide before
}
- {isPresCollection ? (null) :
{"Hide after presented"}
>}> this.updateHideAfter(activeItem)}>Hide after
}
-
{"Open document in a new tab"}
>}> this.updateOpenDoc(activeItem)}>Open
-
-
-
Slide Duration
-
- this.setDurationTime(e.target.value))} /> s
-
-
-
this.setDurationTime(String(duration), 1000))}>
-
-
-
this.setDurationTime(String(duration), -1000))}>
-
-
-
-
-
{ this._batch = UndoManager.StartBatch("presDuration"); }}
- onPointerUp={() => { if (this._batch) this._batch.end(); }}
- onChange={(e: React.ChangeEvent
) => { e.stopPropagation(); this.setDurationTime(e.target.value); }}
- />
-
-
Short
-
Medium
-
Long
-
-
- {isPresCollection ? (null) :
- Effects
-
{ e.stopPropagation(); this.openEffectDropdown = !this.openEffectDropdown; })} style={{ borderBottomLeftRadius: this.openEffectDropdown ? 0 : 5, border: this.openEffectDropdown ? `solid 2px ${PresColor.DarkBlue}` : 'solid 1px black' }}>
- {effect}
-
-
e.stopPropagation()}>
-
e.stopPropagation()} onClick={() => this.updateEffect(PresEffect.None)}>None
-
e.stopPropagation()} onClick={() => this.updateEffect(PresEffect.Fade)}>Fade In
-
e.stopPropagation()} onClick={() => this.updateEffect(PresEffect.Flip)}>Flip
-
e.stopPropagation()} onClick={() => this.updateEffect(PresEffect.Rotate)}>Rotate
-
e.stopPropagation()} onClick={() => this.updateEffect(PresEffect.Bounce)}>Bounce
-
e.stopPropagation()} onClick={() => this.updateEffect(PresEffect.Roll)}>Roll
-
-
-
-
Effect direction
-
- {this.effectDirection}
-
-
-
-
{"Enter from left"}
>}> this.updateEffectDirection(PresEffect.Left)}>
-
{"Enter from right"}
>}> this.updateEffectDirection(PresEffect.Right)}>
-
{"Enter from top"}
>}> this.updateEffectDirection(PresEffect.Top)}>
-
{"Enter from bottom"}
>}> this.updateEffectDirection(PresEffect.Bottom)}>
-
{"Enter from center"}
>}> this.updateEffectDirection(PresEffect.Center)}>
-
-
}
-
-
this.applyTo(this.pres.childDocs)}>
- Apply to all
-
-
-
- );
- }
- }
-
- @undoBatch
- @action
- applyTo = (array: Doc[]) => {
- const activeItem: Doc = this.activeItem;
- const targetDoc: Doc = this.targetDoc;
- this.updateMovement(activeItem.presMovement, true);
- this.updateEffect(targetDoc.presEffect, true);
- this.updateEffectDirection(targetDoc.presEffectDirection, true);
- array.forEach((doc) => {
- const curDoc = Cast(doc, Doc, null);
- const tagDoc = Cast(curDoc.presentationTargetDoc, Doc, null);
- if (tagDoc && targetDoc) {
- curDoc.presTransition = activeItem.presTransition;
- curDoc.presDuration = activeItem.presDuration;
- curDoc.presHideBefore = activeItem.presHideBefore;
- curDoc.presHideAfter = activeItem.presHideAfter;
- }
- });
- }
-
- @computed get mediaOptionsDropdown() {
- const activeItem: Doc = this.activeItem;
- const targetDoc: Doc = this.targetDoc;
- if (activeItem && targetDoc) {
- return (
-
-
e.stopPropagation()} onPointerUp={e => e.stopPropagation()} onPointerDown={e => e.stopPropagation()}>
-
-
-
activeItem.playAuto = !activeItem.playAuto}>Play automatically
-
activeItem.playAuto = !activeItem.playAuto}>Play on next
-
- {/* {targetDoc.type === DocumentType.VID ?
activeItem.presVidFullScreen = !activeItem.presVidFullScreen}>Full screen
: (null)} */}
- {targetDoc.type === DocumentType.AUDIO ?
-
Start time
-
- ) => { activeItem.presStartTime = Number(e.target.value); })} />
-
-
: (null)}
- {targetDoc.type === DocumentType.AUDIO ?
-
End time
-
- ) => { const val = e.target.value; activeItem.presEndTime = Number(val); })} />
-
-
: (null)}
-
-
-
- );
- }
- }
-
- @computed get presPinViewOptionsDropdown() {
- const activeItem: Doc = this.activeItem;
- const targetDoc: Doc = this.targetDoc;
- const presPinWithViewIcon =
;
- return (
- <>
- {this.panable || this.scrollable || this.targetDoc.type === DocumentType.COMPARISON ? 'Pinned view' : (null)}
-
-
{activeItem.presPinView ? "Turn off pin with view" : "Turn on pin with view"}
>}> {
- activeItem.presPinView = !activeItem.presPinView;
- targetDoc.presPinView = activeItem.presPinView;
- if (activeItem.presPinView) {
- if (targetDoc.type === DocumentType.PDF || targetDoc.type === DocumentType.RTF || targetDoc.type === DocumentType.WEB || targetDoc._viewType === CollectionViewType.Stacking) {
- const scroll = targetDoc._scrollTop;
- activeItem.presPinView = true;
- activeItem.presPinViewScroll = scroll;
- } else if (targetDoc.type === DocumentType.VID) {
- activeItem.presPinTimecode = targetDoc._currentTimecode;
- } else if ((targetDoc.type === DocumentType.COL && targetDoc._viewType === CollectionViewType.Freeform) || targetDoc.type === DocumentType.IMG) {
- const x = targetDoc._panX;
- const y = targetDoc._panY;
- const scale = targetDoc._viewScale;
- activeItem.presPinView = true;
- activeItem.presPinViewX = x;
- activeItem.presPinViewY = y;
- activeItem.presPinViewScale = scale;
- } else if (targetDoc.type === DocumentType.COMPARISON) {
- const width = targetDoc._clipWidth;
- activeItem.presPinClipWidth = width;
- activeItem.presPinView = true;
- }
- }
- }}>{presPinWithViewIcon}
- {activeItem.presPinView ?
{"Update the pinned view with the view of the selected document"}
>}> {
- if (targetDoc.type === DocumentType.PDF || targetDoc.type === DocumentType.WEB || targetDoc.type === DocumentType.RTF) {
- const scroll = targetDoc._scrollTop;
- activeItem.presPinViewScroll = scroll;
- } else if (targetDoc.type === DocumentType.VID) {
- activeItem.presPinTimecode = targetDoc._currentTimecode;
- } else if (targetDoc.type === DocumentType.COMPARISON) {
- const clipWidth = targetDoc._clipWidth;
- activeItem.presPinClipWidth = clipWidth;
- } else {
- const x = targetDoc._panX;
- const y = targetDoc._panY;
- const scale = targetDoc._viewScale;
- activeItem.presPinViewX = x;
- activeItem.presPinViewY = y;
- activeItem.presPinViewScale = scale;
- }
- }}>Update
: (null)}
-
- >
- );
- }
-
- @computed get panOptionsDropdown() {
- const activeItem: Doc = this.activeItem;
- const targetDoc: Doc = this.targetDoc;
- return (
- <>
- {this.panable ?
-
-
Pan X
-
- ) => { const val = e.target.value; activeItem.presPinViewX = Number(val); })} />
-
-
-
-
Pan Y
-
- ) => { const val = e.target.value; activeItem.presPinViewY = Number(val); })} />
-
-
-
-
Scale
-
- ) => { const val = e.target.value; activeItem.presPinViewScale = Number(val); })} />
-
-
-
: (null)}
- >
- );
- }
-
- @computed get scrollOptionsDropdown() {
- const activeItem: Doc = this.activeItem;
- const targetDoc: Doc = this.targetDoc;
- return (
- <>
- {this.scrollable ?
-
-
Scroll
-
- ) => { const val = e.target.value; activeItem.presPinViewScroll = Number(val); })} />
-
-
-
: (null)}
- >
- );
- }
-}
\ No newline at end of file
--
cgit v1.2.3-70-g09d2