aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/WebBox.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/nodes/WebBox.tsx
parent9afcb0f8ab12bd94494b7a5b532dbe26835382ac (diff)
initial version of template refactoring
Diffstat (limited to 'src/client/views/nodes/WebBox.tsx')
-rw-r--r--src/client/views/nodes/WebBox.tsx11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
index 7c7f9fb83..bb58912b5 100644
--- a/src/client/views/nodes/WebBox.tsx
+++ b/src/client/views/nodes/WebBox.tsx
@@ -34,17 +34,18 @@ export class WebBox extends DocAnnotatableComponent<FieldViewProps, WebDocument>
@observable private collapsed: boolean = true;
@observable private url: string = "";
+ get layoutDoc() {return Doc.Layout(this.props.Document); }
componentWillMount() {
let field = Cast(this.props.Document[this.props.fieldKey], WebField);
if (field && field.url.href.indexOf("youtube") !== -1) {
let youtubeaspect = 400 / 315;
- var nativeWidth = NumCast(this.props.Document.nativeWidth, 0);
- var nativeHeight = NumCast(this.props.Document.nativeHeight, 0);
+ var nativeWidth = NumCast(this.layoutDoc.nativeWidth);
+ var nativeHeight = NumCast(this.layoutDoc.nativeHeight);
if (!nativeWidth || !nativeHeight || Math.abs(nativeWidth / nativeHeight - youtubeaspect) > 0.05) {
- if (!nativeWidth) this.props.Document.nativeWidth = 600;
- this.props.Document.nativeHeight = NumCast(this.props.Document.nativeWidth) / youtubeaspect;
- this.props.Document.height = NumCast(this.props.Document.width) / youtubeaspect;
+ if (!nativeWidth) this.layoutDoc.nativeWidth = 600;
+ this.layoutDoc.nativeHeight = NumCast(this.layoutDoc.nativeWidth) / youtubeaspect;
+ this.layoutDoc.height = NumCast(this.layoutDoc.width) / youtubeaspect;
}
}