aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelissa Zhang <mzhang19096@gmail.com>2020-04-22 23:24:14 -0700
committerMelissa Zhang <mzhang19096@gmail.com>2020-04-22 23:24:14 -0700
commit13f182c2f138c25b0b57169dc94ecbfdd59483ef (patch)
treea73e5fa1d3ca80f25d4b997d2c8955b02e57dbb8
parent1f68dae9485294f642bdb842347c53e5fab604d0 (diff)
icons for clear buttons
-rw-r--r--src/client/views/nodes/ComparisonBox.scss14
-rw-r--r--src/client/views/nodes/ComparisonBox.tsx38
2 files changed, 27 insertions, 25 deletions
diff --git a/src/client/views/nodes/ComparisonBox.scss b/src/client/views/nodes/ComparisonBox.scss
index 5112ed4b8..38d3a04e9 100644
--- a/src/client/views/nodes/ComparisonBox.scss
+++ b/src/client/views/nodes/ComparisonBox.scss
@@ -40,18 +40,18 @@
.clear-button {
position: absolute;
- top: 0;
- height: 25px;
- width: 25px;
- background-color: white;
- border-radius: 50%;
+ opacity: 1;
+ pointer-events: all;
+ cursor: pointer;
}
.clear-button.before {
- left: 0;
+ top: 3px;
+ left: 3px;
}
.clear-button.after {
- right: 0;
+ top: 3px;
+ right: 3px;
}
} \ No newline at end of file
diff --git a/src/client/views/nodes/ComparisonBox.tsx b/src/client/views/nodes/ComparisonBox.tsx
index fe3f47e2a..15ba8d8f2 100644
--- a/src/client/views/nodes/ComparisonBox.tsx
+++ b/src/client/views/nodes/ComparisonBox.tsx
@@ -1,6 +1,6 @@
import { library } from '@fortawesome/fontawesome-svg-core';
import { faEye } from '@fortawesome/free-regular-svg-icons';
-import { faAsterisk, faBrain, faFileAudio, faImage, faPaintBrush } from '@fortawesome/free-solid-svg-icons';
+import { faAsterisk, faBrain, faFileAudio, faImage, faPaintBrush, faTimes } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { action, computed, observable, runInAction } from 'mobx';
import { observer } from "mobx-react";
@@ -71,8 +71,8 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent<FieldViewProps, C
}
private onPointerMove = ({ movementX }: PointerEvent) => {
- const width = this.props.Document.clipWidth + movementX;
- if (width && width > 0 && width < this.props.PanelWidth()) {
+ const width = NumCast(this.props.Document.clipWidth) + movementX; //is it ok to use NumCast
+ if (width && width > 5 && width < this.props.PanelWidth()) {
this.props.Document.clipWidth = width;
}
}
@@ -117,13 +117,14 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent<FieldViewProps, C
style={{ width: this.props.PanelWidth() }}>
{
beforeDoc ?
- <><ContentFittingDocumentView {...this.props}
- Document={beforeDoc}
- getTransform={this.props.ScreenToLocalTransform} />
- <div
- className="clear-button before"
- onClick={(e) => this.clearBeforeDoc(e)}
- /></>
+ <>
+ <ContentFittingDocumentView {...this.props}
+ Document={beforeDoc}
+ getTransform={this.props.ScreenToLocalTransform} />
+ <div className="clear-button before" onClick={(e) => this.clearBeforeDoc(e)}>
+ <FontAwesomeIcon className="clear-button before" icon={faTimes} size="sm" />
+ </div>
+ </>
:
<div className="placeholder">
upload before image!
@@ -141,15 +142,16 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent<FieldViewProps, C
}}>
{
afterDoc ?
- <><ContentFittingDocumentView {...this.props}
- Document={afterDoc}
- getTransform={this.props.ScreenToLocalTransform} />
- <div
- className="clear-button after"
- onClick={(e) => this.clearAfterDoc(e)}
- /></>
+ <>
+ <ContentFittingDocumentView {...this.props}
+ Document={afterDoc}
+ getTransform={this.props.ScreenToLocalTransform} />
+ <div className="clear-button after" onClick={(e) => this.clearAfterDoc(e)}>
+ <FontAwesomeIcon className="clear-button after" icon={faTimes} size="sm" />
+ </div>
+ </>
:
- <div className="placeholder" style={{ right: "0" }}>
+ <div className="placeholder" style={{ textAlign: "right" }}>
upload after image!
</div>
}