aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/WebBox.tsx
diff options
context:
space:
mode:
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;
}
}