diff --git a/README.md b/README.md
index 5ab9e5c1..68af2067 100644
--- a/README.md
+++ b/README.md
@@ -75,7 +75,7 @@ With a script tag:
With a script tag from a CDN:
```html
-
+
```
## Usage
@@ -168,7 +168,7 @@ See this [stackoverflow question](https://stackoverflow.com/questions/70428922/p
#### Defined in
-[panzoom.ts:59](https://github.com/timmywil/panzoom/blob/6ed904e/src/panzoom.ts#L59)
+[panzoom.ts:59](https://github.com/timmywil/panzoom/blob/8205b07/src/panzoom.ts#L59)
## `PanzoomOptions`
@@ -186,7 +186,7 @@ Whether to animate transitions
#### Defined in
-[types.ts:21](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L21)
+[types.ts:21](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L21)
### canvas
@@ -203,7 +203,7 @@ where the `cursor` style is applied (i.e. the parent).
#### Defined in
-[types.ts:32](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L32)
+[types.ts:32](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L32)
### duration
@@ -213,7 +213,7 @@ Duration of the transition (ms)
#### Defined in
-[types.ts:34](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L34)
+[types.ts:34](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L34)
### easing
@@ -223,7 +223,7 @@ CSS Easing used for transitions
#### Defined in
-[types.ts:36](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L36)
+[types.ts:36](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L36)
### exclude
@@ -236,7 +236,7 @@ e.g. links and buttons that should not propagate the click event.
#### Defined in
-[types.ts:43](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L43)
+[types.ts:43](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L43)
### excludeClass
@@ -249,7 +249,7 @@ e.g. links and buttons that should not propagate the click event.
#### Defined in
-[types.ts:50](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L50)
+[types.ts:50](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L50)
### force
@@ -271,7 +271,7 @@ panzoom.zoom(1, { force: true })
#### Defined in
-[types.ts:66](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L66)
+[types.ts:66](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L66)
### handleStartEvent
@@ -315,7 +315,7 @@ Panzoom(elem, {
#### Defined in
-[types.ts:91](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L91)
+[types.ts:91](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L91)
### noBind
@@ -325,7 +325,7 @@ Skip binding the default Panzoom event listeners
#### Defined in
-[types.ts:95](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L95)
+[types.ts:95](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L95)
### origin
@@ -345,7 +345,7 @@ And again, changing this for SVG in IE doesn't work at all.
#### Defined in
-[types.ts:109](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L109)
+[types.ts:109](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L109)
### overflow
@@ -355,7 +355,7 @@ The overflow CSS value for the parent. Defaults to 'hidden'
#### Defined in
-[types.ts:111](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L111)
+[types.ts:111](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L111)
### pinchAndPan
@@ -374,7 +374,7 @@ https://github.com/timmywil/panzoom/issues/606
#### Defined in
-[types.ts:124](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L124)
+[types.ts:124](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L124)
### setTransform
@@ -412,7 +412,7 @@ const panzoom = Panzoom(elem, {
#### Defined in
-[types.ts:128](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L128)
+[types.ts:128](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L128)
### silent
@@ -422,7 +422,7 @@ Silence all events
#### Defined in
-[types.ts:130](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L130)
+[types.ts:130](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L130)
### startScale
@@ -432,7 +432,7 @@ Scale used to set the beginning transform
#### Defined in
-[types.ts:136](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L136)
+[types.ts:136](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L136)
### startX
@@ -442,7 +442,7 @@ X Value used to set the beginning transform
#### Defined in
-[types.ts:132](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L132)
+[types.ts:132](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L132)
### startY
@@ -452,7 +452,7 @@ Y Value used to set the beginning transform
#### Defined in
-[types.ts:134](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L134)
+[types.ts:134](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L134)
### touchAction
@@ -468,7 +468,7 @@ cannot work at the same time.
#### Defined in
-[types.ts:146](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L146)
+[types.ts:146](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L146)
## PanOptions (includes MiscOptions)
@@ -490,7 +490,7 @@ empty space around the element will be shown.
#### Defined in
-[types.ts:165](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L165)
+[types.ts:165](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L165)
### cursor
@@ -500,7 +500,7 @@ The cursor style to set on the panzoom element
#### Defined in
-[types.ts:167](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L167)
+[types.ts:167](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L167)
### disablePan
@@ -512,7 +512,7 @@ The element will still pan accordingly.
#### Defined in
-[types.ts:173](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L173)
+[types.ts:173](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L173)
### disableXAxis
@@ -522,7 +522,7 @@ Pan only on the Y axis
#### Defined in
-[types.ts:175](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L175)
+[types.ts:175](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L175)
### disableYAxis
@@ -532,7 +532,7 @@ Pan only on the X axis
#### Defined in
-[types.ts:177](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L177)
+[types.ts:177](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L177)
### panOnlyWhenZoomed
@@ -542,7 +542,7 @@ Disable panning while the scale is equal to the starting value
#### Defined in
-[types.ts:181](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L181)
+[types.ts:181](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L181)
### relative
@@ -552,7 +552,7 @@ When passing x and y values to .pan(), treat the values as relative to their cur
#### Defined in
-[types.ts:179](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L179)
+[types.ts:179](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L179)
### roundPixels
@@ -567,7 +567,7 @@ zooming in when using this option.
#### Defined in
-[types.ts:190](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L190)
+[types.ts:190](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L190)
## ZoomOptions (includes MiscOptions)
@@ -579,7 +579,7 @@ Disable zooming functionality
#### Defined in
-[types.ts:195](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L195)
+[types.ts:195](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L195)
### focal
@@ -599,7 +599,7 @@ to the parent dimensions.
#### Defined in
-[types.ts:202](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L202)
+[types.ts:202](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L202)
### maxScale
@@ -609,7 +609,7 @@ The maximum scale when zooming
#### Defined in
-[types.ts:206](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L206)
+[types.ts:206](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L206)
### minScale
@@ -619,7 +619,7 @@ The minimum scale when zooming
#### Defined in
-[types.ts:204](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L204)
+[types.ts:204](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L204)
### step
@@ -629,7 +629,7 @@ The step affects zoom calculation when zooming with a mouse wheel, when pinch zo
#### Defined in
-[types.ts:208](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L208)
+[types.ts:208](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L208)
## PanzoomObject
@@ -656,7 +656,7 @@ panzoom.bind()
#### Defined in
-[types.ts:235](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L235)
+[types.ts:235](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L235)
### destroy
@@ -670,7 +670,7 @@ Remove all event listeners bound to the the Panzoom element
#### Defined in
-[types.ts:237](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L237)
+[types.ts:237](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L237)
### eventNames
@@ -690,7 +690,7 @@ Pointer or Touch events.
#### Defined in
-[types.ts:243](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L243)
+[types.ts:243](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L243)
### getOptions
@@ -704,7 +704,7 @@ Returns a _copy_ of the current options object
#### Defined in
-[types.ts:249](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L249)
+[types.ts:249](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L249)
### getPan
@@ -723,7 +723,7 @@ Get the current x/y translation
#### Defined in
-[types.ts:245](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L245)
+[types.ts:245](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L245)
### getScale
@@ -737,7 +737,7 @@ Get the current scale
#### Defined in
-[types.ts:247](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L247)
+[types.ts:247](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L247)
### handleDown
@@ -775,7 +775,7 @@ document.addEventListener('pointerup', panzoom.handleUp)
#### Defined in
-[types.ts:271](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L271)
+[types.ts:271](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L271)
### handleMove
@@ -793,7 +793,7 @@ document.addEventListener('pointerup', panzoom.handleUp)
#### Defined in
-[types.ts:272](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L272)
+[types.ts:272](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L272)
### handleUp
@@ -811,7 +811,7 @@ document.addEventListener('pointerup', panzoom.handleUp)
#### Defined in
-[types.ts:273](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L273)
+[types.ts:273](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L273)
### pan
@@ -840,7 +840,7 @@ panzoom.pan(10, 10, { relative: true })
#### Defined in
-[types.ts:284](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L284)
+[types.ts:284](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L284)
### reset
@@ -869,7 +869,7 @@ panzoom.reset({ animate: false })
#### Defined in
-[types.ts:297](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L297)
+[types.ts:297](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L297)
### resetStyle
@@ -888,7 +888,7 @@ panzoom.resetStyle()
#### Defined in
-[types.ts:306](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L306)
+[types.ts:306](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L306)
### setOptions
@@ -917,7 +917,7 @@ panzoom.setOptions({ cursor: 'default' })
#### Defined in
-[types.ts:319](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L319)
+[types.ts:319](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L319)
### setStyle
@@ -938,7 +938,7 @@ A convenience method for setting prefixed styles on the Panzoom element
#### Defined in
-[types.ts:321](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L321)
+[types.ts:321](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L321)
### zoom
@@ -964,7 +964,7 @@ panzoom.zoom(2.2, { animate: true })
#### Defined in
-[types.ts:330](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L330)
+[types.ts:330](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L330)
### zoomIn
@@ -991,7 +991,7 @@ panzoom.zoomIn({ animate: false })
#### Defined in
-[types.ts:341](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L341)
+[types.ts:341](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L341)
### zoomOut
@@ -1018,7 +1018,7 @@ panzoom.zoomOut({ animate: false })
#### Defined in
-[types.ts:352](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L352)
+[types.ts:352](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L352)
### zoomToPoint
@@ -1049,7 +1049,7 @@ panzoom.zoomToPoint(1.2, pointerEvent)
#### Defined in
-[types.ts:363](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L363)
+[types.ts:363](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L363)
### zoomWithWheel
@@ -1095,7 +1095,7 @@ elem.parentElement.addEventListener('wheel', function (event) {
#### Defined in
-[types.ts:396](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L396)
+[types.ts:396](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L396)
## CurrentValues
@@ -1105,7 +1105,7 @@ elem.parentElement.addEventListener('wheel', function (event) {
#### Defined in
-[types.ts:219](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L219)
+[types.ts:219](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L219)
### scale
@@ -1113,7 +1113,7 @@ elem.parentElement.addEventListener('wheel', function (event) {
#### Defined in
-[types.ts:218](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L218)
+[types.ts:218](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L218)
### x
@@ -1121,7 +1121,7 @@ elem.parentElement.addEventListener('wheel', function (event) {
#### Defined in
-[types.ts:216](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L216)
+[types.ts:216](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L216)
### y
@@ -1129,7 +1129,7 @@ elem.parentElement.addEventListener('wheel', function (event) {
#### Defined in
-[types.ts:217](https://github.com/timmywil/panzoom/blob/6ed904e/src/types.ts#L217)
+[types.ts:217](https://github.com/timmywil/panzoom/blob/8205b07/src/types.ts#L217)
## Events
diff --git a/dist/panzoom.es.js b/dist/panzoom.es.js
new file mode 100644
index 00000000..3194d08d
--- /dev/null
+++ b/dist/panzoom.es.js
@@ -0,0 +1,784 @@
+/**
+* Panzoom for panning and zooming elements using CSS transforms
+* Copyright Timmy Willison and other contributors
+* https://github.com/timmywil/panzoom/blob/main/MIT-License.txt
+*/
+/******************************************************************************
+Copyright (c) Microsoft Corporation.
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+***************************************************************************** */
+
+var __assign = function() {
+ __assign = Object.assign || function __assign(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+};
+
+/* eslint-disable no-var */
+if (typeof window !== 'undefined') {
+ // Support: IE11 only
+ if (window.NodeList && !NodeList.prototype.forEach) {
+ NodeList.prototype.forEach = Array.prototype.forEach;
+ }
+ // Support: IE11 only
+ // CustomEvent is an object instead of a constructor
+ if (typeof window.CustomEvent !== 'function') {
+ window.CustomEvent = function CustomEvent(event, params) {
+ params = params || { bubbles: false, cancelable: false, detail: null };
+ var evt = document.createEvent('CustomEvent');
+ evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
+ return evt
+ };
+ }
+}
+
+/**
+ * Utilites for working with multiple pointer events
+ */
+function findEventIndex(pointers, event) {
+ var i = pointers.length;
+ while (i--) {
+ if (pointers[i].pointerId === event.pointerId) {
+ return i;
+ }
+ }
+ return -1;
+}
+function addPointer(pointers, event) {
+ var i;
+ // Add touches if applicable
+ if (event.touches) {
+ i = 0;
+ for (var _i = 0, _a = event.touches; _i < _a.length; _i++) {
+ var touch = _a[_i];
+ touch.pointerId = i++;
+ addPointer(pointers, touch);
+ }
+ return;
+ }
+ i = findEventIndex(pointers, event);
+ // Update if already present
+ if (i > -1) {
+ pointers.splice(i, 1);
+ }
+ pointers.push(event);
+}
+function removePointer(pointers, event) {
+ // Add touches if applicable
+ if (event.touches) {
+ // Remove all touches
+ while (pointers.length) {
+ pointers.pop();
+ }
+ return;
+ }
+ var i = findEventIndex(pointers, event);
+ if (i > -1) {
+ pointers.splice(i, 1);
+ }
+}
+/**
+ * Calculates a center point between
+ * the given pointer events, for panning
+ * with multiple pointers.
+ */
+function getMiddle(pointers) {
+ // Copy to avoid changing by reference
+ pointers = pointers.slice(0);
+ var event1 = pointers.pop();
+ var event2;
+ while ((event2 = pointers.pop())) {
+ event1 = {
+ clientX: (event2.clientX - event1.clientX) / 2 + event1.clientX,
+ clientY: (event2.clientY - event1.clientY) / 2 + event1.clientY
+ };
+ }
+ return event1;
+}
+/**
+ * Calculates the distance between two points
+ * for pinch zooming.
+ * Limits to the first 2
+ */
+function getDistance(pointers) {
+ if (pointers.length < 2) {
+ return 0;
+ }
+ var event1 = pointers[0];
+ var event2 = pointers[1];
+ return Math.sqrt(Math.pow(Math.abs(event2.clientX - event1.clientX), 2) +
+ Math.pow(Math.abs(event2.clientY - event1.clientY), 2));
+}
+
+var events = {
+ down: 'mousedown',
+ move: 'mousemove',
+ up: 'mouseup mouseleave'
+};
+if (typeof window !== 'undefined') {
+ if (typeof window.PointerEvent === 'function') {
+ events = {
+ down: 'pointerdown',
+ move: 'pointermove',
+ up: 'pointerup pointerleave pointercancel'
+ };
+ }
+ else if (typeof window.TouchEvent === 'function') {
+ events = {
+ down: 'touchstart',
+ move: 'touchmove',
+ up: 'touchend touchcancel'
+ };
+ }
+}
+function onPointer(event, elem, handler, eventOpts) {
+ events[event].split(' ').forEach(function (name) {
+ elem.addEventListener(name, handler, eventOpts);
+ });
+}
+function destroyPointer(event, elem, handler) {
+ events[event].split(' ').forEach(function (name) {
+ elem.removeEventListener(name, handler);
+ });
+}
+
+var isIE = typeof document !== 'undefined' && !!document.documentMode;
+/**
+ * Lazy creation of a CSS style declaration
+ */
+var divStyle;
+function createStyle() {
+ if (divStyle) {
+ return divStyle;
+ }
+ return (divStyle = document.createElement('div').style);
+}
+/**
+ * Proper prefixing for cross-browser compatibility
+ */
+var prefixes = ['webkit', 'moz', 'ms'];
+var prefixCache = {};
+function getPrefixedName(name) {
+ if (prefixCache[name]) {
+ return prefixCache[name];
+ }
+ var divStyle = createStyle();
+ if (name in divStyle) {
+ return (prefixCache[name] = name);
+ }
+ var capName = name[0].toUpperCase() + name.slice(1);
+ var i = prefixes.length;
+ while (i--) {
+ var prefixedName = "".concat(prefixes[i]).concat(capName);
+ if (prefixedName in divStyle) {
+ return (prefixCache[name] = prefixedName);
+ }
+ }
+}
+/**
+ * Gets a style value expected to be a number
+ */
+function getCSSNum(name, style) {
+ return parseFloat(style[getPrefixedName(name)]) || 0;
+}
+function getBoxStyle(elem, name, style) {
+ if (style === void 0) { style = window.getComputedStyle(elem); }
+ // Support: FF 68+
+ // Firefox requires specificity for border
+ var suffix = name === 'border' ? 'Width' : '';
+ return {
+ left: getCSSNum("".concat(name, "Left").concat(suffix), style),
+ right: getCSSNum("".concat(name, "Right").concat(suffix), style),
+ top: getCSSNum("".concat(name, "Top").concat(suffix), style),
+ bottom: getCSSNum("".concat(name, "Bottom").concat(suffix), style)
+ };
+}
+/**
+ * Set a style using the properly prefixed name
+ */
+function setStyle(elem, name, value) {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ elem.style[getPrefixedName(name)] = value;
+}
+/**
+ * Constructs the transition from panzoom options
+ * and takes care of prefixing the transition and transform
+ */
+function setTransition(elem, options) {
+ var transform = getPrefixedName('transform');
+ setStyle(elem, 'transition', "".concat(transform, " ").concat(options.duration, "ms ").concat(options.easing));
+}
+/**
+ * Set the transform using the proper prefix
+ *
+ * Override the transform setter.
+ * This is exposed mostly so the user could
+ * set other parts of a transform
+ * aside from scale and translate.
+ * Default is defined in src/css.ts.
+ *
+ * ```js
+ * // This example always sets a rotation
+ * // when setting the scale and translation
+ * const panzoom = Panzoom(elem, {
+ * setTransform: (elem, { scale, x, y }) => {
+ * panzoom.setStyle('transform', `rotate(0.5turn) scale(${scale}) translate(${x}px, ${y}px)`)
+ * }
+ * })
+ * ```
+ */
+function setTransform(elem, _a, _options) {
+ var x = _a.x, y = _a.y, scale = _a.scale, isSVG = _a.isSVG;
+ setStyle(elem, 'transform', "scale(".concat(scale, ") translate(").concat(x, "px, ").concat(y, "px)"));
+ if (isSVG && isIE) {
+ var matrixValue = window.getComputedStyle(elem).getPropertyValue('transform');
+ elem.setAttribute('transform', matrixValue);
+ }
+}
+/**
+ * Dimensions used in containment and focal point zooming
+ */
+function getDimensions(elem) {
+ var parent = elem.parentNode;
+ var style = window.getComputedStyle(elem);
+ var parentStyle = window.getComputedStyle(parent);
+ var rectElem = elem.getBoundingClientRect();
+ var rectParent = parent.getBoundingClientRect();
+ return {
+ elem: {
+ style: style,
+ width: rectElem.width,
+ height: rectElem.height,
+ top: rectElem.top,
+ bottom: rectElem.bottom,
+ left: rectElem.left,
+ right: rectElem.right,
+ margin: getBoxStyle(elem, 'margin', style),
+ border: getBoxStyle(elem, 'border', style)
+ },
+ parent: {
+ style: parentStyle,
+ width: rectParent.width,
+ height: rectParent.height,
+ top: rectParent.top,
+ bottom: rectParent.bottom,
+ left: rectParent.left,
+ right: rectParent.right,
+ padding: getBoxStyle(parent, 'padding', parentStyle),
+ border: getBoxStyle(parent, 'border', parentStyle)
+ }
+ };
+}
+
+/**
+ * Determine if an element is attached to the DOM
+ * Panzoom requires this so events work properly
+ */
+function isAttached(elem) {
+ var doc = elem.ownerDocument;
+ var parent = elem.parentNode;
+ return (doc &&
+ parent &&
+ doc.nodeType === 9 &&
+ parent.nodeType === 1 &&
+ doc.documentElement.contains(parent));
+}
+
+function getClass(elem) {
+ return (elem.getAttribute('class') || '').trim();
+}
+function hasClass(elem, className) {
+ return elem.nodeType === 1 && " ".concat(getClass(elem), " ").indexOf(" ".concat(className, " ")) > -1;
+}
+function isExcluded(elem, options) {
+ for (var cur = elem; cur != null; cur = cur.parentNode) {
+ if (hasClass(cur, options.excludeClass) || options.exclude.indexOf(cur) > -1) {
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
+ * Determine if an element is SVG by checking the namespace
+ * Exception: the