@knotx/plugins-canvas 0.3.5 → 0.3.6

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.
Files changed (3) hide show
  1. package/dist/index.cjs +138 -87
  2. package/dist/index.js +140 -89
  3. package/package.json +8 -8
package/dist/index.cjs CHANGED
@@ -7,6 +7,79 @@ const lodashEs = require('lodash-es');
7
7
  const react = require('react');
8
8
  const reactZoomPanPinch = require('react-zoom-pan-pinch');
9
9
 
10
+ function calculateTransform({
11
+ node,
12
+ container,
13
+ transform,
14
+ scale,
15
+ block = "nearest",
16
+ inline = "nearest",
17
+ offset = 0
18
+ }) {
19
+ var _a, _b, _c, _d, _e, _f;
20
+ const nodeX = node.position.x;
21
+ const nodeY = node.position.y;
22
+ const nodeWidth = (_b = (_a = node.measured) == null ? void 0 : _a.width) != null ? _b : 0;
23
+ const nodeHeight = (_d = (_c = node.measured) == null ? void 0 : _c.height) != null ? _d : 0;
24
+ const viewportWidth = container.width;
25
+ const viewportHeight = container.height;
26
+ let positionX = -transform.positionX;
27
+ let positionY = -transform.positionY;
28
+ const offsetX = typeof offset === "number" ? offset : (_e = offset.x) != null ? _e : 0;
29
+ const offsetY = typeof offset === "number" ? offset : (_f = offset.y) != null ? _f : 0;
30
+ switch (inline) {
31
+ case "center":
32
+ positionX = (nodeX + nodeWidth / 2) * scale - viewportWidth / 2;
33
+ break;
34
+ case "start":
35
+ positionX = nodeX * scale - offsetX;
36
+ break;
37
+ case "end":
38
+ positionX = (nodeX + nodeWidth) * scale - viewportWidth + offsetX;
39
+ break;
40
+ case "nearest": {
41
+ const nodeRight = (nodeX + nodeWidth) * scale;
42
+ const nodeLeft = nodeX * scale;
43
+ const currentLeft = -transform.positionX;
44
+ const currentRight = currentLeft + viewportWidth;
45
+ if (nodeRight > currentRight) {
46
+ positionX = nodeRight - viewportWidth + offsetX;
47
+ } else if (nodeLeft < currentLeft) {
48
+ positionX = nodeLeft - offsetX;
49
+ }
50
+ break;
51
+ }
52
+ }
53
+ switch (block) {
54
+ case "center":
55
+ positionY = (nodeY + nodeHeight / 2) * scale - viewportHeight / 2;
56
+ break;
57
+ case "start":
58
+ positionY = nodeY * scale - offsetY;
59
+ break;
60
+ case "end":
61
+ positionY = (nodeY + nodeHeight) * scale - viewportHeight + offsetY;
62
+ break;
63
+ case "nearest": {
64
+ const nodeBottom = (nodeY + nodeHeight) * scale;
65
+ const nodeTop = nodeY * scale;
66
+ const currentTop = -transform.positionY;
67
+ const currentBottom = currentTop + viewportHeight;
68
+ if (nodeBottom > currentBottom) {
69
+ positionY = nodeBottom - viewportHeight + offsetY;
70
+ } else if (nodeTop < currentTop) {
71
+ positionY = nodeTop - offsetY;
72
+ }
73
+ break;
74
+ }
75
+ }
76
+ return {
77
+ scale,
78
+ positionX,
79
+ positionY
80
+ };
81
+ }
82
+
10
83
  var __create = Object.create;
11
84
  var __defProp = Object.defineProperty;
12
85
  var __defProps = Object.defineProperties;
@@ -193,69 +266,22 @@ class Canvas extends (_a = core.BasePlugin, _ref_dec = [decorators.register("ref
193
266
  this.edgeScrollAnimationFrame = requestAnimationFrame(this.handleEdgeScroll);
194
267
  });
195
268
  }
