@zoompinch/react 0.0.4 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -62,6 +62,10 @@ function App() {
62
62
  maxScale={4}
63
63
  clampBounds={false}
64
64
  rotation={true}
65
+ zoomSpeed={1}
66
+ translateSpeed={1}
67
+ zoomSpeedAppleTrackpad={1}
68
+ translateSpeedAppleTrackpad={1}
65
69
  mouse={true}
66
70
  wheel={true}
67
71
  touch={true}
@@ -131,6 +135,36 @@ export default App;
131
135
 
132
136
  **Note:** `minScale`, `maxScale`, `rotation`, and `clampBounds` only apply during user interaction. Programmatic changes via ref methods are unrestricted.
133
137
 
138
+ ### Speed Multipliers
139
+
140
+ #### The Problem
141
+ Pan and zoom interactions behave differently across input devices:
142
+ - **Apple Trackpads**: Provide smooth, precise scroll values with natural momentum
143
+ - **Mouse Wheels**: Send large, discrete jumps (typically ±100 or ±120 per scroll tick)
144
+
145
+ Without normalization, this causes:
146
+ - Uncomfortably large zoom jumps when using mouse wheels
147
+ - Panning that's either too slow (trackpad-optimized) or too fast (mouse-optimized)
148
+ - Inconsistent user experience across Windows, Mac, and Linux
149
+
150
+ #### The Solution
151
+ The library automatically detects the input device type and applies different speed multipliers:
152
+ - **Trackpad gestures** use base values for smooth, 1:1 response
153
+ - **Mouse wheel actions** use amplified values for comfortable discrete steps
154
+
155
+ You can fine-tune these multipliers for your specific use case using the speed props.
156
+
157
+ | Prop | Type | Default | Description |
158
+ |------|------|---------|-------------|
159
+ | `translateSpeed` | `number` | `1` | Pan speed multiplier for mouse wheels |
160
+ | `zoomSpeed` | `number` | `1` | Zoom speed multiplier for mouse wheels |
161
+ | `translateSpeedAppleTrackpad` | `number` | `1` | Pan speed multiplier for trackpads |
162
+ | `zoomSpeedAppleTrackpad` | `number` | `1` | Zoom speed multiplier for trackpads |
163
+
164
+
165
+ **Note:** `min-scale`, `max-scale`, `rotation`, and `clamp-bounds` only apply during user interaction. Programmatic changes via ref methods are unrestricted.
166
+
167
+
134
168
  ### Events
135
169
 
136
170
  | Event | Payload | Description |
@@ -1,6 +1,6 @@
1
- import te, { forwardRef as ne, useRef as F, useState as ae, useImperativeHandle as oe, useEffect as E } from "react";
2
- import { Zoompinch as ue } from "@zoompinch/core";
3
- var I = { exports: {} }, M = {};
1
+ import te, { forwardRef as ne, useRef as G, useState as ae, useImperativeHandle as ue, useEffect as f } from "react";
2
+ import { Zoompinch as oe } from "@zoompinch/core";
3
+ var U = { exports: {} }, W = {};
4
4
  /**
5
5
  * @license React
6
6
  * react-jsx-runtime.production.js
@@ -11,28 +11,28 @@ var I = { exports: {} }, M = {};
11
11
  * LICENSE file in the root directory of this source tree.
12
12
  */
13
13
  var Q;
14
- function se() {
15
- if (Q) return M;
14
+ function ce() {
15
+ if (Q) return W;
16
16
  Q = 1;
17
- var a = Symbol.for("react.transitional.element"), m = Symbol.for("react.fragment");
18
- function l(d, s, c) {
19
- var i = null;
20
- if (c !== void 0 && (i = "" + c), s.key !== void 0 && (i = "" + s.key), "key" in s) {
21
- c = {};
22
- for (var p in s)
23
- p !== "key" && (c[p] = s[p]);
24
- } else c = s;
25
- return s = c.ref, {
26
- $$typeof: a,
27
- type: d,
28
- key: i,
17
+ var u = Symbol.for("react.transitional.element"), R = Symbol.for("react.fragment");
18
+ function h(p, s, i) {
19
+ var v = null;
20
+ if (i !== void 0 && (v = "" + i), s.key !== void 0 && (v = "" + s.key), "key" in s) {
21
+ i = {};
22
+ for (var w in s)
23
+ w !== "key" && (i[w] = s[w]);
24
+ } else i = s;
25
+ return s = i.ref, {
26
+ $$typeof: u,
27
+ type: p,
28
+ key: v,
29
29
  ref: s !== void 0 ? s : null,
30
- props: c
30
+ props: i
31
31
  };
32
32
  }
33
- return M.Fragment = m, M.jsx = l, M.jsxs = l, M;
33
+ return W.Fragment = R, W.jsx = h, W.jsxs = h, W;
34
34
  }
35
- var W = {};
35
+ var $ = {};
36
36
  /**
37
37
  * @license React
38
38
  * react-jsx-runtime.development.js
@@ -43,125 +43,125 @@ var W = {};
43
43
  * LICENSE file in the root directory of this source tree.
44
44
  */
45
45
  var K;
46
- function ce() {
46
+ function se() {
47
47
  return K || (K = 1, process.env.NODE_ENV !== "production" && (function() {
48
- function a(e) {
48
+ function u(e) {
49
49
  if (e == null) return null;
50
50
  if (typeof e == "function")
51
- return e.$$typeof === X ? null : e.displayName || e.name || null;
51
+ return e.$$typeof === l ? null : e.displayName || e.name || null;
52
52
  if (typeof e == "string") return e;
53
53
  switch (e) {
54
- case O:
54
+ case A:
55
55
  return "Fragment";
56
- case H:
56
+ case F:
57
57
  return "Profiler";
58
- case U:
58
+ case X:
59
59
  return "StrictMode";
60
- case t:
60
+ case J:
61
61
  return "Suspense";
62
- case f:
62
+ case V:
63
63
  return "SuspenseList";
64
- case x:
64
+ case r:
65
65
  return "Activity";
66
66
  }
67
67
  if (typeof e == "object")
68
68
  switch (typeof e.tag == "number" && console.error(
69
69
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
70
70
  ), e.$$typeof) {
71
- case G:
71
+ case j:
72
72
  return "Portal";
73
- case J:
73
+ case H:
74
74
  return e.displayName || "Context";
75
- case q:
75
+ case z:
76
76
  return (e._context.displayName || "Context") + ".Consumer";
77
+ case q:
78
+ var n = e.render;
79
+ return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
80
+ case Z:
81
+ return n = e.displayName || null, n !== null ? n : u(e.type) || "Memo";
77
82
  case _:
78
- var r = e.render;
79
- return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
80
- case v:
81
- return r = e.displayName || null, r !== null ? r : a(e.type) || "Memo";
82
- case A:
83
- r = e._payload, e = e._init;
83
+ n = e._payload, e = e._init;
84
84
  try {
85
- return a(e(r));
85
+ return u(e(n));
86
86
  } catch {
87
87
  }
88
88
  }
89
89
  return null;
90
90
  }
91
- function m(e) {
91
+ function R(e) {
92
92
  return "" + e;
93
93
  }
94
- function l(e) {
94
+ function h(e) {
95
95
  try {
96
- m(e);
97
- var r = !1;
96
+ R(e);
97
+ var n = !1;
98
98
  } catch {
99
- r = !0;
99
+ n = !0;
100
100
  }
101
- if (r) {
102
- r = console;
103
- var n = r.error, o = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
104
- return n.call(
105
- r,
101
+ if (n) {
102
+ n = console;
103
+ var o = n.error, c = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
104
+ return o.call(
105
+ n,
106
106
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
107
- o
108
- ), m(e);
107
+ c
108
+ ), R(e);
109
109
  }
110
110
  }
111
- function d(e) {
112
- if (e === O) return "<>";
113
- if (typeof e == "object" && e !== null && e.$$typeof === A)
111
+ function p(e) {
112
+ if (e === A) return "<>";
113
+ if (typeof e == "object" && e !== null && e.$$typeof === _)
114
114
  return "<...>";
115
115
  try {
116
- var r = a(e);
117
- return r ? "<" + r + ">" : "<...>";
116
+ var n = u(e);
117
+ return n ? "<" + n + ">" : "<...>";
118
118
  } catch {
119
119
  return "<...>";
120
120
  }
121
121
  }
122
122
  function s() {
123
- var e = g.A;
123
+ var e = d.A;
124
124
  return e === null ? null : e.getOwner();
125
125
  }
126
- function c() {
126
+ function i() {
127
127
  return Error("react-stack-top-frame");
128
128
  }
129
- function i(e) {
130
- if (S.call(e, "key")) {
131
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
132
- if (r && r.isReactWarning) return !1;
129
+ function v(e) {
130
+ if (I.call(e, "key")) {
131
+ var n = Object.getOwnPropertyDescriptor(e, "key").get;
132
+ if (n && n.isReactWarning) return !1;
133
133
  }
134
134
  return e.key !== void 0;
135
135
  }
136
- function p(e, r) {
137
- function n() {
138
- j || (j = !0, console.error(
136
+ function w(e, n) {
137
+ function o() {
138
+ N || (N = !0, console.error(
139
139
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
140
- r
140
+ n
141
141
  ));
142
142
  }
143
- n.isReactWarning = !0, Object.defineProperty(e, "key", {
144
- get: n,
143
+ o.isReactWarning = !0, Object.defineProperty(e, "key", {
144
+ get: o,
145
145
  configurable: !0
146
146
  });
147
147
  }
148
- function w() {
149
- var e = a(this.type);
150
- return L[e] || (L[e] = !0, console.error(
148
+ function y() {
149
+ var e = u(this.type);
150
+ return C[e] || (C[e] = !0, console.error(
151
151
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
152
152
  )), e = this.props.ref, e !== void 0 ? e : null;
153
153
  }
154
- function T(e, r, n, o, R, V) {
155
- var u = n.ref;
154
+ function k(e, n, o, c, P, t) {
155
+ var a = o.ref;
156
156
  return e = {
157
- $$typeof: y,
157
+ $$typeof: D,
158
158
  type: e,
159
- key: r,
160
- props: n,
161
- _owner: o
162
- }, (u !== void 0 ? u : null) !== null ? Object.defineProperty(e, "ref", {
159
+ key: n,
160
+ props: o,
161
+ _owner: c
162
+ }, (a !== void 0 ? a : null) !== null ? Object.defineProperty(e, "ref", {
163
163
  enumerable: !1,
164
- get: w
164
+ get: y
165
165
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
166
166
  configurable: !1,
167
167
  enumerable: !1,
@@ -176,228 +176,240 @@ function ce() {
176
176
  configurable: !1,
177
177
  enumerable: !1,
178
178
  writable: !0,
179
- value: R
179
+ value: P
180
180
  }), Object.defineProperty(e, "_debugTask", {
181
181
  configurable: !1,
182
182
  enumerable: !1,
183
183
  writable: !0,
184
- value: V
184
+ value: t
185
185
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
186
186
  }
187
- function $(e, r, n, o, R, V) {
188
- var u = r.children;
189
- if (u !== void 0)
190
- if (o)
191
- if (z(u)) {
192
- for (o = 0; o < u.length; o++)
193
- b(u[o]);
194
- Object.freeze && Object.freeze(u);
187
+ function b(e, n, o, c, P, t) {
188
+ var a = n.children;
189
+ if (a !== void 0)
190
+ if (c)
191
+ if (L(a)) {
192
+ for (c = 0; c < a.length; c++)
193
+ T(a[c]);
194
+ Object.freeze && Object.freeze(a);
195
195
  } else
196
196
  console.error(
197
197
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
198
198
  );
199
- else b(u);
200
- if (S.call(r, "key")) {
201
- u = a(e);
202
- var k = Object.keys(r).filter(function(re) {
199
+ else T(a);
200
+ if (I.call(n, "key")) {
201
+ a = u(e);
202
+ var E = Object.keys(n).filter(function(re) {
203
203
  return re !== "key";
204
204
  });
205
- o = 0 < k.length ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}", Y[u + o] || (k = 0 < k.length ? "{" + k.join(": ..., ") + ": ...}" : "{}", console.error(
205
+ c = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", M[a + c] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
206
206
  `A props object containing a "key" prop is being spread into JSX:
207
207
  let props = %s;
208
208
  <%s {...props} />
209
209
  React keys must be passed directly to JSX without using spread:
210
210
  let props = %s;
211
211
  <%s key={someKey} {...props} />`,
212
- o,
213
- u,
214
- k,
215
- u
216
- ), Y[u + o] = !0);
212
+ c,
213
+ a,
214
+ E,
215
+ a
216
+ ), M[a + c] = !0);
217
217
  }
218
- if (u = null, n !== void 0 && (l(n), u = "" + n), i(r) && (l(r.key), u = "" + r.key), "key" in r) {
219
- n = {};
220
- for (var Z in r)
221
- Z !== "key" && (n[Z] = r[Z]);
222
- } else n = r;
223
- return u && p(
224
- n,
218
+ if (a = null, o !== void 0 && (h(o), a = "" + o), v(n) && (h(n.key), a = "" + n.key), "key" in n) {
219
+ o = {};
220
+ for (var x in n)
221
+ x !== "key" && (o[x] = n[x]);
222
+ } else o = n;
223
+ return a && w(
224
+ o,
225
225
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
226
- ), T(
226
+ ), k(
227
227
  e,
228
- u,
229
- n,
228
+ a,
229
+ o,
230
230
  s(),
231
- R,
232
- V
231
+ P,
232
+ t
233
233
  );
234
234
  }
235
- function b(e) {
236
- D(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === A && (e._payload.status === "fulfilled" ? D(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
235
+ function T(e) {
236
+ g(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === _ && (e._payload.status === "fulfilled" ? g(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
237
237
  }
238
- function D(e) {
239
- return typeof e == "object" && e !== null && e.$$typeof === y;
238
+ function g(e) {
239
+ return typeof e == "object" && e !== null && e.$$typeof === D;
240
240
  }
241
- var h = te, y = Symbol.for("react.transitional.element"), G = Symbol.for("react.portal"), O = Symbol.for("react.fragment"), U = Symbol.for("react.strict_mode"), H = Symbol.for("react.profiler"), q = Symbol.for("react.consumer"), J = Symbol.for("react.context"), _ = Symbol.for("react.forward_ref"), t = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), A = Symbol.for("react.lazy"), x = Symbol.for("react.activity"), X = Symbol.for("react.client.reference"), g = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, S = Object.prototype.hasOwnProperty, z = Array.isArray, P = console.createTask ? console.createTask : function() {
241
+ var m = te, D = Symbol.for("react.transitional.element"), j = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), X = Symbol.for("react.strict_mode"), F = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), H = Symbol.for("react.context"), q = Symbol.for("react.forward_ref"), J = Symbol.for("react.suspense"), V = Symbol.for("react.suspense_list"), Z = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), r = Symbol.for("react.activity"), l = Symbol.for("react.client.reference"), d = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, I = Object.prototype.hasOwnProperty, L = Array.isArray, O = console.createTask ? console.createTask : function() {
242
242
  return null;
243
243
  };
244
- h = {
244
+ m = {
245
245
  react_stack_bottom_frame: function(e) {
246
246
  return e();
247
247
  }
248
248
  };
249
- var j, L = {}, N = h.react_stack_bottom_frame.bind(
250
- h,
251
- c
252
- )(), C = P(d(c)), Y = {};
253
- W.Fragment = O, W.jsx = function(e, r, n) {
254
- var o = 1e4 > g.recentlyCreatedOwnerStacks++;
255
- return $(
249
+ var N, C = {}, Y = m.react_stack_bottom_frame.bind(
250
+ m,
251
+ i
252
+ )(), S = O(p(i)), M = {};
253
+ $.Fragment = A, $.jsx = function(e, n, o) {
254
+ var c = 1e4 > d.recentlyCreatedOwnerStacks++;
255
+ return b(
256
256
  e,
257
- r,
258
257
  n,
258
+ o,
259
259
  !1,
260
- o ? Error("react-stack-top-frame") : N,
261
- o ? P(d(e)) : C
260
+ c ? Error("react-stack-top-frame") : Y,
261
+ c ? O(p(e)) : S
262
262
  );
263
- }, W.jsxs = function(e, r, n) {
264
- var o = 1e4 > g.recentlyCreatedOwnerStacks++;
265
- return $(
263
+ }, $.jsxs = function(e, n, o) {
264
+ var c = 1e4 > d.recentlyCreatedOwnerStacks++;
265
+ return b(
266
266
  e,
267
- r,
268
267
  n,
268
+ o,
269
269
  !0,
270
- o ? Error("react-stack-top-frame") : N,
271
- o ? P(d(e)) : C
270
+ c ? Error("react-stack-top-frame") : Y,
271
+ c ? O(p(e)) : S
272
272
  );
273
273
  };
274
- })()), W;
274
+ })()), $;
275
275
  }
276
276
  var ee;
277
277
  function ie() {
278
- return ee || (ee = 1, process.env.NODE_ENV === "production" ? I.exports = se() : I.exports = ce()), I.exports;
278
+ return ee || (ee = 1, process.env.NODE_ENV === "production" ? U.exports = ce() : U.exports = se()), U.exports;
279
279
  }
280
280
  var B = ie();
281
281
  const le = ne(({
282
- transform: a = { translateX: 0, translateY: 0, scale: 1, rotate: 0 },
283
- offset: m = { left: 0, top: 0, right: 0, bottom: 0 },
284
- minScale: l = 0.5,
285
- maxScale: d = 10,
282
+ transform: u = { translateX: 0, translateY: 0, scale: 1, rotate: 0 },
283
+ offset: R = { left: 0, top: 0, right: 0, bottom: 0 },
284
+ minScale: h = 0.5,
285
+ maxScale: p = 10,
286
286
  clampBounds: s = !1,
287
- rotation: c = !0,
288
- mouse: i = !0,
289
- wheel: p = !0,
290
- touch: w = !0,
291
- gesture: T = !0,
292
- children: $,
293
- matrix: b,
294
- style: D,
295
- onTransformChange: h,
296
- onInit: y,
297
- onClick: G,
298
- onMouseDown: O,
299
- onTouchStart: U,
300
- onMouseup: H,
301
- onTouchend: q
302
- }, J) => {
303
- const _ = F(null), t = F(null), f = F(!1), [v, A] = ae({
304
- composePoint: (r, n) => [0, 0],
287
+ rotation: i = !0,
288
+ mouse: v = !0,
289
+ wheel: w = !0,
290
+ touch: y = !0,
291
+ gesture: k = !0,
292
+ zoomSpeed: b,
293
+ translateSpeed: T,
294
+ zoomSpeedAppleTrackpad: g,
295
+ translateSpeedAppleTrackpad: m,
296
+ children: D,
297
+ matrix: j,
298
+ style: A,
299
+ onTransformChange: X,
300
+ onInit: F,
301
+ onClick: z,
302
+ onMouseDown: H,
303
+ onTouchStart: q,
304
+ onMouseup: J,
305
+ onTouchend: V
306
+ }, Z) => {
307
+ const _ = G(null), r = G(null), l = G(!1), [d, I] = ae({
308
+ composePoint: (t, a) => [0, 0],
305
309
  canvasWidth: 0,
306
310
  canvasHeight: 0
307
- }), x = F((r, n) => t.current ? t.current.normalizeClientCoords(r, n) : [0, 0]);
308
- oe(J, () => ({
309
- applyTransform: (r, n, o, R) => {
310
- t.current && (R !== void 0 && (t.current.rotate = R), t.current.applyTransform(r, n, o));
311
+ }), L = G((t, a) => r.current ? r.current.normalizeClientCoords(t, a) : [0, 0]);
312
+ ue(Z, () => ({
313
+ applyTransform: (t, a, E, x) => {
314
+ r.current && (x !== void 0 && (r.current.rotate = x), r.current.applyTransform(t, a, E));
311
315
  },
312
- composePoint: (r, n) => v.composePoint ? v.composePoint(r, n) : [0, 0],
313
- normalizeClientCoords: (r, n) => x.current ? x.current(r, n) : [0, 0],
314
- rotateCanvas: (r, n, o) => {
315
- t.current && t.current.rotateCanvas(r, n, o);
316
+ composePoint: (t, a) => d.composePoint ? d.composePoint(t, a) : [0, 0],
317
+ normalizeClientCoords: (t, a) => L.current ? L.current(t, a) : [0, 0],
318
+ rotateCanvas: (t, a, E) => {
319
+ r.current && r.current.rotateCanvas(t, a, E);
316
320
  },
317
- zoompinchEngine: t.current,
318
- canvasWidth: v.canvasWidth,
319
- canvasHeight: v.canvasHeight
321
+ zoompinchEngine: r.current,
322
+ canvasWidth: d.canvasWidth,
323
+ canvasHeight: d.canvasHeight
320
324
  }));
321
- function X() {
322
- var r, n;
323
- t.current && A({
324
- composePoint: t.current.composePoint.bind(t.current),
325
- canvasWidth: ((r = t.current.canvasBounds) == null ? void 0 : r.width) ?? 0,
326
- canvasHeight: ((n = t.current.canvasBounds) == null ? void 0 : n.height) ?? 0
325
+ function O() {
326
+ var t, a;
327
+ r.current && I({
328
+ composePoint: r.current.composePoint.bind(r.current),
329
+ canvasWidth: ((t = r.current.canvasBounds) == null ? void 0 : t.width) ?? 0,
330
+ canvasHeight: ((a = r.current.canvasBounds) == null ? void 0 : a.height) ?? 0
327
331
  });
328
332
  }
329
- E(() => {
330
- !_.current || t.current || (t.current = new ue(_.current, m, a.translateX, a.translateY, a.scale, a.rotate, l, d, s, c), console.log("Zoompinch initialisiert mit Props!"), t.current.addEventListener("update", () => {
331
- if (!t.current) return;
332
- const r = {
333
- translateX: t.current.translateX,
334
- translateY: t.current.translateY,
335
- scale: t.current.scale,
336
- rotate: t.current.rotate
333
+ f(() => {
334
+ !_.current || r.current || (r.current = new oe(_.current, R, u.translateX, u.translateY, u.scale, u.rotate, h, p, s, i), b !== void 0 && (r.current.zoomSpeed = b), T !== void 0 && (r.current.translateSpeed = T), g !== void 0 && (r.current.zoomSpeedAppleTrackpad = g), m !== void 0 && (r.current.translateSpeedAppleTrackpad = m), r.current.addEventListener("update", () => {
335
+ if (!r.current) return;
336
+ const t = {
337
+ translateX: r.current.translateX,
338
+ translateY: r.current.translateY,
339
+ scale: r.current.scale,
340
+ rotate: r.current.rotate
337
341
  };
338
- h && (r.translateX !== a.translateX || r.translateY !== a.translateY || r.scale !== a.scale || r.rotate !== a.rotate) && h(r), X();
339
- }), t.current.addEventListener("load", () => {
340
- t.current && (f.current = !0, y && y(), X());
342
+ X && (t.translateX !== u.translateX || t.translateY !== u.translateY || t.scale !== u.scale || t.rotate !== u.rotate) && X(t), O();
343
+ }), r.current.addEventListener("load", () => {
344
+ r.current && (l.current = !0, F && F(), O());
341
345
  }));
342
- }, []), E(() => {
343
- !t.current || !f.current || (t.current.translateX !== a.translateX || t.current.translateY !== a.translateY || t.current.scale !== a.scale || t.current.rotate !== a.rotate) && (t.current.translateX = a.translateX, t.current.translateY = a.translateY, t.current.scale = a.scale, t.current.rotate = a.rotate, t.current.update());
344
- }, [a]), E(() => {
345
- !t.current || !f.current || (t.current.offset = m, t.current.update());
346
- }, [m]), E(() => {
347
- !t.current || !f.current || (t.current.minScale = l, t.current.update());
348
- }, [l]), E(() => {
349
- !t.current || !f.current || (t.current.maxScale = d, t.current.update());
350
- }, [d]), E(() => {
351
- !t.current || !f.current || (t.current.clampBounds = s, t.current.setTranslateFromUserGesture(t.current.translateX, t.current.translateY), t.current.update());
352
- }, [s]), E(() => {
353
- !t.current || !f.current || (t.current.rotation = c, t.current.update());
354
- }, [c]);
355
- const g = (r) => {
356
- !t.current || !p || (r.preventDefault(), t.current.handleWheel(r));
357
- }, S = (r) => {
358
- !t.current || !T || t.current.handleGesturestart(r);
359
- }, z = (r) => {
360
- !t.current || !T || t.current.handleGesturechange(r);
361
- }, P = (r) => {
362
- !t.current || !T || t.current.handleGestureend(r);
363
- }, j = (r) => {
364
- !t.current || !i || t.current.handleMousedown(r);
365
- }, L = (r) => {
366
- !t.current || !i || t.current.handleMousemove(r);
367
- }, N = (r) => {
368
- !t.current || !i || t.current.handleMouseup(r);
369
- }, C = (r) => {
370
- !t.current || !w || t.current.handleTouchstart(r);
371
- }, Y = (r) => {
372
- !t.current || !w || t.current.handleTouchmove(r);
373
- }, e = (r) => {
374
- !t.current || !w || t.current.handleTouchend(r);
346
+ }, []), f(() => {
347
+ !r.current || !l.current || (r.current.translateX !== u.translateX || r.current.translateY !== u.translateY || r.current.scale !== u.scale || r.current.rotate !== u.rotate) && (r.current.translateX = u.translateX, r.current.translateY = u.translateY, r.current.scale = u.scale, r.current.rotate = u.rotate, r.current.update());
348
+ }, [u]), f(() => {
349
+ !r.current || !l.current || (r.current.offset = R, r.current.update());
350
+ }, [R]), f(() => {
351
+ !r.current || !l.current || (r.current.minScale = h, r.current.update());
352
+ }, [h]), f(() => {
353
+ !r.current || !l.current || (r.current.maxScale = p, r.current.update());
354
+ }, [p]), f(() => {
355
+ !r.current || !l.current || (r.current.clampBounds = s, r.current.setTranslateFromUserGesture(r.current.translateX, r.current.translateY), r.current.update());
356
+ }, [s]), f(() => {
357
+ !r.current || !l.current || (r.current.rotation = i, r.current.update());
358
+ }, [i]), f(() => {
359
+ !r.current || !l.current || b !== void 0 && (r.current.zoomSpeed = b);
360
+ }, [b]), f(() => {
361
+ !r.current || !l.current || T !== void 0 && (r.current.translateSpeed = T);
362
+ }, [T]), f(() => {
363
+ !r.current || !l.current || g !== void 0 && (r.current.zoomSpeedAppleTrackpad = g);
364
+ }, [g]), f(() => {
365
+ !r.current || !l.current || m !== void 0 && (r.current.translateSpeedAppleTrackpad = m);
366
+ }, [m]);
367
+ const N = (t) => {
368
+ !r.current || !w || (t.preventDefault(), r.current.handleWheel(t));
369
+ }, C = (t) => {
370
+ !r.current || !k || r.current.handleGesturestart(t);
371
+ }, Y = (t) => {
372
+ !r.current || !k || r.current.handleGesturechange(t);
373
+ }, S = (t) => {
374
+ !r.current || !k || r.current.handleGestureend(t);
375
+ }, M = (t) => {
376
+ !r.current || !v || r.current.handleMousedown(t);
377
+ }, e = (t) => {
378
+ !r.current || !v || r.current.handleMousemove(t);
379
+ }, n = (t) => {
380
+ !r.current || !v || r.current.handleMouseup(t);
381
+ }, o = (t) => {
382
+ !r.current || !y || r.current.handleTouchstart(t);
383
+ }, c = (t) => {
384
+ !r.current || !y || r.current.handleTouchmove(t);
385
+ }, P = (t) => {
386
+ !r.current || !y || r.current.handleTouchend(t);
375
387
  };
376
- return E(() => {
388
+ return f(() => {
377
389
  if (!_.current) return;
378
- const r = _.current;
379
- return window.addEventListener("gesturechange", z), window.addEventListener("gestureend", P), window.addEventListener("mousemove", L), window.addEventListener("mouseup", N), window.addEventListener("touchmove", Y), window.addEventListener("touchend", e), r.addEventListener("wheel", g, { passive: !1 }), r.addEventListener("gesturestart", S, { passive: !1 }), r.addEventListener("mousedown", j, { passive: !1 }), r.addEventListener("touchstart", C, { passive: !1 }), () => {
380
- window.removeEventListener("gesturechange", z), window.removeEventListener("gestureend", P), window.removeEventListener("mousemove", L), window.removeEventListener("mouseup", N), window.removeEventListener("touchmove", Y), window.removeEventListener("touchend", e), r.removeEventListener("wheel", g), r.removeEventListener("gesturestart", S), r.removeEventListener("mousedown", j), r.removeEventListener("touchstart", C);
390
+ const t = _.current;
391
+ return window.addEventListener("gesturechange", Y), window.addEventListener("gestureend", S), window.addEventListener("mousemove", e), window.addEventListener("mouseup", n), window.addEventListener("touchmove", c), window.addEventListener("touchend", P), t.addEventListener("wheel", N, { passive: !1 }), t.addEventListener("gesturestart", C, { passive: !1 }), t.addEventListener("mousedown", M, { passive: !1 }), t.addEventListener("touchstart", o, { passive: !1 }), () => {
392
+ window.removeEventListener("gesturechange", Y), window.removeEventListener("gestureend", S), window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", n), window.removeEventListener("touchmove", c), window.removeEventListener("touchend", P), t.removeEventListener("wheel", N), t.removeEventListener("gesturestart", C), t.removeEventListener("mousedown", M), t.removeEventListener("touchstart", o);
381
393
  };
382
- }, [i, w, T, p]), /* @__PURE__ */ B.jsxs(
394
+ }, [v, y, k, w]), /* @__PURE__ */ B.jsxs(
383
395
  "div",
384
396
  {
385
397
  ref: _,
386
398
  className: "zoompinch",
387
- style: D,
388
- onClick: G,
389
- onMouseDown: O,
390
- onTouchStart: U,
391
- onMouseUp: H,
392
- onTouchEnd: q,
399
+ style: A,
400
+ onClick: z,
401
+ onMouseDown: H,
402
+ onTouchStart: q,
403
+ onMouseUp: J,
404
+ onTouchEnd: V,
393
405
  children: [
394
- /* @__PURE__ */ B.jsx("div", { className: "canvas", children: $ }),
395
- /* @__PURE__ */ B.jsx("div", { className: "matrix", children: typeof b == "function" ? b({
396
- composePoint: v.composePoint,
397
- normalizeClientCoords: x.current,
398
- canvasWidth: v.canvasWidth,
399
- canvasHeight: v.canvasHeight
400
- }) : b })
406
+ /* @__PURE__ */ B.jsx("div", { className: "canvas", children: D }),
407
+ /* @__PURE__ */ B.jsx("div", { className: "matrix", children: typeof j == "function" ? j({
408
+ composePoint: d.composePoint,
409
+ normalizeClientCoords: L.current,
410
+ canvasWidth: d.canvasWidth,
411
+ canvasHeight: d.canvasHeight
412
+ }) : j })
401
413
  ]
402
414
  }
403
415
  );
@@ -1,4 +1,4 @@
1
- (function(p,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react"),require("@zoompinch/core")):typeof define=="function"&&define.amd?define(["exports","react","@zoompinch/core"],u):(p=typeof globalThis<"u"?globalThis:p||self,u(p.ZoompinchReact={},p.React,p.ZoompinchCore))})(this,(function(p,u,te){"use strict";var D={exports:{}},O={};/**
1
+ (function(_,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react"),require("@zoompinch/core")):typeof define=="function"&&define.amd?define(["exports","react","@zoompinch/core"],c):(_=typeof globalThis<"u"?globalThis:_||self,c(_.ZoompinchReact={},_.React,_.ZoompinchCore))})(this,(function(_,c,te){"use strict";var F={exports:{}},A={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var q;function ne(){if(q)return O;q=1;var a=Symbol.for("react.transitional.element"),E=Symbol.for("react.fragment");function f(d,c,i){var l=null;if(i!==void 0&&(l=""+i),c.key!==void 0&&(l=""+c.key),"key"in c){i={};for(var h in c)h!=="key"&&(i[h]=c[h])}else i=c;return c=i.ref,{$$typeof:a,type:d,key:l,ref:c!==void 0?c:null,props:i}}return O.Fragment=E,O.jsx=f,O.jsxs=f,O}var x={};/**
9
+ */var q;function ne(){if(q)return A;q=1;var o=Symbol.for("react.transitional.element"),w=Symbol.for("react.fragment");function h(p,i,l){var v=null;if(l!==void 0&&(v=""+l),i.key!==void 0&&(v=""+i.key),"key"in i){l={};for(var T in i)T!=="key"&&(l[T]=i[T])}else l=i;return i=l.ref,{$$typeof:o,type:p,key:v,ref:i!==void 0?i:null,props:l}}return A.Fragment=w,A.jsx=h,A.jsxs=h,A}var C={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,9 +14,9 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var $;function ae(){return $||($=1,process.env.NODE_ENV!=="production"&&(function(){function a(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===I?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case J:return"Profiler";case Z:return"StrictMode";case t:return"Suspense";case v:return"SuspenseList";case C:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case H:return"Portal";case B:return e.displayName||"Context";case V:return(e._context.displayName||"Context")+".Consumer";case _:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case m:return r=e.displayName||null,r!==null?r:a(e.type)||"Memo";case j:r=e._payload,e=e._init;try{return a(e(r))}catch{}}return null}function E(e){return""+e}function f(e){try{E(e);var r=!1}catch{r=!0}if(r){r=console;var n=r.error,o=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),E(e)}}function d(e){if(e===S)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===j)return"<...>";try{var r=a(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function c(){var e=P.A;return e===null?null:e.getOwner()}function i(){return Error("react-stack-top-frame")}function l(e){if(L.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function h(e,r){function n(){N||(N=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function w(){var e=a(this.type);return Y[e]||(Y[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function b(e,r,n,o,T,Q){var s=n.ref;return e={$$typeof:A,type:e,key:r,props:n,_owner:o},(s!==void 0?s:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:w}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:T}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function X(e,r,n,o,T,Q){var s=r.children;if(s!==void 0)if(o)if(G(s)){for(o=0;o<s.length;o++)g(s[o]);Object.freeze&&Object.freeze(s)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else g(s);if(L.call(r,"key")){s=a(e);var k=Object.keys(r).filter(function(ue){return ue!=="key"});o=0<k.length?"{key: someKey, "+k.join(": ..., ")+": ...}":"{key: someKey}",z[s+o]||(k=0<k.length?"{"+k.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var $;function ae(){return $||($=1,process.env.NODE_ENV!=="production"&&(function(){function o(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===f?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case N:return"Fragment";case G:return"Profiler";case z:return"StrictMode";case B:return"Suspense";case Q:return"SuspenseList";case r:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case L:return"Portal";case V:return e.displayName||"Context";case J:return(e._context.displayName||"Context")+".Consumer";case Z:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case K:return n=e.displayName||null,n!==null?n:o(e.type)||"Memo";case R:n=e._payload,e=e._init;try{return o(e(n))}catch{}}return null}function w(e){return""+e}function h(e){try{w(e);var n=!1}catch{n=!0}if(n){n=console;var u=n.error,s=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return u.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",s),w(e)}}function p(e){if(e===N)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===R)return"<...>";try{var n=o(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function i(){var e=d.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function v(e){if(U.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function T(e,n){function u(){Y||(Y=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",n))}u.isReactWarning=!0,Object.defineProperty(e,"key",{get:u,configurable:!0})}function O(){var e=o(this.type);return M[e]||(M[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function k(e,n,u,s,P,t){var a=u.ref;return e={$$typeof:I,type:e,key:n,props:u,_owner:s},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:O}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:P}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:t}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function b(e,n,u,s,P,t){var a=n.children;if(a!==void 0)if(s)if(S(a)){for(s=0;s<a.length;s++)g(a[s]);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else g(a);if(U.call(n,"key")){a=o(e);var E=Object.keys(n).filter(function(ue){return ue!=="key"});s=0<E.length?"{key: someKey, "+E.join(": ..., ")+": ...}":"{key: someKey}",X[a+s]||(E=0<E.length?"{"+E.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,o,s,k,s),z[s+o]=!0)}if(s=null,n!==void 0&&(f(n),s=""+n),l(r)&&(f(r.key),s=""+r.key),"key"in r){n={};for(var K in r)K!=="key"&&(n[K]=r[K])}else n=r;return s&&h(n,typeof e=="function"?e.displayName||e.name||"Unknown":e),b(e,s,n,c(),T,Q)}function g(e){F(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===j&&(e._payload.status==="fulfilled"?F(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function F(e){return typeof e=="object"&&e!==null&&e.$$typeof===A}var R=u,A=Symbol.for("react.transitional.element"),H=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),Z=Symbol.for("react.strict_mode"),J=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),B=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),t=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),C=Symbol.for("react.activity"),I=Symbol.for("react.client.reference"),P=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=Object.prototype.hasOwnProperty,G=Array.isArray,y=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(e){return e()}};var N,Y={},M=R.react_stack_bottom_frame.bind(R,i)(),W=y(d(i)),z={};x.Fragment=S,x.jsx=function(e,r,n){var o=1e4>P.recentlyCreatedOwnerStacks++;return X(e,r,n,!1,o?Error("react-stack-top-frame"):M,o?y(d(e)):W)},x.jsxs=function(e,r,n){var o=1e4>P.recentlyCreatedOwnerStacks++;return X(e,r,n,!0,o?Error("react-stack-top-frame"):M,o?y(d(e)):W)}})()),x}var ee;function oe(){return ee||(ee=1,process.env.NODE_ENV==="production"?D.exports=ne():D.exports=ae()),D.exports}var U=oe();const re=u.forwardRef(({transform:a={translateX:0,translateY:0,scale:1,rotate:0},offset:E={left:0,top:0,right:0,bottom:0},minScale:f=.5,maxScale:d=10,clampBounds:c=!1,rotation:i=!0,mouse:l=!0,wheel:h=!0,touch:w=!0,gesture:b=!0,children:X,matrix:g,style:F,onTransformChange:R,onInit:A,onClick:H,onMouseDown:S,onTouchStart:Z,onMouseup:J,onTouchend:V},B)=>{const _=u.useRef(null),t=u.useRef(null),v=u.useRef(!1),[m,j]=u.useState({composePoint:(r,n)=>[0,0],canvasWidth:0,canvasHeight:0}),C=u.useRef((r,n)=>t.current?t.current.normalizeClientCoords(r,n):[0,0]);u.useImperativeHandle(B,()=>({applyTransform:(r,n,o,T)=>{t.current&&(T!==void 0&&(t.current.rotate=T),t.current.applyTransform(r,n,o))},composePoint:(r,n)=>m.composePoint?m.composePoint(r,n):[0,0],normalizeClientCoords:(r,n)=>C.current?C.current(r,n):[0,0],rotateCanvas:(r,n,o)=>{t.current&&t.current.rotateCanvas(r,n,o)},zoompinchEngine:t.current,canvasWidth:m.canvasWidth,canvasHeight:m.canvasHeight}));function I(){var r,n;t.current&&j({composePoint:t.current.composePoint.bind(t.current),canvasWidth:((r=t.current.canvasBounds)==null?void 0:r.width)??0,canvasHeight:((n=t.current.canvasBounds)==null?void 0:n.height)??0})}u.useEffect(()=>{!_.current||t.current||(t.current=new te.Zoompinch(_.current,E,a.translateX,a.translateY,a.scale,a.rotate,f,d,c,i),console.log("Zoompinch initialisiert mit Props!"),t.current.addEventListener("update",()=>{if(!t.current)return;const r={translateX:t.current.translateX,translateY:t.current.translateY,scale:t.current.scale,rotate:t.current.rotate};R&&(r.translateX!==a.translateX||r.translateY!==a.translateY||r.scale!==a.scale||r.rotate!==a.rotate)&&R(r),I()}),t.current.addEventListener("load",()=>{t.current&&(v.current=!0,A&&A(),I())}))},[]),u.useEffect(()=>{!t.current||!v.current||(t.current.translateX!==a.translateX||t.current.translateY!==a.translateY||t.current.scale!==a.scale||t.current.rotate!==a.rotate)&&(t.current.translateX=a.translateX,t.current.translateY=a.translateY,t.current.scale=a.scale,t.current.rotate=a.rotate,t.current.update())},[a]),u.useEffect(()=>{!t.current||!v.current||(t.current.offset=E,t.current.update())},[E]),u.useEffect(()=>{!t.current||!v.current||(t.current.minScale=f,t.current.update())},[f]),u.useEffect(()=>{!t.current||!v.current||(t.current.maxScale=d,t.current.update())},[d]),u.useEffect(()=>{!t.current||!v.current||(t.current.clampBounds=c,t.current.setTranslateFromUserGesture(t.current.translateX,t.current.translateY),t.current.update())},[c]),u.useEffect(()=>{!t.current||!v.current||(t.current.rotation=i,t.current.update())},[i]);const P=r=>{!t.current||!h||(r.preventDefault(),t.current.handleWheel(r))},L=r=>{!t.current||!b||t.current.handleGesturestart(r)},G=r=>{!t.current||!b||t.current.handleGesturechange(r)},y=r=>{!t.current||!b||t.current.handleGestureend(r)},N=r=>{!t.current||!l||t.current.handleMousedown(r)},Y=r=>{!t.current||!l||t.current.handleMousemove(r)},M=r=>{!t.current||!l||t.current.handleMouseup(r)},W=r=>{!t.current||!w||t.current.handleTouchstart(r)},z=r=>{!t.current||!w||t.current.handleTouchmove(r)},e=r=>{!t.current||!w||t.current.handleTouchend(r)};return u.useEffect(()=>{if(!_.current)return;const r=_.current;return window.addEventListener("gesturechange",G),window.addEventListener("gestureend",y),window.addEventListener("mousemove",Y),window.addEventListener("mouseup",M),window.addEventListener("touchmove",z),window.addEventListener("touchend",e),r.addEventListener("wheel",P,{passive:!1}),r.addEventListener("gesturestart",L,{passive:!1}),r.addEventListener("mousedown",N,{passive:!1}),r.addEventListener("touchstart",W,{passive:!1}),()=>{window.removeEventListener("gesturechange",G),window.removeEventListener("gestureend",y),window.removeEventListener("mousemove",Y),window.removeEventListener("mouseup",M),window.removeEventListener("touchmove",z),window.removeEventListener("touchend",e),r.removeEventListener("wheel",P),r.removeEventListener("gesturestart",L),r.removeEventListener("mousedown",N),r.removeEventListener("touchstart",W)}},[l,w,b,h]),U.jsxs("div",{ref:_,className:"zoompinch",style:F,onClick:H,onMouseDown:S,onTouchStart:Z,onMouseUp:J,onTouchEnd:V,children:[U.jsx("div",{className:"canvas",children:X}),U.jsx("div",{className:"matrix",children:typeof g=="function"?g({composePoint:m.composePoint,normalizeClientCoords:C.current,canvasWidth:m.canvasWidth,canvasHeight:m.canvasHeight}):g})]})});re.displayName="Zoompinch",p.Zoompinch=re,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
22
+ <%s key={someKey} {...props} />`,s,a,E,a),X[a+s]=!0)}if(a=null,u!==void 0&&(h(u),a=""+u),v(n)&&(h(n.key),a=""+n.key),"key"in n){u={};for(var j in n)j!=="key"&&(u[j]=n[j])}else u=n;return a&&T(u,typeof e=="function"?e.displayName||e.name||"Unknown":e),k(e,a,u,i(),P,t)}function g(e){y(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===R&&(e._payload.status==="fulfilled"?y(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function y(e){return typeof e=="object"&&e!==null&&e.$$typeof===I}var m=c,I=Symbol.for("react.transitional.element"),L=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),G=Symbol.for("react.profiler"),J=Symbol.for("react.consumer"),V=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),Q=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),r=Symbol.for("react.activity"),f=Symbol.for("react.client.reference"),d=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,S=Array.isArray,x=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var Y,M={},W=m.react_stack_bottom_frame.bind(m,l)(),D=x(p(l)),X={};C.Fragment=N,C.jsx=function(e,n,u){var s=1e4>d.recentlyCreatedOwnerStacks++;return b(e,n,u,!1,s?Error("react-stack-top-frame"):W,s?x(p(e)):D)},C.jsxs=function(e,n,u){var s=1e4>d.recentlyCreatedOwnerStacks++;return b(e,n,u,!0,s?Error("react-stack-top-frame"):W,s?x(p(e)):D)}})()),C}var ee;function oe(){return ee||(ee=1,process.env.NODE_ENV==="production"?F.exports=ne():F.exports=ae()),F.exports}var H=oe();const re=c.forwardRef(({transform:o={translateX:0,translateY:0,scale:1,rotate:0},offset:w={left:0,top:0,right:0,bottom:0},minScale:h=.5,maxScale:p=10,clampBounds:i=!1,rotation:l=!0,mouse:v=!0,wheel:T=!0,touch:O=!0,gesture:k=!0,zoomSpeed:b,translateSpeed:g,zoomSpeedAppleTrackpad:y,translateSpeedAppleTrackpad:m,children:I,matrix:L,style:N,onTransformChange:z,onInit:G,onClick:J,onMouseDown:V,onTouchStart:Z,onMouseup:B,onTouchend:Q},K)=>{const R=c.useRef(null),r=c.useRef(null),f=c.useRef(!1),[d,U]=c.useState({composePoint:(t,a)=>[0,0],canvasWidth:0,canvasHeight:0}),S=c.useRef((t,a)=>r.current?r.current.normalizeClientCoords(t,a):[0,0]);c.useImperativeHandle(K,()=>({applyTransform:(t,a,E,j)=>{r.current&&(j!==void 0&&(r.current.rotate=j),r.current.applyTransform(t,a,E))},composePoint:(t,a)=>d.composePoint?d.composePoint(t,a):[0,0],normalizeClientCoords:(t,a)=>S.current?S.current(t,a):[0,0],rotateCanvas:(t,a,E)=>{r.current&&r.current.rotateCanvas(t,a,E)},zoompinchEngine:r.current,canvasWidth:d.canvasWidth,canvasHeight:d.canvasHeight}));function x(){var t,a;r.current&&U({composePoint:r.current.composePoint.bind(r.current),canvasWidth:((t=r.current.canvasBounds)==null?void 0:t.width)??0,canvasHeight:((a=r.current.canvasBounds)==null?void 0:a.height)??0})}c.useEffect(()=>{!R.current||r.current||(r.current=new te.Zoompinch(R.current,w,o.translateX,o.translateY,o.scale,o.rotate,h,p,i,l),b!==void 0&&(r.current.zoomSpeed=b),g!==void 0&&(r.current.translateSpeed=g),y!==void 0&&(r.current.zoomSpeedAppleTrackpad=y),m!==void 0&&(r.current.translateSpeedAppleTrackpad=m),r.current.addEventListener("update",()=>{if(!r.current)return;const t={translateX:r.current.translateX,translateY:r.current.translateY,scale:r.current.scale,rotate:r.current.rotate};z&&(t.translateX!==o.translateX||t.translateY!==o.translateY||t.scale!==o.scale||t.rotate!==o.rotate)&&z(t),x()}),r.current.addEventListener("load",()=>{r.current&&(f.current=!0,G&&G(),x())}))},[]),c.useEffect(()=>{!r.current||!f.current||(r.current.translateX!==o.translateX||r.current.translateY!==o.translateY||r.current.scale!==o.scale||r.current.rotate!==o.rotate)&&(r.current.translateX=o.translateX,r.current.translateY=o.translateY,r.current.scale=o.scale,r.current.rotate=o.rotate,r.current.update())},[o]),c.useEffect(()=>{!r.current||!f.current||(r.current.offset=w,r.current.update())},[w]),c.useEffect(()=>{!r.current||!f.current||(r.current.minScale=h,r.current.update())},[h]),c.useEffect(()=>{!r.current||!f.current||(r.current.maxScale=p,r.current.update())},[p]),c.useEffect(()=>{!r.current||!f.current||(r.current.clampBounds=i,r.current.setTranslateFromUserGesture(r.current.translateX,r.current.translateY),r.current.update())},[i]),c.useEffect(()=>{!r.current||!f.current||(r.current.rotation=l,r.current.update())},[l]),c.useEffect(()=>{!r.current||!f.current||b!==void 0&&(r.current.zoomSpeed=b)},[b]),c.useEffect(()=>{!r.current||!f.current||g!==void 0&&(r.current.translateSpeed=g)},[g]),c.useEffect(()=>{!r.current||!f.current||y!==void 0&&(r.current.zoomSpeedAppleTrackpad=y)},[y]),c.useEffect(()=>{!r.current||!f.current||m!==void 0&&(r.current.translateSpeedAppleTrackpad=m)},[m]);const Y=t=>{!r.current||!T||(t.preventDefault(),r.current.handleWheel(t))},M=t=>{!r.current||!k||r.current.handleGesturestart(t)},W=t=>{!r.current||!k||r.current.handleGesturechange(t)},D=t=>{!r.current||!k||r.current.handleGestureend(t)},X=t=>{!r.current||!v||r.current.handleMousedown(t)},e=t=>{!r.current||!v||r.current.handleMousemove(t)},n=t=>{!r.current||!v||r.current.handleMouseup(t)},u=t=>{!r.current||!O||r.current.handleTouchstart(t)},s=t=>{!r.current||!O||r.current.handleTouchmove(t)},P=t=>{!r.current||!O||r.current.handleTouchend(t)};return c.useEffect(()=>{if(!R.current)return;const t=R.current;return window.addEventListener("gesturechange",W),window.addEventListener("gestureend",D),window.addEventListener("mousemove",e),window.addEventListener("mouseup",n),window.addEventListener("touchmove",s),window.addEventListener("touchend",P),t.addEventListener("wheel",Y,{passive:!1}),t.addEventListener("gesturestart",M,{passive:!1}),t.addEventListener("mousedown",X,{passive:!1}),t.addEventListener("touchstart",u,{passive:!1}),()=>{window.removeEventListener("gesturechange",W),window.removeEventListener("gestureend",D),window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",n),window.removeEventListener("touchmove",s),window.removeEventListener("touchend",P),t.removeEventListener("wheel",Y),t.removeEventListener("gesturestart",M),t.removeEventListener("mousedown",X),t.removeEventListener("touchstart",u)}},[v,O,k,T]),H.jsxs("div",{ref:R,className:"zoompinch",style:N,onClick:J,onMouseDown:V,onTouchStart:Z,onMouseUp:B,onTouchEnd:Q,children:[H.jsx("div",{className:"canvas",children:I}),H.jsx("div",{className:"matrix",children:typeof L=="function"?L({composePoint:d.composePoint,normalizeClientCoords:S.current,canvasWidth:d.canvasWidth,canvasHeight:d.canvasHeight}):L})]})});re.displayName="Zoompinch",_.Zoompinch=re,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zoompinch/react",
3
- "version": "0.0.4",
3
+ "version": "0.0.7",
4
4
  "description": "React components for Zoompinch",
5
5
  "main": "./dist/zoompinch-react.umd.js",
6
6
  "module": "./dist/zoompinch-react.es.js",
@@ -57,6 +57,6 @@
57
57
  "vite": "^6.4.1"
58
58
  },
59
59
  "dependencies": {
60
- "@zoompinch/core": "^0.0.27"
60
+ "@zoompinch/core": "^0.0.30"
61
61
  }
62
62
  }