diff options
author | bobzel <zzzman@gmail.com> | 2020-12-16 00:38:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-16 00:38:06 -0500 |
commit | 0f52fdb7dc2555bc2f6797a462d715b0e035eb23 (patch) | |
tree | e8b7664d5e5ab3e9bc9dd7d03ff71a8e0ed134e9 /src/client/views/nodes/VideoBox.tsx | |
parent | 84849091ceaec757e545ab5ea69cd9d6ff46f6d2 (diff) | |
parent | 3fd3a5d8a130b32cd60c30904c3ce1d5d86de825 (diff) |
Merge pull request #941 from browngraphicslab/contentScalingUpdate
Content scaling update
Diffstat (limited to 'src/client/views/nodes/VideoBox.tsx')
-rw-r--r-- | src/client/views/nodes/VideoBox.tsx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx index 90a5dee23..71c5d67d8 100644 --- a/src/client/views/nodes/VideoBox.tsx +++ b/src/client/views/nodes/VideoBox.tsx @@ -23,6 +23,8 @@ import { SnappingManager } from "../../util/SnappingManager"; import { SelectionManager } from "../../util/SelectionManager"; import { LinkDocPreview } from "./LinkDocPreview"; import { FormattedTextBoxComment } from "./formattedText/FormattedTextBoxComment"; +import { Transform } from "../../util/Transform"; +import { StyleProp } from "../StyleProvider"; const path = require('path'); export const timeSchema = createSchema({ @@ -413,16 +415,17 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps, VideoD return this.addDocument(doc); } - @computed get contentScaling() { return this.props.ContentScaling(); } + screenToLocalTransform = () => this.props.ScreenToLocalTransform(); contentFunc = () => [this.youtubeVideoId ? this.youtubeContent : this.content]; render() { + const borderRad = this.props.styleProvider?.(this.layoutDoc, this.props, StyleProp.BorderRounding); + const borderRadius = borderRad?.includes("px") ? `${Number(borderRad.split("px")[0]) / (this.props.scaling?.() || 1)}px` : borderRad; return (<div className="videoBox" onContextMenu={this.specificContextMenu} style={{ - transform: this.props.PanelWidth() ? undefined : `scale(${this.contentScaling})`, - width: this.props.PanelWidth() ? undefined : `${100 / this.contentScaling}%`, - height: this.props.PanelWidth() ? undefined : `${100 / this.contentScaling}%`, + width: "100%", + height: "100%", pointerEvents: this.props.layerProvider?.(this.layoutDoc) === false ? "none" : undefined, - borderRadius: `${Number(StrCast(this.layoutDoc.borderRounding).replace("px", "")) / this.contentScaling}px` + borderRadius }} > <div className="videoBox-viewer" > <CollectionFreeFormView {...OmitKeys(this.props, ["NativeWidth", "NativeHeight"]).omit} @@ -431,7 +434,8 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps, VideoD isAnnotationOverlay={true} select={emptyFunction} active={this.annotationsActive} - ContentScaling={returnOne} + scaling={returnOne} + ScreenToLocalTransform={this.screenToLocalTransform} whenActiveChanged={this.whenActiveChanged} removeDocument={this.removeDocument} moveDocument={this.moveDocument} |