diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2020-02-01 17:48:33 -0500 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2020-02-01 17:48:33 -0500 |
commit | d718a470402e56c4fbc4e5d84f5f5192b32eac88 (patch) | |
tree | 3e9b9b621197cc5cb4896f8e22c441b86128f0aa /src | |
parent | 1a25ad93d107755320b319db999a1489982e3597 (diff) |
more presenetation cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/presentationview/PresElementBox.scss | 1 | ||||
-rw-r--r-- | src/client/views/presentationview/PresElementBox.tsx | 34 |
2 files changed, 10 insertions, 25 deletions
diff --git a/src/client/views/presentationview/PresElementBox.scss b/src/client/views/presentationview/PresElementBox.scss index 86ad8fed6..fd9de90e0 100644 --- a/src/client/views/presentationview/PresElementBox.scss +++ b/src/client/views/presentationview/PresElementBox.scss @@ -84,6 +84,7 @@ position: relative; margin-top: 22; display: flex; + width: auto; justify-content: center; .contentFittingDocumentView { position: absolute; diff --git a/src/client/views/presentationview/PresElementBox.tsx b/src/client/views/presentationview/PresElementBox.tsx index ab49fbf1e..dcc5247d5 100644 --- a/src/client/views/presentationview/PresElementBox.tsx +++ b/src/client/views/presentationview/PresElementBox.tsx @@ -162,40 +162,25 @@ export class PresElementBox extends DocExtendableComponent<FieldViewProps, PresD */ ScreenToLocalListTransform = (xCord: number, yCord: number) => [xCord, yCord]; + embedHeight = () => this.props.PanelHeight() - NumCast(this.originalLayout.collapsedHeight); + embedWidth = () => this.props.PanelWidth() - 20; /** * The function that is responsible for rendering the a preview or not for this * presentation element. */ renderEmbeddedInline = () => { - if (!this.originalLayout.embedOpen || !this.targetDoc) { - return (null); - } - - const propDocWidth = NumCast(this.layoutDoc._nativeWidth); - const propDocHeight = NumCast(this.layoutDoc._nativeHeight); - const scale = () => 175 / NumCast(this.layoutDoc._nativeWidth, 175); - const layoutDoc = Doc.Layout(this.props.Document); - if (!layoutDoc.embeddedView) { - layoutDoc.embeddedView = Doc.MakeAlias(this.originalLayout); - (layoutDoc.embeddedView as Doc).layoutKey = "layout"; - } - const embedHeight = propDocHeight === 0 ? this.props.PanelHeight() - NumCast(this.originalLayout.collapsedHeight) : propDocHeight * scale(); - return ( - <div className="presElementBox-embedded" style={{ - height: embedHeight, - width: propDocWidth === 0 ? "auto" : propDocWidth * scale(), - }}> + return !this.originalLayout.embedOpen || !this.targetDoc ? (null) : + <div className="presElementBox-embedded" style={{ height: this.embedHeight() }}> <ContentFittingDocumentView - Document={layoutDoc.embeddedView as Doc} - DataDocument={this.props.DataDoc} + Document={this.targetDoc} LibraryPath={emptyPath} - fitToBox={StrCast(this.targetDoc.type).indexOf(DocumentType.COL) !== -1} + fitToBox={true} addDocument={returnFalse} removeDocument={returnFalse} addDocTab={returnFalse} pinToPres={returnFalse} - PanelWidth={() => this.props.PanelWidth() - 20} - PanelHeight={() => embedHeight} + PanelWidth={this.embedWidth} + PanelHeight={this.embedHeight} getTransform={Transform.Identity} active={this.props.active} moveDocument={this.props.moveDocument!} @@ -204,8 +189,7 @@ export class PresElementBox extends DocExtendableComponent<FieldViewProps, PresD whenActiveChanged={returnFalse} /> <div className="presElementBox-embeddedMask" /> - </div> - ); + </div>; } render() { |