diff options
| author | Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> | 2020-07-30 21:14:34 +0800 |
|---|---|---|
| committer | Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> | 2020-07-30 21:14:34 +0800 |
| commit | 02bd861e780c650367c6caf1dfe85b16e03c318b (patch) | |
| tree | e5a08e23721dbbac729c7b32d64d60c569aa0bf3 /src/client/views/pdf/PDFViewer.tsx | |
| parent | b1a7c8c965ff93eca4c002f51cf67df4b8ad21ba (diff) | |
| parent | c25e942ea7b015ef163ebb772c268479cc976234 (diff) | |
Merge branch 'master' into presentation_updates
Diffstat (limited to 'src/client/views/pdf/PDFViewer.tsx')
| -rw-r--r-- | src/client/views/pdf/PDFViewer.tsx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index 5b73b00d3..d1010de48 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -351,7 +351,7 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu @action scrollToAnnotation = (scrollToAnnotation: Doc) => { if (scrollToAnnotation) { - const offset = this.visibleHeight() / 2 * 96 / 72; + const offset = this.visibleHeight() / 2; this._mainCont.current && smoothScroll(500, this._mainCont.current, NumCast(scrollToAnnotation.y) - offset); Doc.linkFollowHighlight(scrollToAnnotation); } @@ -526,7 +526,7 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu if (this._marqueeing) { if (this._marqueeWidth > 10 || this._marqueeHeight > 10) { const marquees = this._mainCont.current!.getElementsByClassName("pdfViewerDash-dragAnnotationBox"); - if (marquees && marquees.length) { // copy the marquee and convert it to a permanent annotation. + if (marquees?.length) { // copy the marquee and convert it to a permanent annotation. const style = (marquees[0] as HTMLDivElement).style; const copy = document.createElement("div"); copy.style.left = style.left; @@ -549,7 +549,7 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu } else { const sel = window.getSelection(); - if (sel && sel.type === "Range") { + if (sel?.type === "Range") { const selRange = sel.getRangeAt(0); this.createTextAnnotation(sel, selRange); PDFMenu.Instance.jumpTo(e.clientX, e.clientY); @@ -710,7 +710,7 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu marqueeX = () => this._marqueeX; marqueeY = () => this._marqueeY; marqueeing = () => this._marqueeing; - visibleHeight = () => this.props.PanelHeight() / this.props.ContentScaling() * 72 / 96; + visibleHeight = () => this.props.PanelHeight() / this.props.ContentScaling(); contentZoom = () => this._zoomed; render() { TraceMobx(); @@ -731,7 +731,7 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu } } -interface PdfViewerMarqueeProps { +export interface PdfViewerMarqueeProps { isMarqueeing: () => boolean; width: () => number; height: () => number; @@ -740,7 +740,7 @@ interface PdfViewerMarqueeProps { } @observer -class PdfViewerMarquee extends React.Component<PdfViewerMarqueeProps> { +export class PdfViewerMarquee extends React.Component<PdfViewerMarqueeProps> { render() { return !this.props.isMarqueeing() ? (null) : <div className="pdfViewerDash-dragAnnotationBox" style={{ |
