From 26abe109bdb556d86a2a3fe39377a080a2a902f1 Mon Sep 17 00:00:00 2001 From: Melissa Zhang Date: Tue, 28 Apr 2020 21:58:10 -0700 Subject: fixed bug where user cannot select comparison box when images and box are the same size --- src/client/views/nodes/ComparisonBox.tsx | 77 ++++++++++++++++---------------- 1 file changed, 39 insertions(+), 38 deletions(-) (limited to 'src/client/views/nodes/ComparisonBox.tsx') diff --git a/src/client/views/nodes/ComparisonBox.tsx b/src/client/views/nodes/ComparisonBox.tsx index e8368e12d..6968d5a88 100644 --- a/src/client/views/nodes/ComparisonBox.tsx +++ b/src/client/views/nodes/ComparisonBox.tsx @@ -7,9 +7,8 @@ import { observer } from "mobx-react"; import { Doc } from '../../../new_fields/Doc'; import { documentSchema } from '../../../new_fields/documentSchemas'; import { Id } from '../../../new_fields/FieldSymbols'; -import { createSchema, listSpec, makeInterface } from '../../../new_fields/Schema'; -import { ComputedField } from '../../../new_fields/ScriptField'; -import { Cast, NumCast, StrCast } from '../../../new_fields/Types'; +import { createSchema, makeInterface } from '../../../new_fields/Schema'; +import { NumCast, StrCast } from '../../../new_fields/Types'; import { DragManager } from '../../util/DragManager'; import { ViewBoxAnnotatableComponent } from '../DocComponent'; import { FieldView, FieldViewProps } from './FieldView'; @@ -108,24 +107,50 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent - {/* wraps around before image and slider bar */} -
+
+
+ {/* wraps around before image and slider bar */} +
{ + this._beforeDropDisposer && this._beforeDropDisposer(); + this._beforeDropDisposer = this.createDropTarget(ele, "beforeDoc"); + }} + style={{ width: this.props.PanelWidth() }}> + { + beforeDoc ? + <> + +
this.clearBeforeDoc(e)}> + +
+ + : +
+ +
+ } +
+
this.registerSliding(e)} /> +
{ - this._beforeDropDisposer && this._beforeDropDisposer(); - this._beforeDropDisposer = this.createDropTarget(ele, "beforeDoc"); - }} - style={{ width: this.props.PanelWidth() }}> + this._afterDropDisposer && this._afterDropDisposer(); + this._afterDropDisposer = this.createDropTarget(ele, "afterDoc"); + }}> { - beforeDoc ? + afterDoc ? <> -
this.clearBeforeDoc(e)}> - +
this.clearAfterDoc(e)}> +
: @@ -134,30 +159,6 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent }
-
this.registerSliding(e)} /> -
-
{ - this._afterDropDisposer && this._afterDropDisposer(); - this._afterDropDisposer = this.createDropTarget(ele, "afterDoc"); - }}> - { - afterDoc ? - <> - -
this.clearAfterDoc(e)}> - -
- - : -
- -
- }
); } -- cgit v1.2.3-70-g09d2