canvas2d-wrapper 2.4.1 → 2.4.2

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/dist/Canvas2D.js CHANGED
@@ -49,12 +49,18 @@ function g({ width: g, height: _, trackMouseMove: v = !0, minZoom: y = 1, maxZoo
49
49
  }));
50
50
  }
51
51
  }, []);
52
- if (B.deltaTop = N, B.deltaLeft = M, y > b) throw Error("minZoom should be lower than maxZoom.");
53
- let W;
54
- v && (W = (e) => n(e, p[z.id], x, B, V, O, k, j, T, w));
55
- let G = (e) => {
56
- E && E(e.nativeEvent), y !== b && r(e, B, V, y, b);
57
- }, K;
52
+ B.deltaTop = N, B.deltaLeft = M;
53
+ let W = s((e) => {
54
+ E && E(e.nativeEvent), y !== b && r(e, V, y, b);
55
+ }, [
56
+ E,
57
+ b,
58
+ y
59
+ ]);
60
+ if (y > b) throw Error("minZoom should be lower than maxZoom.");
61
+ let G;
62
+ v && (G = (e) => n(e, p[z.id], x, B, V, O, k, j, T, w));
63
+ let K;
58
64
  return S && (K = (t) => {
59
65
  let n = !1;
60
66
  m[z.id] && (n = Math.abs(m[z.id].x - t.nativeEvent.screenX) > h || Math.abs(m[z.id].y - t.nativeEvent.screenY) > h), S(e(t, p[z.id], x, B, n));
@@ -126,8 +132,8 @@ function g({ width: g, height: _, trackMouseMove: v = !0, minZoom: y = 1, maxZoo
126
132
  ref: H,
127
133
  width: g,
128
134
  height: _,
129
- onPointerMove: W,
130
- onWheel: G,
135
+ onPointerMove: G,
136
+ onWheel: W,
131
137
  onClick: K,
132
138
  className: "canvas2d-wrapper",
133
139
  ...z
@@ -1,2 +1,2 @@
1
1
  import { default as Canvas2DState } from '../types/Canvas2DState';
2
- export default function mouseWheel(event: React.WheelEvent, props: Canvas2DState, setProps: React.Dispatch<React.SetStateAction<Canvas2DState>>, minZoom: number, maxZoom: number): void;
2
+ export default function mouseWheel(event: React.WheelEvent, setState: React.Dispatch<React.SetStateAction<Canvas2DState>>, minZoom: number, maxZoom: number): void;
@@ -1,10 +1,12 @@
1
1
  //#region lib/events/mouseWheel.ts
2
2
  var e = .05;
3
- function t(t, n, r, i, a) {
4
- let o = n.zoom;
5
- t.deltaY < 0 ? o += e : o -= e, o = Math.max(o, i), o = Math.min(o, a), r({
6
- ...n,
7
- zoom: o
3
+ function t(t, n, r, i) {
4
+ n((n) => {
5
+ let a = n.zoom;
6
+ return t.deltaY < 0 ? a += e : t.deltaY > 0 && (a -= e), a = Math.max(a, r), a = Math.min(a, i), {
7
+ ...n,
8
+ zoom: a
9
+ };
8
10
  });
9
11
  }
10
12
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas2d-wrapper",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "type": "module",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",