diff options
author | alyssaf16 <alyssa_feinberg@brown.edu> | 2024-03-10 14:33:08 -0400 |
---|---|---|
committer | alyssaf16 <alyssa_feinberg@brown.edu> | 2024-03-10 14:33:08 -0400 |
commit | 32a742020243ffadfdae2cbc0a8b2853b0f06fc5 (patch) | |
tree | b40df0fde7dfa546de71a8fb00662318ceec7b18 /src/client/views/nodes/ComparisonBox.tsx | |
parent | ba61f7fb706b17f5b186ac32e2f8844715899886 (diff) |
flashcard
Diffstat (limited to 'src/client/views/nodes/ComparisonBox.tsx')
-rw-r--r-- | src/client/views/nodes/ComparisonBox.tsx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/client/views/nodes/ComparisonBox.tsx b/src/client/views/nodes/ComparisonBox.tsx index fa0ab61bc..86a9bcf63 100644 --- a/src/client/views/nodes/ComparisonBox.tsx +++ b/src/client/views/nodes/ComparisonBox.tsx @@ -37,6 +37,14 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent<FieldViewProps>() get clipWidthKey() { return '_' + this._props.fieldKey + '_clipWidth'; } + + @computed get clipHeight() { + return NumCast(this.layoutDoc[this.clipHeightKey], 200); + } + get clipHeightKey() { + return '_' + this._props.fieldKey + '_clipHeight'; + } + componentDidMount() { this._props.setContentViewBox?.(this); } @@ -80,6 +88,7 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent<FieldViewProps>() this._animating = 'all 200ms'; // on click, animate slider movement to the targetWidth this.layoutDoc[this.clipWidthKey] = (targetWidth * 100) / this._props.PanelWidth(); + setTimeout( action(() => (this._animating = '')), 200 @@ -201,6 +210,7 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent<FieldViewProps>() const displayDoc = (which: string) => { const whichDoc = DocCast(this.dataDoc[which]); const targetDoc = DocCast(whichDoc?.annotationOn, whichDoc); + return targetDoc ? ( <> <DocumentView @@ -211,7 +221,7 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent<FieldViewProps>() moveDocument={which.endsWith('1') ? this.moveDoc1 : this.moveDoc2} removeDocument={which.endsWith('1') ? this.remDoc1 : this.remDoc2} NativeWidth={returnZero} - NativeHeight={returnZero} + NativeHeight={() => this.clipHeight} isContentActive={emptyFunction} isDocumentActive={returnFalse} whenChildContentsActiveChanged={this.whenChildContentsActiveChanged} |