From 6290c9147b4aead8b0253aa958f086752b397a4f Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Mon, 19 Sep 2022 12:47:17 -0400
Subject: if same youtube video is uploaded, reuse the existing file without
 downloading again.  removed failed uploads from parsed_files.  change
 pinWithView to highlight the pinned view region.  Give pinWithView
 collections an option to just pan or zoom to % of screen size.

---
 src/client/views/pdf/PDFViewer.tsx | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'src/client/views/pdf/PDFViewer.tsx')

diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index 53d969c0a..5925c0392 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -64,6 +64,7 @@ export class PDFViewer extends React.Component<IViewerProps> {
     private _styleRule: any; // stylesheet rule for making hyperlinks clickable
     private _retries = 0; // number of times tried to create the PDF viewer
     private _setPreviewCursor: undefined | ((x: number, y: number, drag: boolean, hide: boolean) => void);
+    private _setBrushViewer: undefined | ((view: { width: number; height: number; panX: number; panY: number }) => void);
     private _annotationLayer: React.RefObject<HTMLDivElement> = React.createRef();
     private _disposers: { [name: string]: IReactionDisposer } = {};
     private _viewer: React.RefObject<HTMLDivElement> = React.createRef();
@@ -174,9 +175,8 @@ export class PDFViewer extends React.Component<IViewerProps> {
         }
         return focusSpeed;
     };
-    crop = (region: Doc | undefined, addCrop?: boolean) => {
-        return this.props.crop(region, addCrop);
-    };
+    crop = (region: Doc | undefined, addCrop?: boolean) => this.props.crop(region, addCrop);
+    brushView = (view: { width: number; height: number; panX: number; panY: number }) => this._setBrushViewer?.(view);
 
     @action
     setupPdfJsViewer = async () => {
@@ -446,6 +446,7 @@ export class PDFViewer extends React.Component<IViewerProps> {
     };
 
     setPreviewCursor = (func?: (x: number, y: number, drag: boolean, hide: boolean) => void) => (this._setPreviewCursor = func);
+    setBrushViewer = (func?: (view: { width: number; height: number; panX: number; panY: number }) => void) => (this._setBrushViewer = func);
 
     @action
     onZoomWheel = (e: React.WheelEvent) => {
@@ -512,6 +513,7 @@ export class PDFViewer extends React.Component<IViewerProps> {
                 fieldKey={this.props.fieldKey + '-annotations'}
                 CollectionView={undefined}
                 setPreviewCursor={this.setPreviewCursor}
+                setBrushViewer={this.setBrushViewer}
                 PanelHeight={this.panelHeight}
                 PanelWidth={this.panelWidth}
                 ScreenToLocalTransform={this.overlayTransform}
-- 
cgit v1.2.3-70-g09d2


From 87096243391cf172c26190897c79321b3d42817c Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Mon, 19 Sep 2022 20:50:30 -0400
Subject: fixed searching in pdfs by updating to pdfjs's new findController api

---
 src/client/views/pdf/PDFViewer.tsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/client/views/pdf/PDFViewer.tsx')

diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index 5925c0392..5c10c7cef 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -325,13 +325,13 @@ export class PDFViewer extends React.Component<IViewerProps> {
             query: searchString,
         };
         if (clear) {
-            this._pdfViewer?.findController.executeCommand('reset', { query: '' });
+            this._pdfViewer?.eventBus.dispatch('reset', {});
         } else if (!searchString) {
             bwd ? this.prevAnnotation() : this.nextAnnotation();
         } else if (this._pdfViewer?.pageViewsReady) {
-            this._pdfViewer.findController.executeCommand('findagain', findOpts);
+            this._pdfViewer?.eventBus.dispatch('find', { ...findOpts, type: 'again' });
         } else if (this._mainCont.current) {
-            const executeFind = () => this._pdfViewer.findController.executeCommand('find', findOpts);
+            const executeFind = () => this._pdfViewer?.eventBus.dispatch('find', findOpts);
             this._mainCont.current.addEventListener('pagesloaded', executeFind);
             this._mainCont.current.addEventListener('pagerendered', executeFind);
         }
-- 
cgit v1.2.3-70-g09d2

