aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-02-01 01:03:58 -0500
committerBob Zeleznik <zzzman@gmail.com>2020-02-01 01:03:58 -0500
commitc96fbf77aa35b3c7f8566921064886df01f195d9 (patch)
tree110f062a88e757ed183eb3b108917ee0a5548bb9 /src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
parentd20a21384fc685082955cfbb9deb9c0f1176e7ad (diff)
several layout fixes for time views. removed remnants of animate to icon code.
Diffstat (limited to 'src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx')
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx25
1 files changed, 9 insertions, 16 deletions
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 }
};
}