aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionSchemaView.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-10-20 13:34:25 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-10-20 13:34:25 -0400
commitd8f12dade0d0b336e4328fa1f00a1a538588d34e (patch)
treeae33d9664209cc46ecf43dcdacd11f423ae29029 /src/client/views/collections/CollectionSchemaView.tsx
parent9afcb0f8ab12bd94494b7a5b532dbe26835382ac (diff)
initial version of template refactoring
Diffstat (limited to 'src/client/views/collections/CollectionSchemaView.tsx')
-rw-r--r--src/client/views/collections/CollectionSchemaView.tsx13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx
index 3218f630a..23e070750 100644
--- a/src/client/views/collections/CollectionSchemaView.tsx
+++ b/src/client/views/collections/CollectionSchemaView.tsx
@@ -922,8 +922,9 @@ interface CollectionSchemaPreviewProps {
export class CollectionSchemaPreview extends React.Component<CollectionSchemaPreviewProps>{
private dropDisposer?: DragManager.DragDropDisposer;
_mainCont?: HTMLDivElement;
- private get nativeWidth() { return NumCast(this.props.Document!.nativeWidth, this.props.PanelWidth()); }
- private get nativeHeight() { return NumCast(this.props.Document!.nativeHeight, this.props.PanelHeight()); }
+ private get layoutDoc() { return this.props.Document && Doc.Layout(this.props.Document); }
+ private get nativeWidth() { return NumCast(this.layoutDoc!.nativeWidth, this.props.PanelWidth()); }
+ private get nativeHeight() { return NumCast(this.layoutDoc!.nativeHeight, this.props.PanelHeight()); }
private contentScaling = () => {
let wscale = this.props.PanelWidth() / (this.nativeWidth ? this.nativeWidth : this.props.PanelWidth());
if (wscale * this.nativeHeight > this.props.PanelHeight()) {
@@ -947,10 +948,8 @@ export class CollectionSchemaPreview extends React.Component<CollectionSchemaPre
if (de.data instanceof DragManager.DocumentDragData) {
this.props.childDocs && this.props.childDocs.map(otherdoc => {
let target = Doc.GetProto(otherdoc);
- let layoutNative = Doc.MakeTitled("layoutNative");
- layoutNative.layout = ComputedField.MakeFunction("this.image_data[0]");
- target.layoutNative = layoutNative;
- target.layoutCUstom = target.layout = Doc.MakeDelegate(de.data.draggedDocuments[0]);
+ target.layout = ComputedField.MakeFunction("this.image_data[0]");
+ target.layoutCustom = Doc.MakeDelegate(de.data.draggedDocuments[0]);
});
e.stopPropagation();
}
@@ -968,7 +967,7 @@ export class CollectionSchemaPreview extends React.Component<CollectionSchemaPre
let br = StrCast(this.props.Document!.borderRounding);
if (br.endsWith("%")) {
let percent = Number(br.substr(0, br.length - 1)) / 100;
- let nativeDim = Math.min(NumCast(this.props.Document!.nativeWidth), NumCast(this.props.Document!.nativeHeight));
+ let nativeDim = Math.min(NumCast(this.layoutDoc!.nativeWidth), NumCast(this.layoutDoc!.nativeHeight));
let minDim = percent * (nativeDim ? nativeDim : Math.min(this.PanelWidth(), this.PanelHeight()));
return minDim;
}