From 320f18503439c7e490f259ed2ed7355ff72b4237 Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 9 Sep 2020 13:07:33 -0400 Subject: fixed unpnning pdf annotations. remvoed unused UI from PDFmenu --- src/client/views/pdf/Annotation.tsx | 11 ++++++----- src/client/views/pdf/PDFMenu.tsx | 12 ++++++------ src/client/views/pdf/PDFViewer.tsx | 15 ++++++++++++--- 3 files changed, 24 insertions(+), 14 deletions(-) (limited to 'src/client/views/pdf') diff --git a/src/client/views/pdf/Annotation.tsx b/src/client/views/pdf/Annotation.tsx index 222a6cb0f..5ec564e7b 100644 --- a/src/client/views/pdf/Annotation.tsx +++ b/src/client/views/pdf/Annotation.tsx @@ -12,7 +12,7 @@ import "./Annotation.scss"; interface IAnnotationProps { anno: Doc; addDocTab: (document: Doc, where: string) => boolean; - pinToPres: (document: Doc) => void; + pinToPres: (document: Doc, unpin?: boolean) => void; focus: (doc: Doc) => void; dataDoc: Doc; fieldKey: string; @@ -22,8 +22,8 @@ interface IAnnotationProps { export class Annotation extends React.Component { render() { - return DocListCast(this.props.anno.annotations).map(a => ( - )); + return DocListCast(this.props.anno.annotations).map(a => + ); } } @@ -33,7 +33,7 @@ interface IRegionAnnotationProps { width: number; height: number; addDocTab: (document: Doc, where: string) => boolean; - pinToPres: (document: Doc) => void; + pinToPres: (document: Doc, unpin: boolean) => void; document: Doc; dataDoc: Doc; fieldKey: string; @@ -82,7 +82,8 @@ class RegionAnnotation extends React.Component { pinToPres = () => { const group = FieldValue(Cast(this.props.document.group, Doc)); - group && this.props.pinToPres(group); + const isPinned = group && Doc.isDocPinned(group) ? true : false; + group && this.props.pinToPres(group, isPinned); } @action diff --git a/src/client/views/pdf/PDFMenu.tsx b/src/client/views/pdf/PDFMenu.tsx index 32dd376ac..c5ed75980 100644 --- a/src/client/views/pdf/PDFMenu.tsx +++ b/src/client/views/pdf/PDFMenu.tsx @@ -161,12 +161,12 @@ export class PDFMenu extends AntimodeMenu { , , -
- - -
, - , + //
+ // + // + //
, + // , ]; return this.getElement(buttons); diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index 8afb041b9..03ccca019 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -72,7 +72,7 @@ interface IViewerProps { active: (outsideReaction?: boolean) => boolean; isChildActive: (outsideReaction?: boolean) => boolean; addDocTab: (document: Doc, where: string) => boolean; - pinToPres: (document: Doc) => void; + pinToPres: (document: Doc, unpin?: boolean) => void; addDocument?: (doc: Doc) => boolean; setPdfViewer: (view: PDFViewer) => void; ScreenToLocalTransform: () => Transform; @@ -224,7 +224,11 @@ export class PDFViewer extends ViewBoxAnnotatableComponent Cast(this.layoutDoc._scrollTop, "number", null), - (stop) => (stop !== undefined && this.layoutDoc._scrollY === undefined && this._mainCont.current) && (this._mainCont.current.scrollTop = stop), + (stop) => { + if (stop !== undefined && this.layoutDoc._scrollY === undefined && this._mainCont.current) { + (this._mainCont.current.scrollTop = stop); + } + }, { fireImmediately: true }); this._disposers.filterScript = reaction( @@ -362,10 +366,15 @@ export class PDFViewer extends ViewBoxAnnotatableComponent) => { this.Document._scrollY === undefined && (this.layoutDoc._scrollTop = this._mainCont.current!.scrollTop); - this._pdfViewer && (this.Document._curPage = this._pdfViewer.currentPageNumber); + this.pageDelay && clearTimeout(this.pageDelay); + this.pageDelay = setTimeout(() => { + this.pageDelay = undefined; + this._pdfViewer && (this.Document._curPage = this._pdfViewer.currentPageNumber); + }, 250); } // get the page index that the vertical offset passed in is on -- cgit v1.2.3-70-g09d2