From f373fcb35689f0f6e4b69a3f6a3464e3f0934438 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 29 Jun 2023 13:16:10 +0200 Subject: [PATCH] Remove a couple of unused options from the `GrabToPan` constructor These options are completely unused in the PDF.js viewer, and given that the last update of the `GrabToPan`-code from upstream was in 2016 it shouldn't hurt to remove them. --- web/grab_to_pan.js | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/web/grab_to_pan.js b/web/grab_to_pan.js index b3f86d728..c564802b2 100644 --- a/web/grab_to_pan.js +++ b/web/grab_to_pan.js @@ -21,18 +21,10 @@ class GrabToPan { /** * Construct a GrabToPan instance for a given HTML element. * @param {Element} options.element - * @param {function} [options.ignoreTarget] - See `ignoreTarget(node)`. - * @param {function(boolean)} [options.onActiveChanged] - Called when - * grab-to-pan is (de)activated. The first argument is a boolean that - * shows whether grab-to-pan is activated. */ - constructor(options) { - this.element = options.element; - this.document = options.element.ownerDocument; - if (typeof options.ignoreTarget === "function") { - this.ignoreTarget = options.ignoreTarget; - } - this.onActiveChanged = options.onActiveChanged; + constructor({ element }) { + this.element = element; + this.document = element.ownerDocument; // Bind the contexts to ensure that `this` always points to // the GrabToPan instance. @@ -57,8 +49,6 @@ class GrabToPan { this.active = true; this.element.addEventListener("mousedown", this._onMouseDown, true); this.element.classList.add(CSS_CLASS_GRAB); - - this.onActiveChanged?.(true); } } @@ -71,8 +61,6 @@ class GrabToPan { this.element.removeEventListener("mousedown", this._onMouseDown, true); this._endPan(); this.element.classList.remove(CSS_CLASS_GRAB); - - this.onActiveChanged?.(false); } }