diff options
| author | andrewdkim <adkim414@gmail.com> | 2019-11-12 17:30:02 -0500 |
|---|---|---|
| committer | andrewdkim <adkim414@gmail.com> | 2019-11-12 17:30:02 -0500 |
| commit | fb3a8258298589b911c73c18fdb086c8815e27c8 (patch) | |
| tree | c97973e8cc2d828b9ce7486b421fdcf2985c49e2 /src/client/views/nodes/IconBox.tsx | |
| parent | 4d4db3aecf54a501a981c239feacdfddfe71152c (diff) | |
| parent | ecbe527575bab2cb5f1ced278039ec0a6fc50809 (diff) | |
merge from master
Diffstat (limited to 'src/client/views/nodes/IconBox.tsx')
| -rw-r--r-- | src/client/views/nodes/IconBox.tsx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/client/views/nodes/IconBox.tsx b/src/client/views/nodes/IconBox.tsx index 63a504d1a..60f547b1e 100644 --- a/src/client/views/nodes/IconBox.tsx +++ b/src/client/views/nodes/IconBox.tsx @@ -24,8 +24,10 @@ library.add(faFilm, faTag, faTextHeight); @observer export class IconBox extends React.Component<FieldViewProps> { - public static LayoutString() { return FieldView.LayoutString(IconBox); } + public static LayoutString(fieldKey: string) { return FieldView.LayoutString(IconBox, fieldKey); } + @observable _panelWidth: number = 0; + @observable _panelHeight: number = 0; @computed get layout(): string { const field = Cast(this.props.Document[this.props.fieldKey], IconField); return field ? field.icon : "<p>Error loading icon data</p>"; } @computed get minimizedIcon() { return IconBox.DocumentIcon(this.layout); } @@ -69,17 +71,15 @@ export class IconBox extends React.Component<FieldViewProps> { cm.addItem({ description: "Use Target Title", event: () => IconBox.AutomaticTitle(this.props.Document), icon: "text-height" }); } } - @observable _panelWidth: number = 0; - @observable _panelHeight: number = 0; render() { let label = this.props.Document.hideLabel ? "" : this.props.Document.title; return ( <div className="iconBox-container" onContextMenu={this.specificContextMenu}> {this.minimizedIcon} <Measure offset onResize={(r) => runInAction(() => { - if (r.offset!.width || BoolCast(this.props.Document.hideLabel)) { - this.props.Document.nativeWidth = (r.offset!.width + Number(MINIMIZED_ICON_SIZE)); - if (this.props.Document.height === Number(MINIMIZED_ICON_SIZE)) this.props.Document.width = this.props.Document.nativeWidth; + if (r.offset!.width || this.props.Document.hideLabel) { + this.props.Document.iconWidth = (r.offset!.width + Number(MINIMIZED_ICON_SIZE)); + if (this.props.Document.height === Number(MINIMIZED_ICON_SIZE)) this.props.Document.width = this.props.Document.iconWidth; } })}> {({ measureRef }) => |
