aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/PropertiesView.tsx
diff options
context:
space:
mode:
authorLionel Han <47760119+IGoByJoe@users.noreply.github.com>2020-09-09 17:33:17 -0700
committerLionel Han <47760119+IGoByJoe@users.noreply.github.com>2020-09-09 17:33:17 -0700
commit92d6a7c800c2a76115b9621f0051f344ada8a6fa (patch)
tree4383d128f020f8e44c577ea9d7be19528b61b946 /src/client/views/PropertiesView.tsx
parent0ca5ee8de08dd79b7e346b46324edf3db5a8405c (diff)
parente650f4dddb6a5f30b8eac0c6097cead28e04cd48 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into new_audio
Diffstat (limited to 'src/client/views/PropertiesView.tsx')
-rw-r--r--src/client/views/PropertiesView.tsx21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx
index 041eec2b4..d70f4b332 100644
--- a/src/client/views/PropertiesView.tsx
+++ b/src/client/views/PropertiesView.tsx
@@ -80,21 +80,11 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
@computed get isInk() { return this.selectedDoc?.type === DocumentType.INK; }
- @action
rtfWidth = () => {
- if (this.selectedDoc) {
- return Math.min(this.selectedDoc?.[WidthSym](), this.props.width - 20);
- } else {
- return 0;
- }
+ return !this.selectedDoc ? 0 : Math.min(this.selectedDoc?.[WidthSym](), this.props.width - 20);
}
- @action
rtfHeight = () => {
- if (this.selectedDoc) {
- return this.rtfWidth() <= this.selectedDoc?.[WidthSym]() ? Math.min(this.selectedDoc?.[HeightSym](), this.MAX_EMBED_HEIGHT) : this.MAX_EMBED_HEIGHT;
- } else {
- return 0;
- }
+ return !this.selectedDoc ? 0 : this.rtfWidth() <= this.selectedDoc?.[WidthSym]() ? Math.min(this.selectedDoc?.[HeightSym](), this.MAX_EMBED_HEIGHT) : this.MAX_EMBED_HEIGHT;
}
@action
@@ -286,10 +276,9 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
backgroundColor={this.previewBackground}
fitToBox={true}
FreezeDimensions={true}
- NativeWidth={layoutDoc.type ===
- StrCast(Doc.LayoutField(layoutDoc)).includes("FormattedTextBox") ? this.rtfWidth : returnZero}
- NativeHeight={layoutDoc.type ===
- StrCast(Doc.LayoutField(layoutDoc)).includes("FormattedTextBox") ? this.rtfHeight : returnZero}
+ dontCenter={true}
+ NativeWidth={layoutDoc.type === DocumentType.RTF ? this.rtfWidth : undefined}
+ NativeHeight={layoutDoc.type === DocumentType.RTF ? this.rtfHeight : undefined}
PanelWidth={panelWidth}
PanelHeight={panelHeight}
focus={returnFalse}