From c96fbf77aa35b3c7f8566921064886df01f195d9 Mon Sep 17 00:00:00 2001
From: Bob Zeleznik <zzzman@gmail.com>
Date: Sat, 1 Feb 2020 01:03:58 -0500
Subject: several layout fixes for time views.  removed remnants of animate to
 icon code.

---
 .../collectionFreeForm/CollectionFreeFormView.tsx  | 25 ++++++++--------------
 1 file changed, 9 insertions(+), 16 deletions(-)

(limited to 'src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx')

diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 990a2f3ba..050dca596 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -749,33 +749,26 @@ export class CollectionFreeFormView extends CollectionSubView(PanZoomDocument) {
     }
 
     private viewDefToJSX(viewDef: any): Opt<ViewDefResult> {
+        const x = Cast(viewDef.x, "number");
+        const y = Cast(viewDef.y, "number");
+        const z = Cast(viewDef.z, "number");
+        const width = Cast(viewDef.width, "number", null);
+        const height = Cast(viewDef.height, "number", null);
         if (viewDef.type === "text") {
             const text = Cast(viewDef.text, "string"); // don't use NumCast, StrCast, etc since we want to test for undefined below
-            const x = Cast(viewDef.x, "number");
-            const y = Cast(viewDef.y, "number");
-            const z = Cast(viewDef.z, "number");
-            const width = Cast(viewDef.width, "number");
-            const height = Cast(viewDef.height, "number");
             const fontSize = Cast(viewDef.fontSize, "number");
-            return [text, x, y, width].some(val => val === undefined) ? undefined :
+            return [text, x, y].some(val => val === undefined) ? undefined :
                 {
                     ele: <div className="collectionFreeform-customText" key={(text || "") + x + y + z} style={{ width, height, fontSize, transform: `translate(${x}px, ${y}px)` }}>
                         {text}
                     </div>,
-                    bounds: { x: x!, y: y!, z: z, width: width!, height: height }
+                    bounds: { x: x!, y: y!, z: z, width, height: height }
                 };
         } else if (viewDef.type === "div") {
-            const x = Cast(viewDef.x, "number");
-            const y = Cast(viewDef.y, "number");
-            const z = Cast(viewDef.z, "number");
             const backgroundColor = Cast(viewDef.color, "string");
-            const width = Cast(viewDef.width, "number");
-            const height = Cast(viewDef.height, "number");
-            const fontSize = Cast(viewDef.fontSize, "number");
-            return [x, y, width].some(val => val === undefined) ? undefined :
+            return [x, y].some(val => val === undefined) ? undefined :
                 {
-                    ele: <div className="collectionFreeform-customDiv" key={"div" + x + y + z} style={{ width, height, fontSize, backgroundColor, transform: `translate(${x}px, ${y}px)` }}>
-                    </div>,
+                    ele: <div className="collectionFreeform-customDiv" key={"div" + x + y + z} style={{ width, height, backgroundColor, transform: `translate(${x}px, ${y}px)` }} />,
                     bounds: { x: x!, y: y!, z: z, width: width!, height: height }
                 };
         }
-- 
cgit v1.2.3-70-g09d2

