From 9d9e7593a0ece66d3538ea5986de3388a0759ad7 Mon Sep 17 00:00:00 2001 From: bobzel Date: Mon, 28 Sep 2020 13:00:55 -0400 Subject: fixed filtering annotation anchors on PDFs. added tooltip for identifying who made an annotation. --- src/client/views/pdf/Annotation.scss | 10 ++++++++++ src/client/views/pdf/Annotation.tsx | 13 +++++++++---- src/client/views/pdf/PDFViewer.tsx | 7 +++++-- 3 files changed, 24 insertions(+), 6 deletions(-) (limited to 'src/client/views/pdf') diff --git a/src/client/views/pdf/Annotation.scss b/src/client/views/pdf/Annotation.scss index cc326eb93..d42a0b478 100644 --- a/src/client/views/pdf/Annotation.scss +++ b/src/client/views/pdf/Annotation.scss @@ -3,4 +3,14 @@ user-select: none; position: absolute; background-color: rgba(146, 245, 95, 0.467); + transition: opacity 0.5s; + .pdfAnnotation-info { + top: -17px; + pointer-events: none; + width: max-content; + height: 20px; + position: relative; + background: #8080804a; + border-radius: 5px; + } } \ No newline at end of file diff --git a/src/client/views/pdf/Annotation.tsx b/src/client/views/pdf/Annotation.tsx index f680a00df..33c7bd4f3 100644 --- a/src/client/views/pdf/Annotation.tsx +++ b/src/client/views/pdf/Annotation.tsx @@ -1,7 +1,7 @@ import React = require("react"); import { action, IReactionDisposer, observable, reaction, runInAction } from "mobx"; import { observer } from "mobx-react"; -import { Doc, DocListCast, HeightSym, WidthSym } from "../../../fields/Doc"; +import { Doc, DocListCast, HeightSym, WidthSym, Field } from "../../../fields/Doc"; import { Id } from "../../../fields/FieldSymbols"; import { List } from "../../../fields/List"; import { Cast, FieldValue, BoolCast, NumCast, StrCast, PromiseValue } from "../../../fields/Types"; @@ -9,6 +9,7 @@ import { DocumentManager } from "../../util/DocumentManager"; import { PDFMenu } from "./PDFMenu"; import "./Annotation.scss"; import { undoBatch } from "../../util/UndoManager"; +import { useIsFocusVisible } from "@material-ui/core"; interface IAnnotationProps { anno: Doc; @@ -128,8 +129,9 @@ class RegionAnnotation extends React.Component { return false; } + @observable _showInfo = false; render() { - return (
this._showInfo = true)} onPointerLeave={action(() => this._showInfo = false)} onPointerDown={this.onPointerDown} ref={this._mainCont} style={{ top: this.props.y, left: this.props.x, @@ -137,7 +139,10 @@ class RegionAnnotation extends React.Component { height: this.props.height, opacity: this._brushed ? 0.5 : undefined, backgroundColor: this._brushed ? "orange" : StrCast(this.props.document.backgroundColor), - transition: "opacity 0.5s", - }} />); + }} > + {!this._showInfo ? (null) :
+ {this.props.dataDoc.author + " " + Field.toString(this.props.dataDoc.creationDate as Field)} +
} +
); } } \ No newline at end of file diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index caa22b58a..6784540cd 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -61,6 +61,8 @@ interface IViewerProps { DataDoc?: Doc; searchFilterDocs: () => Doc[]; ContainingCollectionView: Opt; + docFilters: () => string[]; + docRangeFilters: () => string[]; PanelWidth: () => number; PanelHeight: () => number; ContentScaling: () => number; @@ -118,8 +120,7 @@ export class PDFViewer extends ViewBoxAnnotatableComponent this._script.run({ this: anno }, console.log, true).result); + return DocUtils.FilterDocs(DocListCast(this.dataDoc[this.props.fieldKey + "-annotations"]), this.props.docFilters(), this.props.docRangeFilters(), undefined); } @computed get nonDocAnnotations() { return this.allAnnotations.filter(a => a.annotations); } @@ -718,6 +719,8 @@ export class PDFViewer extends ViewBoxAnnotatableComponent