aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-06-18 11:31:49 -0400
committerbob <bcz@cs.brown.edu>2019-06-18 11:31:49 -0400
commit4f0086f6ea948c1c5254db2acc93f6735987daa5 (patch)
treeed9a9c97ac71e69261f59e706e4cd3f12e0bffe4 /src
parent749eef13af1338225b2bec4dbcd7a50a5650d285 (diff)
parentd7ebe7b7d19cf7dc797443aa485293670c3ee4e2 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/PDFBox.tsx5
-rw-r--r--src/client/views/pdf/PDFViewer.tsx6
-rw-r--r--src/client/views/pdf/Page.tsx3
3 files changed, 8 insertions, 6 deletions
diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx
index 80d274c6d..7dd2b1dc5 100644
--- a/src/client/views/nodes/PDFBox.tsx
+++ b/src/client/views/nodes/PDFBox.tsx
@@ -87,7 +87,6 @@ export class PDFBox extends DocComponent<FieldViewProps, PdfDocument>(PdfDocumen
onScroll = (e: React.UIEvent<HTMLDivElement>) => {
if (e.currentTarget) {
this._scrollY = e.currentTarget.scrollTop;
- // e.currentTarget.scrollTo({ top: 1000, behavior: "smooth" });
let ccv = this.props.ContainingCollectionView;
if (ccv) {
ccv.props.Document.scrollY = this._scrollY;
@@ -107,7 +106,9 @@ export class PDFBox extends DocComponent<FieldViewProps, PdfDocument>(PdfDocumen
marginTop: `${NumCast(this.props.ContainingCollectionView!.props.Document.panY)}px`
}}
ref={this.createRef}
- onWheel={(e: React.WheelEvent) => e.stopPropagation()} className={classname}>
+ onWheel={(e: React.WheelEvent) => {
+ e.stopPropagation();
+ }} className={classname}>
<PDFViewer url={pdfUrl.url.pathname} loaded={this.loaded} scrollY={this._scrollY} parent={this} />
{/* <div style={{ width: "100px", height: "300px" }}></div> */}
</div>
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index 86a17c0a6..69372f43b 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -388,7 +388,7 @@ class Viewer extends React.Component<IViewerProps> {
{this._annotations.map(anno => this.renderAnnotation(anno))}
</div>
</div>
- </div>
+ </div >
);
}
}
@@ -522,7 +522,7 @@ class PinAnnotation extends React.Component<IAnnotationProps> {
class RegionAnnotation extends React.Component<IAnnotationProps> {
@observable private _backgroundColor: string = "red";
- onPointerDown = (e: React.PointerEvent) => {
+ onPointerDown = (e: React.MouseEvent) => {
let targetDoc = Cast(this.props.document.target, Doc, null);
if (targetDoc) {
DocumentManager.Instance.jumpToDocument(targetDoc);
@@ -531,7 +531,7 @@ class RegionAnnotation extends React.Component<IAnnotationProps> {
render() {
return (
- <div className="pdfViewer-annotationBox" onPointerDown={this.onPointerDown}
+ <div className="pdfViewer-annotationBox" onClick={this.onPointerDown}
style={{ top: this.props.y * scale, left: this.props.x * scale, width: this.props.width * scale, height: this.props.height * scale, pointerEvents: "all", backgroundColor: StrCast(this.props.document.color) }}></div>
);
}
diff --git a/src/client/views/pdf/Page.tsx b/src/client/views/pdf/Page.tsx
index bb87ec9d4..a19b64eda 100644
--- a/src/client/views/pdf/Page.tsx
+++ b/src/client/views/pdf/Page.tsx
@@ -402,7 +402,8 @@ export default class Page extends React.Component<IPageProps> {
let boundingRect = this._textLayer.current.getBoundingClientRect();
for (let i = 0; i < clientRects.length; i++) {
let rect = clientRects.item(i);
- if (rect) {
+ if (rect && rect.width !== this._textLayer.current.getBoundingClientRect().width && rect.height !== this._textLayer.current.getBoundingClientRect().height) {
+ console.log(rect);
let annoBox = document.createElement("div");
annoBox.className = "pdfViewer-annotationBox";
// transforms the positions from screen onto the pdf div