aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/pdf
diff options
context:
space:
mode:
authoryipstanley <stanley_yip@brown.edu>2019-06-27 12:29:55 -0400
committeryipstanley <stanley_yip@brown.edu>2019-06-27 12:29:55 -0400
commit088eec96750fcbdfc30b42f24e8b57926441f4e5 (patch)
treeb6372e0bd71d5b7ae2afc17009f10e727d494280 /src/client/views/pdf
parenteb9448e37be256b1c554be68cfb43dd7da44b0af (diff)
pdf fixes
Diffstat (limited to 'src/client/views/pdf')
-rw-r--r--src/client/views/pdf/PDFViewer.tsx4
-rw-r--r--src/client/views/pdf/Page.tsx4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index bafc3cbae..a440a1f27 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -226,7 +226,8 @@ class Viewer extends React.Component<IViewerProps> {
let annoDocs: Doc[] = [];
let mainAnnoDoc = Docs.CreateInstance(new Doc(), "", {});
- mainAnnoDoc.page = Math.round(Math.random());
+ mainAnnoDoc.title = "Annotation on " + StrCast(this.props.parent.Document.title);
+ mainAnnoDoc.pdfDoc = this.props.parent.Document;
this._savedAnnotations.forEach((key: number, value: HTMLDivElement[]) => {
for (let anno of value) {
let annoDoc = new Doc();
@@ -244,6 +245,7 @@ class Viewer extends React.Component<IViewerProps> {
}
});
+ mainAnnoDoc.y = Math.max((NumCast(annoDocs[0].y) * scale) - 100, 0);
mainAnnoDoc.annotations = new List<Doc>(annoDocs);
if (sourceDoc) {
DocUtils.MakeLink(sourceDoc, mainAnnoDoc, undefined, `Annotation from ${StrCast(this.props.parent.Document.title)}`, "", StrCast(this.props.parent.Document.title));
diff --git a/src/client/views/pdf/Page.tsx b/src/client/views/pdf/Page.tsx
index 01aa96705..57e36be43 100644
--- a/src/client/views/pdf/Page.tsx
+++ b/src/client/views/pdf/Page.tsx
@@ -31,7 +31,7 @@ interface IPageProps {
makePin: (x: number, y: number, page: number) => void;
sendAnnotations: (annotations: HTMLDivElement[], page: number) => void;
createAnnotation: (div: HTMLDivElement, page: number) => void;
- makeAnnotationDocuments: (doc: Doc | undefined, scale: number, color: string) => Doc;
+ makeAnnotationDocuments: (doc: Doc | undefined, scale: number, color: string, linkTo: boolean) => Doc;
getScrollFromPage: (page: number) => number;
}
@@ -137,7 +137,7 @@ export default class Page extends React.Component<IPageProps> {
@action
highlight = (targetDoc?: Doc, color: string = "red") => {
// creates annotation documents for current highlights
- let annotationDoc = this.props.makeAnnotationDocuments(targetDoc, scale, color);
+ let annotationDoc = this.props.makeAnnotationDocuments(targetDoc, scale, color, false);
let targetAnnotations = Cast(this.props.parent.Document.annotations, listSpec(Doc));
if (targetAnnotations === undefined) {
Doc.GetProto(this.props.parent.Document).annotations = new List([annotationDoc]);