From e042f916375fbe4f23288ece0dcec5b61ef2fbed Mon Sep 17 00:00:00 2001
From: yipstanley <stanley_yip@brown.edu>
Date: Mon, 29 Jul 2019 21:20:51 -0400
Subject: annotations now open the target context

---
 src/client/views/pdf/Annotation.tsx | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

(limited to 'src/client/views/pdf/Annotation.tsx')

diff --git a/src/client/views/pdf/Annotation.tsx b/src/client/views/pdf/Annotation.tsx
index ed7081b1d..e8d1da94b 100644
--- a/src/client/views/pdf/Annotation.tsx
+++ b/src/client/views/pdf/Annotation.tsx
@@ -9,6 +9,8 @@ import { List } from "../../../new_fields/List";
 import PDFMenu from "./PDFMenu";
 import { DocumentManager } from "../../util/DocumentManager";
 import { PresentationView } from "../presentationview/PresentationView";
+import { LinkManager } from "../../util/LinkManager";
+import { CollectionDockingView } from "../collections/CollectionDockingView";
 
 interface IAnnotationProps {
     anno: Doc;
@@ -110,11 +112,15 @@ class RegionAnnotation extends React.Component<IRegionAnnotationProps> {
     }
 
     @action
-    onPointerDown = (e: React.PointerEvent) => {
+    onPointerDown = async (e: React.PointerEvent) => {
         if (e.button === 0) {
-            let targetDoc = Cast(this.props.document.target, Doc, null);
+            let targetDoc = await Cast(this.props.document.target, Doc);
             if (targetDoc) {
-                DocumentManager.Instance.jumpToDocument(targetDoc, false);
+                let context = await Cast(targetDoc.targetContext, Doc);
+                if (context) {
+                    DocumentManager.Instance.jumpToDocument(targetDoc, false, undefined,
+                        ((doc) => this.props.parent.props.parent.props.addDocTab(context, context.proto, e.ctrlKey ? "onRight" : "inTab")));
+                }
             }
         }
         if (e.button === 2) {
-- 
cgit v1.2.3-70-g09d2


From ba2c6a9f3cd6d68bcf28ff3dc880b4f8b4635747 Mon Sep 17 00:00:00 2001
From: yipstanley <stanley_yip@brown.edu>
Date: Mon, 29 Jul 2019 23:48:35 -0400
Subject: styling changes to stacking

---
 src/client/views/collections/CollectionStackingView.scss          | 5 +++--
 .../views/collections/CollectionStackingViewFieldColumn.tsx       | 8 ++++++--
 src/client/views/pdf/Annotation.tsx                               | 2 +-
 3 files changed, 10 insertions(+), 5 deletions(-)

(limited to 'src/client/views/pdf/Annotation.tsx')

diff --git a/src/client/views/collections/CollectionStackingView.scss b/src/client/views/collections/CollectionStackingView.scss
index 2bb36c825..0cb01dc9d 100644
--- a/src/client/views/collections/CollectionStackingView.scss
+++ b/src/client/views/collections/CollectionStackingView.scss
@@ -135,9 +135,9 @@
 
     .collectionStackingView-addDocumentButton,
     .collectionStackingView-addGroupButton {
-        display: inline-block;
-        margin: 0 5px;
+        display: flex;
         overflow: hidden;
+        margin: auto;
         width: 90%;
         color: lightgrey;
         overflow: ellipses;
@@ -146,6 +146,7 @@
         .editableView-container-editing {
             color: grey;
             padding: 10px;
+            width: 100%;
         }
 
         .editableView-input:hover,
diff --git a/src/client/views/collections/CollectionStackingViewFieldColumn.tsx b/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
index b5dbc1a22..d8bed7e88 100644
--- a/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
+++ b/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
@@ -239,7 +239,11 @@ export class CollectionStackingViewFieldColumn extends React.Component<CSVFieldC
         };
         let headingView = this.props.headingObject ?
             <div key={heading} className="collectionStackingView-sectionHeader" ref={this._headerRef}
-                style={{ width: (style.columnWidth) / ((uniqueHeadings.length + (this.props.parent.props.CollectionView.props.Document.chromeStatus !== 'disabled' ? 1 : 0)) || 1) }}>
+                style={{
+                    width: (style.columnWidth) /
+                        ((uniqueHeadings.length +
+                            (this.props.parent.props.CollectionView.props.Document.chromeStatus !== 'disabled' ? 1 : 0)) || 1)
+                }}>
                 {/* the default bucket (no key value) has a tooltip that describes what it is.
                     Further, it does not have a color and cannot be deleted. */}
                 <div className="collectionStackingView-sectionHeader-subCont" onPointerDown={this.headerDown}
@@ -266,7 +270,7 @@ export class CollectionStackingViewFieldColumn extends React.Component<CSVFieldC
                 {headingView}
                 <div key={`${heading}-stack`} className={`collectionStackingView-masonry${singleColumn ? "Single" : "Grid"}`}
                     style={{
-                        padding: singleColumn ? `${style.yMargin}px ${5}px ${style.yMargin}px ${5}px` : `${style.yMargin}px ${0}px`,
+                        padding: singleColumn ? `${style.yMargin}px ${0}px ${style.yMargin}px ${0}px` : `${style.yMargin}px ${0}px`,
                         margin: "auto",
                         width: "max-content", //singleColumn ? undefined : `${cols * (style.columnWidth + style.gridGap) + 2 * style.xMargin - style.gridGap}px`,
                         height: 'max-content',
diff --git a/src/client/views/pdf/Annotation.tsx b/src/client/views/pdf/Annotation.tsx
index e8d1da94b..513f9fed6 100644
--- a/src/client/views/pdf/Annotation.tsx
+++ b/src/client/views/pdf/Annotation.tsx
@@ -119,7 +119,7 @@ class RegionAnnotation extends React.Component<IRegionAnnotationProps> {
                 let context = await Cast(targetDoc.targetContext, Doc);
                 if (context) {
                     DocumentManager.Instance.jumpToDocument(targetDoc, false, undefined,
-                        ((doc) => this.props.parent.props.parent.props.addDocTab(context, context.proto, e.ctrlKey ? "onRight" : "inTab")));
+                        ((doc) => this.props.parent.props.parent.props.addDocTab(context!, context!.proto, e.ctrlKey ? "onRight" : "inTab")));
                 }
             }
         }
-- 
cgit v1.2.3-70-g09d2


From 16eabe68912ec4e48fc4059f9b377fba0f076ab1 Mon Sep 17 00:00:00 2001
From: Bob Zeleznik <zzzman@gmail.com>
Date: Mon, 5 Aug 2019 00:43:49 -0400
Subject: a couple of fixes to PDF linking and scrolling

---
 src/client/views/pdf/Annotation.scss         |  4 +++
 src/client/views/pdf/Annotation.tsx          | 19 +++++-----
 src/client/views/pdf/PDFAnnotationLayer.scss |  6 ++++
 src/client/views/pdf/PDFAnnotationLayer.tsx  |  7 ++--
 src/client/views/pdf/PDFViewer.scss          |  9 +++--
 src/client/views/pdf/PDFViewer.tsx           | 52 +++++++++++-----------------
 6 files changed, 48 insertions(+), 49 deletions(-)
 create mode 100644 src/client/views/pdf/Annotation.scss
 create mode 100644 src/client/views/pdf/PDFAnnotationLayer.scss

(limited to 'src/client/views/pdf/Annotation.tsx')

diff --git a/src/client/views/pdf/Annotation.scss b/src/client/views/pdf/Annotation.scss
new file mode 100644
index 000000000..0ea85d522
--- /dev/null
+++ b/src/client/views/pdf/Annotation.scss
@@ -0,0 +1,4 @@
+.pdfViewer-annotationBox {
+    pointer-events: all;
+    user-select: none;
+}
\ No newline at end of file
diff --git a/src/client/views/pdf/Annotation.tsx b/src/client/views/pdf/Annotation.tsx
index 513f9fed6..a08ff5969 100644
--- a/src/client/views/pdf/Annotation.tsx
+++ b/src/client/views/pdf/Annotation.tsx
@@ -1,16 +1,15 @@
 import React = require("react");
-import { Doc, DocListCast, WidthSym, HeightSym } from "../../../new_fields/Doc";
-import { AnnotationTypes, Viewer, scale } from "./PDFViewer";
+import { action, IReactionDisposer, observable, reaction } from "mobx";
 import { observer } from "mobx-react";
-import { observable, IReactionDisposer, reaction, action } from "mobx";
-import { BoolCast, NumCast, FieldValue, Cast, StrCast } from "../../../new_fields/Types";
+import { Doc, DocListCast, HeightSym, WidthSym } from "../../../new_fields/Doc";
 import { Id } from "../../../new_fields/FieldSymbols";
 import { List } from "../../../new_fields/List";
-import PDFMenu from "./PDFMenu";
+import { BoolCast, Cast, FieldValue, NumCast, StrCast } from "../../../new_fields/Types";
 import { DocumentManager } from "../../util/DocumentManager";
 import { PresentationView } from "../presentationview/PresentationView";
-import { LinkManager } from "../../util/LinkManager";
-import { CollectionDockingView } from "../collections/CollectionDockingView";
+import PDFMenu from "./PDFMenu";
+import "./Annotation.scss";
+import { AnnotationTypes, scale, Viewer } from "./PDFViewer";
 
 interface IAnnotationProps {
     anno: Doc;
@@ -118,8 +117,9 @@ class RegionAnnotation extends React.Component<IRegionAnnotationProps> {
             if (targetDoc) {
                 let context = await Cast(targetDoc.targetContext, Doc);
                 if (context) {
-                    DocumentManager.Instance.jumpToDocument(targetDoc, false, undefined,
-                        ((doc) => this.props.parent.props.parent.props.addDocTab(context!, context!.proto, e.ctrlKey ? "onRight" : "inTab")));
+                    DocumentManager.Instance.jumpToDocument(targetDoc, false, false,
+                        ((doc) => this.props.parent.props.parent.props.addDocTab(targetDoc!, undefined, e.ctrlKey ? "onRight" : "inTab")),
+                        undefined, undefined);
                 }
             }
         }
@@ -151,7 +151,6 @@ class RegionAnnotation extends React.Component<IRegionAnnotationProps> {
                     left: this.props.x * scale,
                     width: this.props.width * scale,
                     height: this.props.height * scale,
-                    pointerEvents: "all",
                     backgroundColor: this.props.parent.Index === this.props.index ? "green" : StrCast(this.props.document.color)
                 }}></div>
         );
diff --git a/src/client/views/pdf/PDFAnnotationLayer.scss b/src/client/views/pdf/PDFAnnotationLayer.scss
new file mode 100644
index 000000000..733533007
--- /dev/null
+++ b/src/client/views/pdf/PDFAnnotationLayer.scss
@@ -0,0 +1,6 @@
+.pdfAnnotationLayer-cont {
+    width:100%;
+    height:100%;
+    position:relative;
+    top:-200%;
+}
\ No newline at end of file
diff --git a/src/client/views/pdf/PDFAnnotationLayer.tsx b/src/client/views/pdf/PDFAnnotationLayer.tsx
index 1f49e0d2f..4f267a5c0 100644
--- a/src/client/views/pdf/PDFAnnotationLayer.tsx
+++ b/src/client/views/pdf/PDFAnnotationLayer.tsx
@@ -1,5 +1,6 @@
 import React = require("react");
 import { observer } from "mobx-react";
+import "./PDFAnnotationLayer.scss";
 
 interface IAnnotationProps {
 
@@ -15,10 +16,6 @@ export class PDFAnnotationLayer extends React.Component {
     }
 
     render() {
-        return (
-            <div className="pdfAnnotationLayer-cont" style={{ width: "100%", height: "100%", position: "relative", top: "-200%" }} onPointerDown={this.onPointerDown}>
-
-            </div>
-        );
+        return <div className="pdfAnnotationLayer-cont" onPointerDown={this.onPointerDown} />;
     }
 }
\ No newline at end of file
diff --git a/src/client/views/pdf/PDFViewer.scss b/src/client/views/pdf/PDFViewer.scss
index 0fde764d0..7158aaffa 100644
--- a/src/client/views/pdf/PDFViewer.scss
+++ b/src/client/views/pdf/PDFViewer.scss
@@ -27,9 +27,12 @@
     // position: absolute;
     // top: 0;
 }
-
+.pdfViewere-viewer {
+    pointer-events:inherit;
+}
 .pdfViewer-text {
-
+    transform: scale(1.5);
+    transform-origin: top left;
     .page {
         .canvasWrapper {
             display: none;
@@ -120,6 +123,8 @@
 .pdfViewer-annotationLayer {
     position: absolute;
     top: 0;
+         width: 100%;
+        pointer-events: none;
 }
 
 
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index 5eb02a6da..6a99cec59 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -296,19 +296,19 @@ export class Viewer extends React.Component<IViewerProps> {
     }
 
     drop = async (e: Event, de: DragManager.DropEvent) => {
-        if (de.data instanceof DragManager.LinkDragData) {
-            let sourceDoc = de.data.linkSourceDocument;
-            let destDoc = this.makeAnnotationDocument(sourceDoc, 1, "red");
-            de.data.droppedDocuments.push(destDoc);
-            let targetAnnotations = DocListCast(this.props.parent.fieldExtensionDoc.annotations);
-            if (targetAnnotations) {
-                targetAnnotations.push(destDoc);
-            }
-            else {
-                this.props.parent.fieldExtensionDoc.annotations = new List<Doc>([destDoc]);
-            }
-            e.stopPropagation();
-        }
+        // if (de.data instanceof DragManager.LinkDragData) {
+        //     let sourceDoc = de.data.linkSourceDocument;
+        //     let destDoc = this.makeAnnotationDocument(sourceDoc, 1, "red");
+        //     de.data.droppedDocuments.push(destDoc);
+        //     let targetAnnotations = DocListCast(this.props.parent.fieldExtensionDoc.annotations);
+        //     if (targetAnnotations) {
+        //         targetAnnotations.push(destDoc);
+        //     }
+        //     else {
+        //         this.props.parent.fieldExtensionDoc.annotations = new List<Doc>([destDoc]);
+        //     }
+        //     e.stopPropagation();
+        // }
     }
     /**
      * Called by the Page class when it gets rendered, initializes the lists and
@@ -652,16 +652,12 @@ export class Viewer extends React.Component<IViewerProps> {
     render() {
         let compiled = this._script;
         return (
-            <div ref={this._mainCont} style={{ pointerEvents: "all" }} onPointerDown={this.pointerDown}>
+            <div className="pdfViewer-viewer" ref={this._mainCont} onPointerDown={this.pointerDown}>
                 <div className="viewer" style={this._searching ? { position: "absolute", top: 0 } : {}}>
                     {this._visibleElements}
                 </div>
-                <div className="pdfViewer-text" ref={this._viewer} onCopy={() => console.log("gello world")} style={{ transform: "scale(1.5)", transformOrigin: "top left" }} />
-                <div className="pdfViewer-annotationLayer"
-                    style={{
-                        height: this.props.parent.Document.nativeHeight, width: `100%`,
-                        pointerEvents: this.props.parent.props.active() ? "none" : "all"
-                    }}>
+                <div className="pdfViewer-text" ref={this._viewer} />
+                <div className="pdfViewer-annotationLayer" style={{ height: this.props.parent.Document.nativeHeight }}>
                     <div className="pdfViewer-annotationLayer-subCont" ref={this._annotationLayer}>
                         {this._annotations.filter(anno => {
                             if (compiled && compiled.compiled) {
@@ -731,20 +727,12 @@ class SimpleLinkService {
 
     cachePageRef() { }
 
-    get pagesCount() {
-        return this.pdf ? this.pdf.numPages : 0;
-    }
+    get pagesCount() { return this.pdf ? this.pdf.numPages : 0; }
 
-    get page() {
-        return 0;
-    }
+    get page() { return 0; }
 
-    setPdf(pdf: any) {
-        this.pdf = pdf;
-    }
+    setPdf(pdf: any) { this.pdf = pdf; }
 
-    get rotation() {
-        return 0;
-    }
+    get rotation() { return 0; }
     set rotation(value: any) { }
 }
\ No newline at end of file
-- 
cgit v1.2.3-70-g09d2

