From fb6e7ec1df78a281ba892f36558da2c4fb6e42cd Mon Sep 17 00:00:00 2001 From: Melissa Zhang Date: Sat, 18 Apr 2020 16:16:41 -0700 Subject: set up overlapping images and slider bar --- src/client/views/nodes/ComparisonBox.scss | 32 ++++++++++++++++++++-- src/client/views/nodes/ComparisonBox.tsx | 45 ++++++++++++++++++------------- 2 files changed, 56 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/ComparisonBox.scss b/src/client/views/nodes/ComparisonBox.scss index 57c680d55..2c907a010 100644 --- a/src/client/views/nodes/ComparisonBox.scss +++ b/src/client/views/nodes/ComparisonBox.scss @@ -4,8 +4,36 @@ width: 100%; height: 100%; - .beforeBox-cont { - width: 100%; + .clip-div { + position: absolute; + top: 0; + left: 0; + width: 50%; height: 100%; + overflow: hidden; + z-index: 999; + + .beforeBox-cont { + height: 100%; + width: 300px; + } + + .slide-bar { + position: absolute; + width: 5px; + height: 100%; + top: 0; + right: 0; + background-color: black; + cursor: ew-resize; + } + } + + .afterBox-cont { + position: absolute; + top: 0; + right: 0; + height: 100%; + width: 300px; } } \ No newline at end of file diff --git a/src/client/views/nodes/ComparisonBox.tsx b/src/client/views/nodes/ComparisonBox.tsx index 9120daa6c..5c44b3068 100644 --- a/src/client/views/nodes/ComparisonBox.tsx +++ b/src/client/views/nodes/ComparisonBox.tsx @@ -58,11 +58,13 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent { e.stopPropagation; + e.preventDefault; delete this.props.Document.beforeDoc; } clearAfterDoc = (e: PointerEvent) => { e.stopPropagation; + e.preventDefault; delete this.props.Document.afterDoc; } @@ -75,22 +77,25 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent -
{ - this._beforeDropDisposer && this._beforeDropDisposer(); - this._beforeDropDisposer = this.createDropTarget(ele, "beforeDoc"); - }} - style={{ backgroundColor: "red" }} - > - { - beforeDoc ? - - : null - } +
+
{ + this._beforeDropDisposer && this._beforeDropDisposer(); + this._beforeDropDisposer = this.createDropTarget(ele, "beforeDoc"); + }} + style={{ backgroundColor: "red" }}> + { + beforeDoc ? + + : +
upload before image!
+ } +
+
+ style={{ backgroundColor: "orange" }}> { afterDoc ? - : null + : +
+ upload after image! +
}
); -- cgit v1.2.3-70-g09d2