aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/pdf/Page.tsx
diff options
context:
space:
mode:
authoryipstanley <stanley_yip@brown.edu>2019-06-14 17:44:17 -0400
committeryipstanley <stanley_yip@brown.edu>2019-06-14 17:44:17 -0400
commitb987e2edbf7befbe90fafbdee476ee3b6513cc50 (patch)
tree228b095ec696d9f80c2f378b0400f5d72dc91496 /src/client/views/pdf/Page.tsx
parent4a5fd3e230fe354dd6c579cad0d5f99a40d230db (diff)
pinning things
Diffstat (limited to 'src/client/views/pdf/Page.tsx')
-rw-r--r--src/client/views/pdf/Page.tsx21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/client/views/pdf/Page.tsx b/src/client/views/pdf/Page.tsx
index 44c502a04..3bc3ac33c 100644
--- a/src/client/views/pdf/Page.tsx
+++ b/src/client/views/pdf/Page.tsx
@@ -132,6 +132,7 @@ export default class Page extends React.Component<IPageProps> {
}
}
+ @action
highlight = (targetDoc: Doc | undefined) => {
// creates annotation documents for current highlights
let annotationDoc = this.props.makeAnnotationDocuments(targetDoc);
@@ -196,6 +197,7 @@ export default class Page extends React.Component<IPageProps> {
// document.addEventListener("pointerup", this.endDrag);
}
else if (e.button === 0) {
+ PDFMenu.Instance.fadeOut(true);
let target: any = e.target;
if (target && target.parentElement === this._textLayer.current) {
e.stopPropagation();
@@ -304,25 +306,28 @@ export default class Page extends React.Component<IPageProps> {
}
copy.className = this._marquee.current.className;
this.props.createAnnotation(copy, this.props.page);
- PDFMenu.Instance.StartDrag = this.startDrag;
- PDFMenu.Instance.Highlight = this.highlight;
this._marquee.current.style.opacity = "0";
}
this._marqueeHeight = this._marqueeWidth = 0;
- PDFMenu.Instance.Left = e.clientX;
- PDFMenu.Instance.Top = e.clientY;
+ PDFMenu.Instance.jumpTo(e.clientX, e.clientY);
}
else {
let sel = window.getSelection();
if (sel && sel.type === "Range") {
- PDFMenu.Instance.StartDrag = this.startDrag;
- PDFMenu.Instance.Highlight = this.highlight;
this.createTextAnnotation(sel);
- PDFMenu.Instance.Left = e.clientX;
- PDFMenu.Instance.Top = e.clientY;
+ PDFMenu.Instance.jumpTo(e.clientX, e.clientY);
}
}
+
+
+ if (PDFMenu.Instance.Highlighting) {
+ this.highlight(undefined);
+ }
+ else {
+ PDFMenu.Instance.StartDrag = this.startDrag;
+ PDFMenu.Instance.Highlight = this.highlight;
+ }
// let x = (e.clientX - boundingRect.left) * (current.offsetWidth / boundingRect.width);
// let y = (e.clientY - boundingRect.top) * (current.offsetHeight / boundingRect.height);
// if (this._marqueeing) {