@knotx/plugins-canvas 0.5.3 → 0.5.5

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/index.cjs CHANGED
@@ -501,8 +501,15 @@ class Canvas extends (_a = core.BasePlugin, _transform_dec = [decorators.registe
501
501
  );
502
502
  }
503
503
  createZoomPanPinch() {
504
+ var _a2;
504
505
  const defaultTransform = this.getDefaultTransform();
505
- this.zoomPanPinch = new reactZoomPanPinch.ZoomPanPinch(this.config);
506
+ this.zoomPanPinch = new reactZoomPanPinch.ZoomPanPinch(__spreadProps(__spreadValues({}, this.config), {
507
+ alignmentAnimation: __spreadValues({
508
+ // react-zoom-pan-pinch/src/constants/state.constants.ts 里有默认值 100, 会影响初始位置计算, 造成无效的视口内搜索, 手动重置为 0 优化性能
509
+ sizeX: 0,
510
+ sizeY: 0
511
+ }, (_a2 = this.config) == null ? void 0 : _a2.alignmentAnimation)
512
+ }));
506
513
  if (defaultTransform && this.container && this.contentSize) {
507
514
  this.zoomPanPinch.presetTransformStateBeforeInit({
508
515
  wrapperSize: this.container,
@@ -531,7 +538,7 @@ class Canvas extends (_a = core.BasePlugin, _transform_dec = [decorators.registe
531
538
  getDefaultTransform() {
532
539
  var _a2, _b, _c;
533
540
  const defaultLocated = __spreadValues({}, this.config.defaultLocated);
534
- if (!(defaultLocated == null ? void 0 : defaultLocated.nodeId)) {
541
+ if (!(defaultLocated == null ? void 0 : defaultLocated.nodeId) && !this.config.limitToBounds) {
535
542
  return void 0;
536
543
  }
537
544
  const node = defaultLocated.nodeId ? this.getNode({ id: defaultLocated.nodeId }) : void 0;
package/dist/index.js CHANGED
@@ -499,8 +499,15 @@ class Canvas extends (_a = BasePlugin, _transform_dec = [register("transform")],
499
499
  );
500
500
  }
501
501
  createZoomPanPinch() {
502
+ var _a2;
502
503
  const defaultTransform = this.getDefaultTransform();
503
- this.zoomPanPinch = new ZoomPanPinch(this.config);
504
+ this.zoomPanPinch = new ZoomPanPinch(__spreadProps(__spreadValues({}, this.config), {
505
+ alignmentAnimation: __spreadValues({
506
+ // react-zoom-pan-pinch/src/constants/state.constants.ts 里有默认值 100, 会影响初始位置计算, 造成无效的视口内搜索, 手动重置为 0 优化性能
507
+ sizeX: 0,
508
+ sizeY: 0
509
+ }, (_a2 = this.config) == null ? void 0 : _a2.alignmentAnimation)
510
+ }));
504
511
  if (defaultTransform && this.container && this.contentSize) {
505
512
  this.zoomPanPinch.presetTransformStateBeforeInit({
506
513
  wrapperSize: this.container,
@@ -529,7 +536,7 @@ class Canvas extends (_a = BasePlugin, _transform_dec = [register("transform")],
529
536
  getDefaultTransform() {
530
537
  var _a2, _b, _c;
531
538
  const defaultLocated = __spreadValues({}, this.config.defaultLocated);
532
- if (!(defaultLocated == null ? void 0 : defaultLocated.nodeId)) {
539
+ if (!(defaultLocated == null ? void 0 : defaultLocated.nodeId) && !this.config.limitToBounds) {
533
540
  return void 0;
534
541
  }
535
542
  const node = defaultLocated.nodeId ? this.getNode({ id: defaultLocated.nodeId }) : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knotx/plugins-canvas",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "Canvas Plugin for Knotx",
5
5
  "author": "boenfu",
6
6
  "license": "MIT",
@@ -29,25 +29,25 @@
29
29
  ],
30
30
  "peerDependencies": {
31
31
  "react": ">=17.0.0",
32
- "@knotx/jsx": "0.5.3",
33
- "@knotx/plugins-history": "0.5.3"
32
+ "@knotx/jsx": "0.5.5",
33
+ "@knotx/plugins-history": "0.5.5"
34
34
  },
35
35
  "dependencies": {
36
36
  "@knotx/react-zoom-pan-pinch": "^3.9.12",
37
37
  "lodash-es": "^4.17.21",
38
38
  "rxjs": "^7.8.1",
39
- "@knotx/core": "0.5.3",
40
- "@knotx/decorators": "0.5.3"
39
+ "@knotx/core": "0.5.5",
40
+ "@knotx/decorators": "0.5.5"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/lodash-es": "^4.17.12",
44
44
  "@types/react": "^17.0.0",
45
45
  "react": "^17.0.0",
46
- "@knotx/build-config": "0.5.3",
47
- "@knotx/eslint-config": "0.5.3",
48
- "@knotx/jsx": "0.5.3",
49
- "@knotx/plugins-history": "0.5.3",
50
- "@knotx/typescript-config": "0.5.3"
46
+ "@knotx/build-config": "0.5.5",
47
+ "@knotx/eslint-config": "0.5.5",
48
+ "@knotx/jsx": "0.5.5",
49
+ "@knotx/plugins-history": "0.5.5",
50
+ "@knotx/typescript-config": "0.5.5"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "unbuild",