aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryipstanley <stanley_yip@brown.edu>2019-06-17 10:47:40 -0400
committeryipstanley <stanley_yip@brown.edu>2019-06-17 10:47:40 -0400
commit90c14f3ad8d9e48698c516bc6549143912e19236 (patch)
treed97613a5e069f08175416431cbc5117a275d790e /src
parent0c2e2cfea58cb95fddb2dc344eff29a8b3dcf7fa (diff)
highlights are a different color
Diffstat (limited to 'src')
-rw-r--r--src/client/views/pdf/PDFViewer.tsx5
-rw-r--r--src/client/views/pdf/Page.tsx4
2 files changed, 5 insertions, 4 deletions
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index bc7cfecbb..9becfb419 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -156,7 +156,7 @@ class Viewer extends React.Component<IViewerProps> {
}
}
- makeAnnotationDocument = (sourceDoc: Doc | undefined): Doc => {
+ makeAnnotationDocument = (sourceDoc: Doc | undefined, s: number, color: string): Doc => {
let annoDocs: Doc[] = [];
this._savedAnnotations.forEach((key: number, value: HTMLDivElement[]) => {
for (let anno of value) {
@@ -167,6 +167,7 @@ class Viewer extends React.Component<IViewerProps> {
if (anno.style.width) annoDoc.width = parseInt(anno.style.width) / scale;
annoDoc.page = key;
annoDoc.target = sourceDoc;
+ annoDoc.color = color;
annoDoc.type = AnnotationTypes.Region;
annoDocs.push(annoDoc);
anno.remove();
@@ -624,7 +625,7 @@ class RegionAnnotation extends React.Component<IAnnotationProps> {
render() {
return (
<div className="pdfViewer-annotationBox" onPointerDown={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: this._backgroundColor }}></div>
+ 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>
);
}
} \ No newline at end of file
diff --git a/src/client/views/pdf/Page.tsx b/src/client/views/pdf/Page.tsx
index bd2cae749..e706a0d5c 100644
--- a/src/client/views/pdf/Page.tsx
+++ b/src/client/views/pdf/Page.tsx
@@ -29,7 +29,7 @@ interface IPageProps {
sendAnnotations: (annotations: HTMLDivElement[], page: number) => void;
receiveAnnotations: (page: number) => HTMLDivElement[] | undefined;
createAnnotation: (div: HTMLDivElement, page: number) => void;
- makeAnnotationDocuments: (doc: Doc | undefined, scale: number) => Doc;
+ makeAnnotationDocuments: (doc: Doc | undefined, scale: number, color: string) => Doc;
}
@observer
@@ -135,7 +135,7 @@ export default class Page extends React.Component<IPageProps> {
@action
highlight = (targetDoc?: Doc) => {
// creates annotation documents for current highlights
- let annotationDoc = this.props.makeAnnotationDocuments(targetDoc, scale);
+ let annotationDoc = this.props.makeAnnotationDocuments(targetDoc, scale, "#f4f442");
let targetAnnotations = Cast(this.props.parent.Document.annotations, listSpec(Doc));
if (targetAnnotations === undefined) {
Doc.GetProto(this.props.parent.Document).annotations = new List([annotationDoc]);