From 913055f1b6f8eac88eda2ba08715c9cc3b013f08 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Tue, 6 Aug 2019 23:54:39 -0400 Subject: pdf tweaks. --- src/client/views/pdf/Annotation.tsx | 39 +++++++++++++------------------------ src/client/views/pdf/Page.tsx | 8 ++------ 2 files changed, 15 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/client/views/pdf/Annotation.tsx b/src/client/views/pdf/Annotation.tsx index 947f5a2e8..2610f6c6e 100644 --- a/src/client/views/pdf/Annotation.tsx +++ b/src/client/views/pdf/Annotation.tsx @@ -9,7 +9,7 @@ import { DocumentManager } from "../../util/DocumentManager"; import { PresentationView } from "../presentationview/PresentationView"; import PDFMenu from "./PDFMenu"; import "./Annotation.scss"; -import { AnnotationTypes, scale } from "./PDFViewer"; +import { scale } from "./PDFViewer"; interface IAnnotationProps { anno: Doc; @@ -22,17 +22,8 @@ interface IAnnotationProps { export default class Annotation extends React.Component { render() { - let annotationDocs = DocListCast(this.props.anno.annotations); - let res = annotationDocs.map(a => { - let type = NumCast(a.type); - switch (type) { - case AnnotationTypes.Region: - return ; - default: - return
; - } - }); - return res; + return DocListCast(this.props.anno.annotations).map(a => ( + )); } } @@ -51,8 +42,6 @@ interface IRegionAnnotationProps { @observer class RegionAnnotation extends React.Component { - @observable private _backgroundColor: string = "red"; - private _reactionDisposer?: IReactionDisposer; private _scrollDisposer?: IReactionDisposer; private _mainCont: React.RefObject = React.createRef(); @@ -60,13 +49,13 @@ class RegionAnnotation extends React.Component { componentDidMount() { this._reactionDisposer = reaction( () => this.props.document.delete, - () => this.props.document.delete && this._mainCont.current && (this._mainCont.current.style.display = "none"), + (del) => del && this._mainCont.current && (this._mainCont.current.style.display = "none"), { fireImmediately: true } ); this._scrollDisposer = reaction( () => this.props.ParentIndex(), - () => this.props.ParentIndex() === this.props.index && this.props.scrollTo && this.props.scrollTo(this.props.y * scale) + (ind) => ind === this.props.index && this.props.scrollTo && this.props.scrollTo(this.props.y * scale) ); } @@ -129,15 +118,13 @@ class RegionAnnotation extends React.Component { } render() { - return ( -
- ); + return (
); } } \ No newline at end of file diff --git a/src/client/views/pdf/Page.tsx b/src/client/views/pdf/Page.tsx index fd4fbfb21..a1f807f13 100644 --- a/src/client/views/pdf/Page.tsx +++ b/src/client/views/pdf/Page.tsx @@ -198,16 +198,13 @@ export default class Page extends React.Component { onSelectEnd = (e: PointerEvent): void => { if (this._marqueeing) { this._marqueeing = false; - if (this._marquee.current) { + if (this._marquee.current) { // make a copy of the marquee let copy = document.createElement("div"); - // make a copy of the marquee let style = this._marquee.current.style; copy.style.left = style.left; copy.style.top = style.top; copy.style.width = style.width; copy.style.height = style.height; - - // apply the appropriate background, opacity, and transform copy.style.border = style.border; copy.style.opacity = style.opacity; copy.className = "pdfPage-annotationBox"; @@ -293,7 +290,6 @@ export default class Page extends React.Component { }}>
-
- ); +
); } } \ No newline at end of file -- cgit v1.2.3-70-g09d2