sequential-workflow-designer 0.24.5 → 0.24.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.
package/README.md CHANGED
@@ -103,10 +103,10 @@ Add the below code to your head section in HTML document.
103
103
  ```html
104
104
  <head>
105
105
  ...
106
- <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.5/css/designer.css" rel="stylesheet">
107
- <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.5/css/designer-light.css" rel="stylesheet">
108
- <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.5/css/designer-dark.css" rel="stylesheet">
109
- <script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.5/dist/index.umd.js"></script>
106
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.6/css/designer.css" rel="stylesheet">
107
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.6/css/designer-light.css" rel="stylesheet">
108
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.6/css/designer-dark.css" rel="stylesheet">
109
+ <script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.6/dist/index.umd.js"></script>
110
110
  ```
111
111
 
112
112
  Call the designer by:
package/dist/index.umd.js CHANGED
@@ -1706,6 +1706,12 @@
1706
1706
 
1707
1707
  class CenteredViewportCalculator {
1708
1708
  static center(margin, canvasSize, rootComponentSize) {
1709
+ if (canvasSize.x === 0 || canvasSize.y === 0) {
1710
+ return {
1711
+ position: new Vector(0, 0),
1712
+ scale: 1
1713
+ };
1714
+ }
1709
1715
  const canvasSafeWidth = Math.max(canvasSize.x - margin * 2, 0);
1710
1716
  const canvasSafeHeight = Math.max(canvasSize.y - margin * 2, 0);
1711
1717
  const scale = Math.min(Math.min(canvasSafeWidth / rootComponentSize.x, canvasSafeHeight / rootComponentSize.y), 1);
@@ -4717,6 +4723,12 @@
4717
4723
  setViewport(viewport) {
4718
4724
  this.state.setViewport(viewport);
4719
4725
  }
4726
+ /**
4727
+ * @description Resets the viewport.
4728
+ */
4729
+ resetViewport() {
4730
+ this.api.viewport.resetViewport();
4731
+ }
4720
4732
  /**
4721
4733
  * @description Unselects the selected step.
4722
4734
  */
package/lib/cjs/index.cjs CHANGED
@@ -1704,6 +1704,12 @@ const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElemen
1704
1704
 
1705
1705
  class CenteredViewportCalculator {
1706
1706
  static center(margin, canvasSize, rootComponentSize) {
1707
+ if (canvasSize.x === 0 || canvasSize.y === 0) {
1708
+ return {
1709
+ position: new Vector(0, 0),
1710
+ scale: 1
1711
+ };
1712
+ }
1707
1713
  const canvasSafeWidth = Math.max(canvasSize.x - margin * 2, 0);
1708
1714
  const canvasSafeHeight = Math.max(canvasSize.y - margin * 2, 0);
1709
1715
  const scale = Math.min(Math.min(canvasSafeWidth / rootComponentSize.x, canvasSafeHeight / rootComponentSize.y), 1);
@@ -4532,6 +4538,12 @@ class Designer {
4532
4538
  setViewport(viewport) {
4533
4539
  this.state.setViewport(viewport);
4534
4540
  }
4541
+ /**
4542
+ * @description Resets the viewport.
4543
+ */
4544
+ resetViewport() {
4545
+ this.api.viewport.resetViewport();
4546
+ }
4535
4547
  /**
4536
4548
  * @description Unselects the selected step.
4537
4549
  */
package/lib/esm/index.js CHANGED
@@ -1703,6 +1703,12 @@ const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElemen
1703
1703
 
1704
1704
  class CenteredViewportCalculator {
1705
1705
  static center(margin, canvasSize, rootComponentSize) {
1706
+ if (canvasSize.x === 0 || canvasSize.y === 0) {
1707
+ return {
1708
+ position: new Vector(0, 0),
1709
+ scale: 1
1710
+ };
1711
+ }
1706
1712
  const canvasSafeWidth = Math.max(canvasSize.x - margin * 2, 0);
1707
1713
  const canvasSafeHeight = Math.max(canvasSize.y - margin * 2, 0);
1708
1714
  const scale = Math.min(Math.min(canvasSafeWidth / rootComponentSize.x, canvasSafeHeight / rootComponentSize.y), 1);
@@ -4531,6 +4537,12 @@ class Designer {
4531
4537
  setViewport(viewport) {
4532
4538
  this.state.setViewport(viewport);
4533
4539
  }
4540
+ /**
4541
+ * @description Resets the viewport.
4542
+ */
4543
+ resetViewport() {
4544
+ this.api.viewport.resetViewport();
4545
+ }
4534
4546
  /**
4535
4547
  * @description Unselects the selected step.
4536
4548
  */
package/lib/index.d.ts CHANGED
@@ -1185,6 +1185,10 @@ declare class Designer<TDefinition extends Definition = Definition> {
1185
1185
  * @param viewport Viewport.
1186
1186
  */
1187
1187
  setViewport(viewport: Viewport): void;
1188
+ /**
1189
+ * @description Resets the viewport.
1190
+ */
1191
+ resetViewport(): void;
1188
1192
  /**
1189
1193
  * @description Unselects the selected step.
1190
1194
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sequential-workflow-designer",
3
3
  "description": "Customizable no-code component for building flow-based programming applications.",
4
- "version": "0.24.5",
4
+ "version": "0.24.6",
5
5
  "type": "module",
6
6
  "main": "./lib/esm/index.js",
7
7
  "types": "./lib/index.d.ts",