diff --git a/web/pdf_cursor_tools.js b/web/pdf_cursor_tools.js index 2bba8520a..416122b13 100644 --- a/web/pdf_cursor_tools.js +++ b/web/pdf_cursor_tools.js @@ -13,8 +13,8 @@ * limitations under the License. */ +import { AnnotationEditorType, shadow } from "pdfjs-lib"; import { CursorTool, PresentationModeState } from "./ui_utils.js"; -import { AnnotationEditorType } from "pdfjs-lib"; import { GrabToPan } from "./grab_to_pan.js"; /** @@ -38,10 +38,6 @@ class PDFCursorTools { this.container = container; this.eventBus = eventBus; - this.handTool = new GrabToPan({ - element: this.container, - }); - this.#addEventListeners(); // Defer the initial `switchTool` call, to give other viewer components @@ -76,7 +72,7 @@ class PDFCursorTools { case CursorTool.SELECT: break; case CursorTool.HAND: - this.handTool.deactivate(); + this._handTool.deactivate(); break; case CursorTool.ZOOM: /* falls through */ @@ -90,7 +86,7 @@ class PDFCursorTools { break; case CursorTool.HAND: disableActiveTool(); - this.handTool.activate(); + this._handTool.activate(); break; case CursorTool.ZOOM: /* falls through */ @@ -164,6 +160,19 @@ class PDFCursorTools { } }); } + + /** + * @private + */ + get _handTool() { + return shadow( + this, + "_handTool", + new GrabToPan({ + element: this.container, + }) + ); + } } export { PDFCursorTools };