aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-09-12 14:13:34 -0400
committerbob <bcz@cs.brown.edu>2019-09-12 14:13:34 -0400
commit03579f16e2c18ef8af578f5e65da3939ee9860ee (patch)
tree9f023d744f9aa62dde763debddc562efb7853966
parent91480dbd1b734795f514281ee0a2dac2442d6e84 (diff)
fixe template custom toggling.
-rw-r--r--src/client/views/nodes/DocumentView.tsx14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 2d17c09e5..4bb31ef1d 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -441,16 +441,28 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
this.props.Document.customLayout = this.props.Document.layout;
this.props.Document.layout = this.props.Document.nativeLayout;
this.props.Document.type = this.props.Document.nativeType;
+ this.props.Document.nativeWidth = this.props.Document.nativeNativeWidth;
+ this.props.Document.nativeHeight = this.props.Document.nativeNativeHeight;
+ this.props.Document.ignoreAspect = this.props.Document.nativeIgnoreAspect;
this.props.Document.nativeLayout = undefined;
+ this.props.Document.nativeNativeWidth = undefined;
+ this.props.Document.nativeNativeHeight = undefined;
+ this.props.Document.nativeIgnoreAspect = undefined;
}
@undoBatch
makeCustomViewClicked = (): void => {
this.props.Document.nativeLayout = this.props.Document.layout;
this.props.Document.nativeType = this.props.Document.type;
- PromiseValue(this.props.Document.customLayout).then(custom => {
+ this.props.Document.nativeNativeWidth = this.props.Document.nativeWidth;
+ this.props.Document.nativeNativeHeight = this.props.Document.nativeHeight;
+ this.props.Document.nativeIgnoreAspect = this.props.Document.ignoreAspect;
+ PromiseValue(Cast(this.props.Document.customLayout, Doc)).then(custom => {
if (custom) {
this.props.Document.type = DocumentType.TEMPLATE;
this.props.Document.layout = custom;
+ !custom.nativeWidth && (this.props.Document.nativeWidth = 0);
+ !custom.nativeHeight && (this.props.Document.nativeHeight = 0);
+ !custom.nativeWidth && (this.props.Document.ignoreAspect = true);
} else {
let options = { title: "data", width: NumCast(this.props.Document.width), height: NumCast(this.props.Document.height) + 25, x: -NumCast(this.props.Document.width) / 2, y: -NumCast(this.props.Document.height) / 2, };
let fieldTemplate = this.props.Document.type === DocumentType.TEXT ? Docs.Create.TextDocument(options) : Docs.Create.ImageDocument("http://www.cs.brown.edu", options);