196
- scrollNodeIntoView({ nodeId, scale = this.transform.scale, block = "nearest", inline = "nearest", offset = 0, animationTime }) {
197
- var _a2, _b, _c, _d, _e, _f, _g;
269
+ scrollNodeIntoView({ nodeId, scale = this.transform.scale, block, inline, offset, animationTime }) {
270
+ var _a2;
198
271
  const node = nodeId && this.getNode({ id: nodeId });
199
272
  if (!node) {
200
273
  return;
201
274
  }
202
- const nodeX = node.position.x;
203
- const nodeY = node.position.y;
204
- const nodeWidth = (_b = (_a2 = node.measured) == null ? void 0 : _a2.width) != null ? _b : 0;
205
- const nodeHeight = (_d = (_c = node.measured) == null ? void 0 : _c.height) != null ? _d : 0;
206
- const viewportWidth = this.container.width;
207
- const viewportHeight = this.container.height;
208
- let positionX = -this.transform.positionX;
209
- let positionY = -this.transform.positionY;
210
- const offsetX = typeof offset === "number" ? offset : (_e = offset.x) != null ? _e : 0;
211
- const offsetY = typeof offset === "number" ? offset : (_f = offset.y) != null ? _f : 0;
212
- switch (inline) {
213
- case "center":
214
- positionX = (nodeX + nodeWidth / 2) * scale - viewportWidth / 2;
215
- break;
216
- case "start":
217
- positionX = nodeX * scale - offsetX;
218
- break;
219
- case "end":
220
- positionX = (nodeX + nodeWidth) * scale - viewportWidth + offsetX;
221
- break;
222
- case "nearest": {
223
- const nodeRight = (nodeX + nodeWidth) * scale;
224
- const nodeLeft = nodeX * scale;
225
- const currentLeft = -this.transform.positionX;
226
- const currentRight = currentLeft + viewportWidth;
227
- if (nodeRight > currentRight) {
228
- positionX = nodeRight - viewportWidth + offsetX;
229
- } else if (nodeLeft < currentLeft) {
230
- positionX = nodeLeft - offsetX;
231
- }
232
- break;
233
- }
234
- }
235
- switch (block) {
236
- case "center":
237
- positionY = (nodeY + nodeHeight / 2) * scale - viewportHeight / 2;
238
- break;
239
- case "start":
240
- positionY = nodeY * scale - offsetY;
241
- break;
242
- case "end":
243
- positionY = (nodeY + nodeHeight) * scale - viewportHeight + offsetY;
244
- break;
245
- case "nearest": {
246
- const nodeBottom = (nodeY + nodeHeight) * scale;
247
- const nodeTop = nodeY * scale;
248
- const currentTop = -this.transform.positionY;
249
- const currentBottom = currentTop + viewportHeight;
250
- if (nodeBottom > currentBottom) {
251
- positionY = nodeBottom - viewportHeight + offsetY;
252
- } else if (nodeTop < currentTop) {
253
- positionY = nodeTop - offsetY;
254
- }
255
- break;
256
- }
257
- }
258
- (_g = this.ref) == null ? void 0 : _g.setTransform(-positionX, -positionY, scale, animationTime);
275
+ const { positionX, positionY, scale: newScale } = calculateTransform({
276
+ node,
277
+ container: this.container,
278
+ transform: this.transform,
279
+ scale,
280
+ block,
281
+ inline,
282
+ offset
283
+ });
284
+ (_a2 = this.ref) == null ? void 0 : _a2.setTransform(-positionX, -positionY, newScale, animationTime);
259
285
  }
260
286
  zoomIn({ step = 0.1, animationTime }) {
261
287
  var _a2;
@@ -270,15 +296,35 @@ class Canvas extends (_a = core.BasePlugin, _ref_dec = [decorators.register("ref
270
296
  (_a2 = this.ref) == null ? void 0 : _a2.setTransform(positionX != null ? positionX : this.transform.positionX, positionY != null ? positionY : this.transform.positionY, scale != null ? scale : this.transform.scale, animationTime);
271
297
  }
272
298
  render({ children } = { children: null }) {
273
- const [transformRef, setTransformRef] = react.useReducer((prevRef, ref) => {
274
- this.ref = ref;
275
- if (!prevRef && ref.instance.isInitialized && this.config.defaultLocated) {
276
- this.scrollNodeIntoView(__spreadValues({
277
- inline: "center",
278
- block: "center",
279
- scale: 1,
280
- animationTime: 0
281
- }, this.config.defaultLocated));
299
+ const defaultTransform = react.useMemo(() => {
300
+ const defaultLocated = this.config.defaultLocated;
301
+ if (!(defaultLocated == null ? void 0 : defaultLocated.nodeId)) {
302
+ return this.transform;
303
+ }
304
+ const node = this.getNode({ id: defaultLocated.nodeId });
305
+ if (!node) {
306
+ return this.transform;
307
+ }
308
+ defaultLocated.inline || (defaultLocated.inline = "center");
309
+ defaultLocated.block || (defaultLocated.block = "center");
310
+ defaultLocated.scale || (defaultLocated.scale = this.transform.scale);
311
+ const { positionX, positionY, scale: newScale } = calculateTransform(__spreadValues({
312
+ node,
313
+ container: this.container,
314
+ transform: this.transform
315
+ }, defaultLocated));
316
+ const newTransform = {
317
+ previousScale: this.transform.scale,
318
+ scale: newScale,
319
+ positionX: -positionX,
320
+ positionY: -positionY
321
+ };
322
+ this.transform = newTransform;
323
+ return newTransform;
324
+ }, []);
325
+ const [transformRef, setTransformRef] = react.useReducer((_, ref) => {
326
+ if (this.ref !== ref) {
327
+ this.ref = ref;
282
328
  }
283
329
  return ref;
284
330
  }, null);
@@ -297,31 +343,33 @@ class Canvas extends (_a = core.BasePlugin, _ref_dec = [decorators.register("ref
297
343
  }
298
344
  return [fixedLayers2, childrenLayers2];
299
345
  }, [children]);
300
- react.useEffect(() => {
346
+ react.useLayoutEffect(() => {
301
347
  const wrapperElement = transformRef == null ? void 0 : transformRef.instance.wrapperComponent;
302
- if (!wrapperElement) {
303
- return;
348
+ if (wrapperElement) {
349
+ Object.defineProperty(wrapperElement, "scrollTop", {
350
+ get() {
351
+ return -transformRef.instance.transformState.positionY;
352
+ },
353
+ set(value) {
354
+ transformRef.instance.setTransformState(transformRef.instance.transformState.scale, transformRef.instance.transformState.positionX, -value);
355
+ }
356
+ });
357
+ Object.defineProperty(wrapperElement, "scrollLeft", {
358
+ get() {
359
+ return -transformRef.instance.transformState.positionX;
360
+ },
361
+ set(value) {
362
+ transformRef.instance.setTransformState(transformRef.instance.transformState.scale, -value, transformRef.instance.transformState.positionY);
363
+ }
364
+ });
304
365
  }
305
- Object.defineProperty(wrapperElement, "scrollTop", {
306
- get() {
307
- return -transformRef.instance.transformState.positionY;
308
- },
309
- set(value) {
310
- transformRef.instance.setTransformState(transformRef.instance.transformState.scale, transformRef.instance.transformState.positionX, -value);
311
- }
312
- });
313
- Object.defineProperty(wrapperElement, "scrollLeft", {
314
- get() {
315
- return -transformRef.instance.transformState.positionX;
316
- },
317
- set(value) {
318
- transformRef.instance.setTransformState(transformRef.instance.transformState.scale, -value, transformRef.instance.transformState.positionY);
319
- }
320
- });
321
366
  let frame;
322
367
  return transformRef == null ? void 0 : transformRef.instance.onChange((ref) => {
323
368
  cancelAnimationFrame(frame);
324
369
  frame = requestAnimationFrame(() => {
370
+ if (lodashEs.isEqual(this.transform, ref.state)) {
371
+ return;
372
+ }
325
373
  this.transform = __spreadValues({}, ref.state);
326
374
  });
327
375
  });
@@ -371,6 +419,9 @@ class Canvas extends (_a = core.BasePlugin, _ref_dec = [decorators.register("ref
371
419
  reactZoomPanPinch.TransformWrapper,
372
420
  __spreadProps(__spreadValues({}, this.config), {
373
421
  ref: setTransformRef,
422
+ initialPositionX: defaultTransform.positionX,
423
+ initialPositionY: defaultTransform.positionY,
424
+ initialScale: defaultTransform.scale,
374
425
  children: [
375
426
  /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: fixedLayers }),
376
427
  /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
package/dist/index.js CHANGED
@@ -1,10 +1,83 @@
1
1
  import { jsxs, jsx } from '@knotx/jsx/jsx-runtime';
2
2
  import { Layer, InteractionPriority, bem, BasePlugin } from '@knotx/core';
3
3
  import { register, inject, tool, layer, OnInit } from '@knotx/decorators';
4
- import { merge } from 'lodash-es';
5
- import { useReducer, useMemo, useEffect, useCallback, Fragment } from 'react';
4
+ import { isEqual, merge } from 'lodash-es';
5
+ import { useMemo, useReducer, useLayoutEffect, useCallback, Fragment } from 'react';
6
6
  import { TransformWrapper, TransformComponent } from 'react-zoom-pan-pinch';
7
7
 
8
+ function calculateTransform({
9
+ node,
10
+ container,
11
+ transform,
12
+ scale,
13
+ block = "nearest",
14
+ inline = "nearest",
15
+ offset = 0
16
+ }) {
17
+ var _a, _b, _c, _d, _e, _f;
18
+ const nodeX = node.position.x;
19
+ const nodeY = node.position.y;
20
+ const nodeWidth = (_b = (_a = node.measured) == null ? void 0 : _a.width) != null ? _b : 0;
21
+ const nodeHeight = (_d = (_c = node.measured) == null ? void 0 : _c.height) != null ? _d : 0;
22
+ const viewportWidth = container.width;
23
+ const viewportHeight = container.height;
24
+ let positionX = -transform.positionX;
25
+ let positionY = -transform.positionY;
26
+ const offsetX = typeof offset === "number" ? offset : (_e = offset.x) != null ? _e : 0;
27
+ const offsetY = typeof offset === "number" ? offset : (_f = offset.y) != null ? _f : 0;
28
+ switch (inline) {
29
+ case "center":
30
+ positionX = (nodeX + nodeWidth / 2) * scale - viewportWidth / 2;
31
+ break;
32
+ case "start":
33
+ positionX = nodeX * scale - offsetX;
34
+ break;
35
+ case "end":
36
+ positionX = (nodeX + nodeWidth) * scale - viewportWidth + offsetX;
37
+ break;
38
+ case "nearest": {
39
+ const nodeRight = (nodeX + nodeWidth) * scale;
40
+ const nodeLeft = nodeX * scale;
41
+ const currentLeft = -transform.positionX;
42
+ const currentRight = currentLeft + viewportWidth;
43
+ if (nodeRight > currentRight) {
44
+ positionX = nodeRight - viewportWidth + offsetX;
45
+ } else if (nodeLeft < currentLeft) {
46
+ positionX = nodeLeft - offsetX;
47
+ }
48
+ break;
49
+ }
50
+ }
51
+ switch (block) {
52
+ case "center":
53
+ positionY = (nodeY + nodeHeight / 2) * scale - viewportHeight / 2;
54
+ break;
55
+ case "start":
56
+ positionY = nodeY * scale - offsetY;
57
+ break;
58
+ case "end":
59
+ positionY = (nodeY + nodeHeight) * scale - viewportHeight + offsetY;
60
+ break;
61
+ case "nearest": {
62
+ const nodeBottom = (nodeY + nodeHeight) * scale;
63
+ const nodeTop = nodeY * scale;
64
+ const currentTop = -transform.positionY;
65
+ const currentBottom = currentTop + viewportHeight;
66
+ if (nodeBottom > currentBottom) {
67
+ positionY = nodeBottom - viewportHeight + offsetY;
68
+ } else if (nodeTop < currentTop) {
69
+ positionY = nodeTop - offsetY;
70
+ }
71
+ break;
72
+ }
73
+ }
74
+ return {
75
+ scale,
76
+ positionX,
77
+ positionY
78
+ };
79
+ }
80
+
8
81
  var __create = Object.create;
9
82
  var __defProp = Object.defineProperty;
10
83
  var __defProps = Object.defineProperties;
@@ -191,69 +264,22 @@ class Canvas extends (_a = BasePlugin, _ref_dec = [register("ref")], _transform_
191
264
  this.edgeScrollAnimationFrame = requestAnimationFrame(this.handleEdgeScroll);
192
265
  });
193
266
  }
194
- scrollNodeIntoView({ nodeId, scale = this.transform.scale, block = "nearest", inline = "nearest", offset = 0, animationTime }) {
195
- var _a2, _b, _c, _d, _e, _f, _g;
267
+ scrollNodeIntoView({ nodeId, scale = this.transform.scale, block, inline, offset, animationTime }) {
268
+ var _a2;
196
269
  const node = nodeId && this.getNode({ id: nodeId });
197
270
  if (!node) {
198
271
  return;
199
272
  }
200
- const nodeX = node.position.x;
201
- const nodeY = node.position.y;
202
- const nodeWidth = (_b = (_a2 = node.measured) == null ? void 0 : _a2.width) != null ? _b : 0;
203
- const nodeHeight = (_d = (_c = node.measured) == null ? void 0 : _c.height) != null ? _d : 0;
204
- const viewportWidth = this.container.width;
205
- const viewportHeight = this.container.height;
206
- let positionX = -this.transform.positionX;
207
- let positionY = -this.transform.positionY;
208
- const offsetX = typeof offset === "number" ? offset : (_e = offset.x) != null ? _e : 0;
209
- const offsetY = typeof offset === "number" ? offset : (_f = offset.y) != null ? _f : 0;
210
- switch (inline) {
211
- case "center":
212
- positionX = (nodeX + nodeWidth / 2) * scale - viewportWidth / 2;
213
- break;
214
- case "start":
215
- positionX = nodeX * scale - offsetX;
216
- break;
217
- case "end":
218
- positionX = (nodeX + nodeWidth) * scale - viewportWidth + offsetX;
219
- break;
220
- case "nearest": {
221
- const nodeRight = (nodeX + nodeWidth) * scale;
222
- const nodeLeft = nodeX * scale;
223
- const currentLeft = -this.transform.positionX;
224
- const currentRight = currentLeft + viewportWidth;
225
- if (nodeRight > currentRight) {
226
- positionX = nodeRight - viewportWidth + offsetX;
227
- } else if (nodeLeft < currentLeft) {
228
- positionX = nodeLeft - offsetX;
229
- }
230
- break;
231
- }
232
- }
233
- switch (block) {
234
- case "center":
235
- positionY = (nodeY + nodeHeight / 2) * scale - viewportHeight / 2;
236
- break;
237
- case "start":
238
- positionY = nodeY * scale - offsetY;
239
- break;
240
- case "end":
241
- positionY = (nodeY + nodeHeight) * scale - viewportHeight + offsetY;
242
- break;
243
- case "nearest": {
244
- const nodeBottom = (nodeY + nodeHeight) * scale;
245
- const nodeTop = nodeY * scale;
246
- const currentTop = -this.transform.positionY;
247
- const currentBottom = currentTop + viewportHeight;
248
- if (nodeBottom > currentBottom) {
249
- positionY = nodeBottom - viewportHeight + offsetY;
250
- } else if (nodeTop < currentTop) {
251
- positionY = nodeTop - offsetY;
252
- }
253
- break;
254
- }
255
- }
256
- (_g = this.ref) == null ? void 0 : _g.setTransform(-positionX, -positionY, scale, animationTime);
273
+ const { positionX, positionY, scale: newScale } = calculateTransform({
274
+ node,
275
+ container: this.container,
276
+ transform: this.transform,
277
+ scale,
278
+ block,
279
+ inline,
280
+ offset
281
+ });
282
+ (_a2 = this.ref) == null ? void 0 : _a2.setTransform(-positionX, -positionY, newScale, animationTime);
257
283
  }
258
284
  zoomIn({ step = 0.1, animationTime }) {
259
285
  var _a2;
@@ -268,15 +294,35 @@ class Canvas extends (_a = BasePlugin, _ref_dec = [register("ref")], _transform_
268
294
  (_a2 = this.ref) == null ? void 0 : _a2.setTransform(positionX != null ? positionX : this.transform.positionX, positionY != null ? positionY : this.transform.positionY, scale != null ? scale : this.transform.scale, animationTime);
269
295
  }
270
296
  render({ children } = { children: null }) {
271
- const [transformRef, setTransformRef] = useReducer((prevRef, ref) => {
272
- this.ref = ref;
273
- if (!prevRef && ref.instance.isInitialized && this.config.defaultLocated) {
274
- this.scrollNodeIntoView(__spreadValues({
275
- inline: "center",
276
- block: "center",
277
- scale: 1,
278
- animationTime: 0
279
- }, this.config.defaultLocated));
297
+ const defaultTransform = useMemo(() => {
298
+ const defaultLocated = this.config.defaultLocated;
299
+ if (!(defaultLocated == null ? void 0 : defaultLocated.nodeId)) {
300
+ return this.transform;
301
+ }
302
+ const node = this.getNode({ id: defaultLocated.nodeId });
303
+ if (!node) {
304
+ return this.transform;
305
+ }
306
+ defaultLocated.inline || (defaultLocated.inline = "center");
307
+ defaultLocated.block || (defaultLocated.block = "center");
308
+ defaultLocated.scale || (defaultLocated.scale = this.transform.scale);
309
+ const { positionX, positionY, scale: newScale } = calculateTransform(__spreadValues({
310
+ node,
311
+ container: this.container,
312
+ transform: this.transform
313
+ }, defaultLocated));
314
+ const newTransform = {
315
+ previousScale: this.transform.scale,
316
+ scale: newScale,
317
+ positionX: -positionX,
318
+ positionY: -positionY
319
+ };
320
+ this.transform = newTransform;
321
+ return newTransform;
322
+ }, []);
323
+ const [transformRef, setTransformRef] = useReducer((_, ref) => {
324
+ if (this.ref !== ref) {
325
+ this.ref = ref;
280
326
  }
281
327
  return ref;
282
328
  }, null);
@@ -295,31 +341,33 @@ class Canvas extends (_a = BasePlugin, _ref_dec = [register("ref")], _transform_
295
341
  }
296
342
  return [fixedLayers2, childrenLayers2];
297
343
  }, [children]);
298
- useEffect(() => {
344
+ useLayoutEffect(() => {
299
345
  const wrapperElement = transformRef == null ? void 0 : transformRef.instance.wrapperComponent;
300
- if (!wrapperElement) {
301
- return;
346
+ if (wrapperElement) {
347
+ Object.defineProperty(wrapperElement, "scrollTop", {
348
+ get() {
349
+ return -transformRef.instance.transformState.positionY;
350
+ },
351
+ set(value) {
352
+ transformRef.instance.setTransformState(transformRef.instance.transformState.scale, transformRef.instance.transformState.positionX, -value);
353
+ }
354
+ });
355
+ Object.defineProperty(wrapperElement, "scrollLeft", {
356
+ get() {
357
+ return -transformRef.instance.transformState.positionX;
358
+ },
359
+ set(value) {
360
+ transformRef.instance.setTransformState(transformRef.instance.transformState.scale, -value, transformRef.instance.transformState.positionY);
361
+ }
362
+ });
302
363
  }
303
- Object.defineProperty(wrapperElement, "scrollTop", {
304
- get() {
305
- return -transformRef.instance.transformState.positionY;
306
- },
307
- set(value) {
308
- transformRef.instance.setTransformState(transformRef.instance.transformState.scale, transformRef.instance.transformState.positionX, -value);
309
- }
310
- });
311
- Object.defineProperty(wrapperElement, "scrollLeft", {
312
- get() {
313
- return -transformRef.instance.transformState.positionX;
314
- },
315
- set(value) {
316
- transformRef.instance.setTransformState(transformRef.instance.transformState.scale, -value, transformRef.instance.transformState.positionY);
317
- }
318
- });
319
364
  let frame;
320
365
  return transformRef == null ? void 0 : transformRef.instance.onChange((ref) => {
321
366
  cancelAnimationFrame(frame);
322
367
  frame = requestAnimationFrame(() => {
368
+ if (isEqual(this.transform, ref.state)) {
369
+ return;
370
+ }
323
371
  this.transform = __spreadValues({}, ref.state);
324
372
  });
325
373
  });
@@ -369,6 +417,9 @@ class Canvas extends (_a = BasePlugin, _ref_dec = [register("ref")], _transform_
369
417
  TransformWrapper,
370
418
  __spreadProps(__spreadValues({}, this.config), {
371
419
  ref: setTransformRef,
420
+ initialPositionX: defaultTransform.positionX,
421
+ initialPositionY: defaultTransform.positionY,
422
+ initialScale: defaultTransform.scale,
372
423
  children: [
373
424
  /* @__PURE__ */ jsx(Fragment, { children: fixedLayers }),
374
425
  /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knotx/plugins-canvas",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Canvas Plugin for Knotx",
5
5
  "author": "boenfu",
6
6
  "license": "MIT",
@@ -29,23 +29,23 @@
29
29
  ],
30
30
  "peerDependencies": {
31
31
  "react": ">=17.0.0",
32
- "@knotx/jsx": "0.3.5"
32
+ "@knotx/jsx": "0.3.6"
33
33
  },
34
34
  "dependencies": {
35
35
  "lodash-es": "^4.17.21",
36
36
  "react-zoom-pan-pinch": "^3.7.0",
37
37
  "rxjs": "^7.8.1",
38
- "@knotx/core": "0.3.5",
39
- "@knotx/decorators": "0.3.5"
38
+ "@knotx/core": "0.3.6",
39
+ "@knotx/decorators": "0.3.6"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/lodash-es": "^4.17.12",
43
43
  "@types/react": "^17.0.0",
44
44
  "react": "^17.0.0",
45
- "@knotx/build-config": "0.3.5",
46
- "@knotx/eslint-config": "0.3.5",
47
- "@knotx/jsx": "0.3.5",
48
- "@knotx/typescript-config": "0.3.5"
45
+ "@knotx/build-config": "0.3.6",
46
+ "@knotx/eslint-config": "0.3.6",
47
+ "@knotx/jsx": "0.3.6",
48
+ "@knotx/typescript-config": "0.3.6"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "unbuild",