aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionFreeForm
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-06-28 03:00:30 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-06-28 03:00:30 -0400
commitdc4b658639beb21e73fc2411abd147ff6716ba3d (patch)
tree90cb2951006a3a4ceb613dcaa4ec3c8851d4869a /src/client/views/collections/collectionFreeForm
parent2ca24a234817495c3330b93b504b13c0c6db91f3 (diff)
added expansion of templates on demand
Diffstat (limited to 'src/client/views/collections/collectionFreeForm')
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 15185ecb0..128525a48 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -28,6 +28,7 @@ import { MarqueeView } from "./MarqueeView";
import React = require("react");
import v5 = require("uuid/v5");
+
export const panZoomSchema = createSchema({
panX: "number",
panY: "number",
@@ -334,11 +335,13 @@ export class CollectionFreeFormView extends CollectionSubView(PanZoomDocument) {
return 1;
}
-
getDocumentViewProps(layoutDoc: Doc): DocumentViewProps {
let datadoc = BoolCast(this.props.Document.isTemplate) || this.props.DataDoc === this.props.Document ? undefined : this.props.DataDoc;
if (Cast(layoutDoc.layout, Doc) instanceof Doc) { // if this document is using a template to render, then set the dataDoc for the template to be this document
datadoc = layoutDoc;
+ } else if (datadoc && datadoc !== layoutDoc) { // if this view has a dataDocument and it's not the same as the view document
+ // then map the view document to an instance of itself (ie, expand the template). This allows the view override the template's properties and be referenceable as document.
+ layoutDoc = Doc.expandTemplateLayout(layoutDoc, datadoc);
}
return {
DataDoc: datadoc,