From acbe0ced15150d15d81110cd2259b99e942d02e6 Mon Sep 17 00:00:00 2001 From: bob Date: Tue, 6 Aug 2019 18:17:48 -0400 Subject: pdf css cleanup --- src/client/views/pdf/Page.tsx | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'src/client/views/pdf/Page.tsx') diff --git a/src/client/views/pdf/Page.tsx b/src/client/views/pdf/Page.tsx index 1da41bca1..47f2e7b56 100644 --- a/src/client/views/pdf/Page.tsx +++ b/src/client/views/pdf/Page.tsx @@ -8,7 +8,7 @@ import { Docs, DocUtils } from "../../documents/Documents"; import { DragManager } from "../../util/DragManager"; import PDFMenu from "./PDFMenu"; import { scale } from "./PDFViewer"; -import "./PDFViewer.scss"; +import "./Page.scss"; import React = require("react"); @@ -43,7 +43,6 @@ export default class Page extends React.Component { private _canvas: React.RefObject = React.createRef(); private _textLayer: React.RefObject = React.createRef(); - private _annotationLayer: React.RefObject = React.createRef(); private _marquee: React.RefObject = React.createRef(); private _marqueeing: boolean = false; private _reactionDisposer?: IReactionDisposer; @@ -95,7 +94,7 @@ export default class Page extends React.Component { } @action - highlight = (targetDoc?: Doc, color: string = "red") => { + highlight = (targetDoc: Doc | undefined, color: string) => { // creates annotation documents for current highlights let annotationDoc = this.props.makeAnnotationDocuments(targetDoc, scale, color, false); Doc.GetProto(annotationDoc).annotationOn = this.props.Document; @@ -114,7 +113,7 @@ export default class Page extends React.Component { if (this._textLayer.current) { let targetDoc = Docs.Create.TextDocument({ width: 200, height: 200, title: "New Annotation" }); targetDoc.targetPage = this.props.page; - let annotationDoc = this.highlight(undefined, "red"); + let annotationDoc = this.highlight(undefined, "pink"); annotationDoc.linkedToDoc = false; let dragData = new DragManager.AnnotationDragData(this.props.Document, annotationDoc, targetDoc); DragManager.StartAnnotationDrag([ele], dragData, e.pageX, e.pageY, { @@ -196,7 +195,6 @@ export default class Page extends React.Component { this._marqueeX = Math.min(this._startX, this._startX + this._marqueeWidth); this._marqueeY = Math.min(this._startY, this._startY + this._marqueeHeight); this._marqueeWidth = Math.abs(this._marqueeWidth); - this._marquee.current && (this._marquee.current.style.background = "red"); e.stopPropagation(); e.preventDefault(); } @@ -219,10 +217,9 @@ export default class Page extends React.Component { copy.style.height = style.height; // apply the appropriate background, opacity, and transform - copy.style.background = "red"; copy.style.border = style.border; copy.style.opacity = style.opacity; - copy.className = this._marquee.current.className; + copy.className = "pdfPage-annotationBox"; this.props.createAnnotation(copy, this.props.page); this._marquee.current.style.opacity = "0"; } @@ -266,7 +263,7 @@ export default class Page extends React.Component { let rect = clientRects.item(i); if (rect && rect.width !== this._textLayer.current.getBoundingClientRect().width && rect.height !== this._textLayer.current.getBoundingClientRect().height) { let annoBox = document.createElement("div"); - annoBox.className = "pdfViewer-annotationBox"; + annoBox.className = "pdfPage-annotationBox"; // transforms the positions from screen onto the pdf div annoBox.style.top = ((rect.top - boundingRect.top) * (this._textLayer.current.offsetHeight / boundingRect.height)).toString(); annoBox.style.left = ((rect.left - boundingRect.left) * (this._textLayer.current.offsetWidth / boundingRect.width)).toString(); @@ -295,16 +292,23 @@ export default class Page extends React.Component { render() { return ( -
-
+
+
-
-
+
+
-
+
); } -- cgit v1.2.3-70-g09d2