From 894454b283b513689b8758a752a73bdd90393f0c Mon Sep 17 00:00:00 2001
From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>
Date: Fri, 6 Nov 2020 23:18:17 +0800
Subject: Cleaned up code

(1) Updated to use enums for PresEffect (Directions) and PresColor
(2) Made update pres selection work with applying to selected items
(3) Removed Effects + Movement from when targetDoc === presCollection
---
 .../views/nodes/CollectionFreeFormDocumentView.tsx | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

(limited to 'src/client/views/nodes/CollectionFreeFormDocumentView.tsx')

diff --git a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
index 7d5c224bd..c87239ee9 100644
--- a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
+++ b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
@@ -16,7 +16,7 @@ import { ComputedField } from "../../../fields/ScriptField";
 import { listSpec } from "../../../fields/Schema";
 import { DocumentType } from "../../documents/DocumentTypes";
 import { Zoom, Fade, Flip, Rotate, Bounce, Roll, LightSpeed } from 'react-reveal';
-import { PresBox } from "./PresBox";
+import { PresBox, PresEffect } from "./PresBox";
 import { InkingStroke } from "../InkingStroke";
 
 export interface CollectionFreeFormDocumentViewProps extends DocumentViewProps {
@@ -212,23 +212,23 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
             PanelHeight={this.panelHeight} />;
         if (PresBox.Instance && this.layoutDoc === PresBox.Instance.childDocs[PresBox.Instance.itemIndex]?.presentationTargetDoc) {
             const effectProps = {
-                left: this.layoutDoc.presEffectDirection === 'left',
-                right: this.layoutDoc.presEffectDirection === 'right',
-                top: this.layoutDoc.presEffectDirection === 'top',
-                bottom: this.layoutDoc.presEffectDirection === 'bottom',
+                left: this.layoutDoc.presEffectDirection === PresEffect.Left,
+                right: this.layoutDoc.presEffectDirection === PresEffect.Right,
+                top: this.layoutDoc.presEffectDirection === PresEffect.Top,
+                bottom: this.layoutDoc.presEffectDirection === PresEffect.Bottom,
                 opposite: true,
                 delay: this.layoutDoc.presTransition,
                 // when: this.layoutDoc === PresBox.Instance.childDocs[PresBox.Instance.itemIndex]?.presentationTargetDoc,
             };
             switch (this.layoutDoc.presEffect) {
                 case "Zoom": return (<Zoom {...effectProps}>{node}</Zoom>); break;
-                case "Fade": return (<Fade {...effectProps}>{node}</Fade>); break;
-                case "Flip": return (<Flip {...effectProps}>{node}</Flip>); break;
-                case "Rotate": return (<Rotate {...effectProps}>{node}</Rotate>); break;
-                case "Bounce": return (<Bounce {...effectProps}>{node}</Bounce>); break;
-                case "Roll": return (<Roll {...effectProps}>{node}</Roll>); break;
+                case PresEffect.Fade: return (<Fade {...effectProps}>{node}</Fade>); break;
+                case PresEffect.Flip: return (<Flip {...effectProps}>{node}</Flip>); break;
+                case PresEffect.Rotate: return (<Rotate {...effectProps}>{node}</Rotate>); break;
+                case PresEffect.Bounce: return (<Bounce {...effectProps}>{node}</Bounce>); break;
+                case PresEffect.Roll: return (<Roll {...effectProps}>{node}</Roll>); break;
                 case "LightSpeed": return (<LightSpeed {...effectProps}>{node}</LightSpeed>); break;
-                case "None": return node; break;
+                case PresEffect.None: return node; break;
                 default: return node; break;
             }
         } else {
-- 
cgit v1.2.3-70-g09d2

