kritzel-stencil 0.0.141 → 0.0.142

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 (91) hide show
  1. package/dist/cjs/{index-BKstgWru.js → index-SaGfCHX3.js} +276 -805
  2. package/dist/cjs/index-SaGfCHX3.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +1 -1
  4. package/dist/cjs/kritzel-color_22.cjs.entry.js +114 -77
  5. package/dist/collection/classes/commands/add-object.command.js +1 -0
  6. package/dist/collection/classes/commands/add-object.command.js.map +1 -1
  7. package/dist/collection/classes/commands/base.command.js +2 -0
  8. package/dist/collection/classes/commands/base.command.js.map +1 -1
  9. package/dist/collection/classes/commands/remove-object.command.js +1 -3
  10. package/dist/collection/classes/commands/remove-object.command.js.map +1 -1
  11. package/dist/collection/classes/commands/update-object.command.js +2 -0
  12. package/dist/collection/classes/commands/update-object.command.js.map +1 -1
  13. package/dist/collection/classes/core/command-manager.class.js +51 -0
  14. package/dist/collection/classes/core/command-manager.class.js.map +1 -0
  15. package/dist/collection/classes/core/core.class.js +23 -14
  16. package/dist/collection/classes/core/core.class.js.map +1 -1
  17. package/dist/collection/classes/core/history.class.js +2 -40
  18. package/dist/collection/classes/core/history.class.js.map +1 -1
  19. package/dist/collection/classes/core/viewport.class.js +16 -5
  20. package/dist/collection/classes/core/viewport.class.js.map +1 -1
  21. package/dist/collection/classes/handlers/context-menu.handler.js +1 -1
  22. package/dist/collection/classes/handlers/context-menu.handler.js.map +1 -1
  23. package/dist/collection/classes/handlers/move.handler.js +11 -6
  24. package/dist/collection/classes/handlers/move.handler.js.map +1 -1
  25. package/dist/collection/classes/handlers/resize.handler.js +29 -5
  26. package/dist/collection/classes/handlers/resize.handler.js.map +1 -1
  27. package/dist/collection/classes/handlers/rotation.handler.js +2 -2
  28. package/dist/collection/classes/handlers/rotation.handler.js.map +1 -1
  29. package/dist/collection/classes/handlers/selection.handler.js +4 -4
  30. package/dist/collection/classes/handlers/selection.handler.js.map +1 -1
  31. package/dist/collection/classes/objects/base-object.class.js +15 -14
  32. package/dist/collection/classes/objects/base-object.class.js.map +1 -1
  33. package/dist/collection/classes/objects/custom-element.class.js +7 -1
  34. package/dist/collection/classes/objects/custom-element.class.js.map +1 -1
  35. package/dist/collection/classes/objects/text.class.js +109 -49
  36. package/dist/collection/classes/objects/text.class.js.map +1 -1
  37. package/dist/collection/classes/tools/brush-tool.class.js +2 -2
  38. package/dist/collection/classes/tools/brush-tool.class.js.map +1 -1
  39. package/dist/collection/classes/tools/eraser-tool.class.js +2 -2
  40. package/dist/collection/classes/tools/eraser-tool.class.js.map +1 -1
  41. package/dist/collection/classes/tools/image-tool.class.js +1 -1
  42. package/dist/collection/classes/tools/image-tool.class.js.map +1 -1
  43. package/dist/collection/classes/tools/selection-tool.class.js +2 -2
  44. package/dist/collection/classes/tools/selection-tool.class.js.map +1 -1
  45. package/dist/collection/classes/tools/text-tool.class.js +17 -11
  46. package/dist/collection/classes/tools/text-tool.class.js.map +1 -1
  47. package/dist/collection/components/core/kritzel-engine/kritzel-engine.css +1 -1
  48. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +21 -15
  49. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
  50. package/dist/collection/interfaces/object.interface.js.map +1 -1
  51. package/dist/components/index.js +2 -2
  52. package/dist/components/kritzel-controls.js +1 -1
  53. package/dist/components/kritzel-editor.js +3 -3
  54. package/dist/components/kritzel-engine.js +1 -1
  55. package/dist/components/{p-ChLi4Ufe.js → p-C8calcQF.js} +3 -3
  56. package/dist/components/{p-ChLi4Ufe.js.map → p-C8calcQF.js.map} +1 -1
  57. package/dist/components/{p-BuDVaqTF.js → p-CZk591FE.js} +165 -728
  58. package/dist/components/p-CZk591FE.js.map +1 -0
  59. package/dist/components/{p-C4nj29RW.js → p-CziwfEQh.js} +227 -156
  60. package/dist/components/p-CziwfEQh.js.map +1 -0
  61. package/dist/esm/{index-D0Q2MKPn.js → index-SIM_s7ed.js} +276 -805
  62. package/dist/esm/index-SIM_s7ed.js.map +1 -0
  63. package/dist/esm/index.js +1 -1
  64. package/dist/esm/kritzel-color_22.entry.js +114 -77
  65. package/dist/stencil/index.esm.js +1 -1
  66. package/dist/stencil/p-SIM_s7ed.js +2 -0
  67. package/dist/stencil/p-SIM_s7ed.js.map +1 -0
  68. package/dist/stencil/p-b697b2c1.entry.js +2 -0
  69. package/dist/stencil/p-b697b2c1.entry.js.map +1 -0
  70. package/dist/stencil/stencil.esm.js +1 -1
  71. package/dist/types/classes/commands/add-object.command.d.ts +2 -2
  72. package/dist/types/classes/commands/base.command.d.ts +2 -1
  73. package/dist/types/classes/commands/remove-object.command.d.ts +2 -2
  74. package/dist/types/classes/commands/update-object.command.d.ts +2 -2
  75. package/dist/types/classes/core/command-manager.class.d.ts +16 -0
  76. package/dist/types/classes/core/core.class.d.ts +4 -0
  77. package/dist/types/classes/core/history.class.d.ts +0 -8
  78. package/dist/types/classes/core/viewport.class.d.ts +2 -0
  79. package/dist/types/classes/handlers/resize.handler.d.ts +1 -0
  80. package/dist/types/classes/objects/base-object.class.d.ts +6 -4
  81. package/dist/types/classes/objects/text.class.d.ts +13 -2
  82. package/dist/types/interfaces/object.interface.d.ts +1 -3
  83. package/package.json +1 -1
  84. package/dist/cjs/index-BKstgWru.js.map +0 -1
  85. package/dist/components/p-BuDVaqTF.js.map +0 -1
  86. package/dist/components/p-C4nj29RW.js.map +0 -1
  87. package/dist/esm/index-D0Q2MKPn.js.map +0 -1
  88. package/dist/stencil/p-73784709.entry.js +0 -2
  89. package/dist/stencil/p-73784709.entry.js.map +0 -1
  90. package/dist/stencil/p-D0Q2MKPn.js +0 -2
  91. package/dist/stencil/p-D0Q2MKPn.js.map +0 -1
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { D as DEFAULT_BRUSH_CONFIG, e as DEFAULT_TEXT_CONFIG, K as KritzelBrushTool, d as KritzelEraserTool, u as KritzelImage, f as KritzelImageTool, t as KritzelPath, c as KritzelSelectionTool, s as KritzelText, a as KritzelTextTool, g as KritzelWorkspace } from './index-D0Q2MKPn.js';
1
+ export { D as DEFAULT_BRUSH_CONFIG, e as DEFAULT_TEXT_CONFIG, K as KritzelBrushTool, d as KritzelEraserTool, u as KritzelImage, f as KritzelImageTool, t as KritzelPath, c as KritzelSelectionTool, s as KritzelText, a as KritzelTextTool, g as KritzelWorkspace } from './index-SIM_s7ed.js';
2
2
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-Cw77zP6g.js';
2
- import { K as KritzelBrushTool, a as KritzelTextTool, b as KritzelMouseButton, c as KritzelSelectionTool, D as DEFAULT_BRUSH_CONFIG, d as KritzelEraserTool, e as DEFAULT_TEXT_CONFIG, f as KritzelImageTool, g as KritzelWorkspace, h as KritzelKeyboardHelper, i as KritzelEventHelper, j as KritzelBaseHandler, k as KritzelToolRegistry, l as KrtizelSelectionBox, m as KritzelSelectionGroup, B as BatchCommand, R as RemoveSelectionGroupCommand, A as AddSelectionGroupCommand, n as KritzelBaseCommand, O as ObjectHelper, o as KritzelReviver, p as RemoveObjectCommand, q as AddObjectCommand, U as UpdateObjectCommand, r as KritzelBaseTool } from './index-D0Q2MKPn.js';
2
+ import { K as KritzelBrushTool, a as KritzelTextTool, b as KritzelMouseButton, c as KritzelSelectionTool, D as DEFAULT_BRUSH_CONFIG, d as KritzelEraserTool, e as DEFAULT_TEXT_CONFIG, f as KritzelImageTool, g as KritzelWorkspace, h as KritzelKeyboardHelper, i as KritzelEventHelper, j as KritzelBaseHandler, k as KritzelToolRegistry, l as KrtizelSelectionBox, m as KritzelSelectionGroup, B as BatchCommand, R as RemoveSelectionGroupCommand, A as AddSelectionGroupCommand, n as KritzelBaseCommand, O as ObjectHelper, o as KritzelReviver, p as RemoveObjectCommand, q as AddObjectCommand, U as UpdateObjectCommand, r as KritzelBaseTool } from './index-SIM_s7ed.js';
3
3
 
4
4
  const kritzelColorCss = ":host{display:flex}.checkerboard-bg{background:repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 50% / 8px 8px;position:relative;overflow:hidden}.color-circle{width:24px;height:24px;border-radius:50%;box-sizing:border-box;display:block}.color-circle.white{border:1px solid var(--kritzel-color-palette-circle-border-color, #dddcdc)}";
5
5
 
@@ -859,6 +859,7 @@ KritzelEditor.style = kritzelEditorCss;
859
859
 
860
860
  class KritzelViewport {
861
861
  _core;
862
+ _debounceUpdate;
862
863
  initialTouchDistance = 0;
863
864
  startX = 0;
864
865
  startY = 0;
@@ -871,6 +872,16 @@ class KritzelViewport {
871
872
  this._core.store.state.startY = 0;
872
873
  this._core.store.state.translateX = 0;
873
874
  this._core.store.state.translateY = 0;
875
+ this._debounceUpdate = this.debounce(() => {
876
+ this._core.updateWorkspaceViewport(this._core.store.state.translateX, this._core.store.state.translateY, this._core.store.state.scale);
877
+ }, 0);
878
+ }
879
+ debounce(func, delay) {
880
+ let timeoutId;
881
+ return () => {
882
+ clearTimeout(timeoutId);
883
+ timeoutId = setTimeout(func, delay);
884
+ };
874
885
  }
875
886
  handleResize() {
876
887
  this._core.store.state.viewportWidth = this._core.store.state.host.clientWidth;
@@ -921,7 +932,7 @@ class KritzelViewport {
921
932
  this._core.store.state.hasViewportChanged = true;
922
933
  this._core.store.state.skipContextMenu = true;
923
934
  this._core.rerender();
924
- this._core.updateWorkspaceViewport(this._core.store.state.translateX, this._core.store.state.translateY, this._core.store.state.scale);
935
+ this._debounceUpdate();
925
936
  }
926
937
  }
927
938
  if (event.pointerType === 'touch') {
@@ -957,7 +968,7 @@ class KritzelViewport {
957
968
  this.startY = midpointY;
958
969
  this._core.store.state.hasViewportChanged = true;
959
970
  this._core.rerender();
960
- this._core.updateWorkspaceViewport(this._core.store.state.translateX, this._core.store.state.translateY, this._core.store.state.scale);
971
+ this._debounceUpdate();
961
972
  }
962
973
  }
963
974
  }
@@ -991,7 +1002,7 @@ class KritzelViewport {
991
1002
  this._core.store.state.translateY = viewportHeight / 2 - objectCenterY * scale;
992
1003
  this._core.store.state.hasViewportChanged = true;
993
1004
  this._core.rerender();
994
- this._core.updateWorkspaceViewport(this._core.store.state.translateX, this._core.store.state.translateY, this._core.store.state.scale);
1005
+ this._debounceUpdate();
995
1006
  }
996
1007
  centerFitInViewport(object) {
997
1008
  const scaleX = this._core.store.state.viewportWidth / (object.rotatedBoundingBox.width * 1.1);
@@ -1018,7 +1029,7 @@ class KritzelViewport {
1018
1029
  this._core.store.state.translateY = this._core.store.state.translateY - translateYAdjustment;
1019
1030
  this._core.store.state.hasViewportChanged = true;
1020
1031
  this._core.rerender();
1021
- this._core.updateWorkspaceViewport(this._core.store.state.translateX, this._core.store.state.translateY, this._core.store.state.scale);
1032
+ this._debounceUpdate();
1022
1033
  setTimeout(() => {
1023
1034
  this._core.store.state.isScaling = false;
1024
1035
  }, 300);
@@ -1029,7 +1040,7 @@ class KritzelViewport {
1029
1040
  this._core.store.state.translateY = this._core.store.state.translateY - event.deltaY * panSpeed;
1030
1041
  this._core.store.state.hasViewportChanged = true;
1031
1042
  this._core.rerender();
1032
- this._core.updateWorkspaceViewport(this._core.store.state.translateX, this._core.store.state.translateY, this._core.store.state.scale);
1043
+ this._debounceUpdate();
1033
1044
  }
1034
1045
  }
1035
1046
 
@@ -1123,7 +1134,7 @@ class KritzelContextMenuHandler extends KritzelBaseHandler {
1123
1134
  new RemoveSelectionGroupCommand(this._core, this._core.store.state.selectionGroup),
1124
1135
  new AddSelectionGroupCommand(this._core, this, selectionGroup),
1125
1136
  ]);
1126
- this._core.history.executeCommand(batch);
1137
+ this._core.commandManager.executeCommand(batch);
1127
1138
  }
1128
1139
  this._core.store.state.contextMenuItems = this._core.store.state.selectionGroup ? this.objectContextMenuItems : this.globalContextMenuItems;
1129
1140
  let x = event.clientX - this._core.store.offsetX;
@@ -1526,47 +1537,24 @@ class KritzelHistory {
1526
1537
  _core;
1527
1538
  undoStack;
1528
1539
  redoStack;
1529
- previousViewport;
1530
1540
  constructor(core) {
1531
1541
  this._core = core;
1532
1542
  this.undoStack = new KritzelCircularBuffer(this._core.store.state.historyBufferSize);
1533
1543
  this.redoStack = new KritzelCircularBuffer(this._core.store.state.historyBufferSize);
1534
- this.previousViewport = {
1535
- scale: this._core.store.state.scale,
1536
- scaleStep: this._core.store.state.scaleStep,
1537
- translateX: this._core.store.state.translateX,
1538
- translateY: this._core.store.state.translateY,
1539
- };
1540
1544
  }
1541
1545
  reset() {
1542
1546
  this.undoStack.clear();
1543
1547
  this.redoStack.clear();
1544
- this.previousViewport = {
1548
+ this._core.commandManager.previousViewport = {
1545
1549
  scale: this._core.store.state.scale,
1546
1550
  scaleStep: this._core.store.state.scaleStep,
1547
1551
  translateX: this._core.store.state.translateX,
1548
1552
  translateY: this._core.store.state.translateY
1549
1553
  };
1550
1554
  }
1551
- executeCommand(command) {
1552
- if (this._core.store.state.hasViewportChanged) {
1553
- this.addUpdateViewportCommand();
1554
- }
1555
- command.execute();
1556
- if (command.skipHistory === false) {
1557
- if (this._core.store.state.debugInfo.logCommands) {
1558
- console.info('add', command);
1559
- }
1560
- this.undoStack.add(command);
1561
- if (this.redoStack.isEmpty() === false) {
1562
- this.redoStack.clear();
1563
- }
1564
- }
1565
- this._core.rerender();
1566
- }
1567
1555
  undo() {
1568
1556
  if (this._core.store.state.hasViewportChanged) {
1569
- const command = new UpdateViewportCommand(this._core, this, this.previousViewport);
1557
+ const command = new UpdateViewportCommand(this._core, this, this._core.commandManager.previousViewport);
1570
1558
  command.undo();
1571
1559
  this._core.store.state.hasViewportChanged = false;
1572
1560
  this._core.rerender();
@@ -1592,21 +1580,6 @@ class KritzelHistory {
1592
1580
  }
1593
1581
  this._core.rerender();
1594
1582
  }
1595
- addUpdateViewportCommand() {
1596
- const command = new UpdateViewportCommand(this._core, this, this.previousViewport);
1597
- command.execute();
1598
- this.undoStack.add(command);
1599
- if (this.redoStack.isEmpty() === false) {
1600
- this.redoStack.clear();
1601
- }
1602
- this._core.store.state.hasViewportChanged = false;
1603
- this.previousViewport = {
1604
- scale: this._core.store.state.scale,
1605
- scaleStep: this._core.store.state.scaleStep,
1606
- translateX: this._core.store.state.translateX,
1607
- translateY: this._core.store.state.translateY,
1608
- };
1609
- }
1610
1583
  }
1611
1584
 
1612
1585
  class KritzelObjectMap {
@@ -1703,10 +1676,61 @@ class KritzelStore {
1703
1676
  }
1704
1677
  }
1705
1678
 
1679
+ class KritzelCommandManager {
1680
+ _core;
1681
+ _history;
1682
+ previousViewport;
1683
+ constructor(core) {
1684
+ this._core = core;
1685
+ this._history = this._core.history;
1686
+ this.previousViewport = {
1687
+ scale: this._core.store.state.scale,
1688
+ scaleStep: this._core.store.state.scaleStep,
1689
+ translateX: this._core.store.state.translateX,
1690
+ translateY: this._core.store.state.translateY,
1691
+ };
1692
+ }
1693
+ executeCommand(command) {
1694
+ if (this._core.store.state.hasViewportChanged) {
1695
+ this.addUpdateViewportCommand();
1696
+ }
1697
+ command.execute();
1698
+ if (this.isSkipped(command) === false) {
1699
+ if (this._core.store.state.debugInfo.logCommands) {
1700
+ console.log('execute', command);
1701
+ }
1702
+ this._history.undoStack.add(command);
1703
+ if (this._history.redoStack.isEmpty() === false) {
1704
+ this._history.redoStack.clear();
1705
+ }
1706
+ }
1707
+ this._core.rerender();
1708
+ }
1709
+ isSkipped(command) {
1710
+ return command.skipHistory === true;
1711
+ }
1712
+ addUpdateViewportCommand() {
1713
+ const command = new UpdateViewportCommand(this._core, this, this.previousViewport);
1714
+ command.execute();
1715
+ this._history.undoStack.add(command);
1716
+ if (this._history.redoStack.isEmpty() === false) {
1717
+ this._history.redoStack.clear();
1718
+ }
1719
+ this._core.store.state.hasViewportChanged = false;
1720
+ this.previousViewport = {
1721
+ scale: this._core.store.state.scale,
1722
+ scaleStep: this._core.store.state.scaleStep,
1723
+ translateX: this._core.store.state.translateX,
1724
+ translateY: this._core.store.state.translateY,
1725
+ };
1726
+ }
1727
+ }
1728
+
1706
1729
  class KritzelCore {
1707
1730
  _kritzelEngine;
1708
1731
  _store;
1709
1732
  _history;
1733
+ _commandManager;
1710
1734
  _database;
1711
1735
  get engine() {
1712
1736
  return this._kritzelEngine;
@@ -1714,6 +1738,9 @@ class KritzelCore {
1714
1738
  get history() {
1715
1739
  return this._history;
1716
1740
  }
1741
+ get commandManager() {
1742
+ return this._commandManager;
1743
+ }
1717
1744
  get database() {
1718
1745
  return this._database;
1719
1746
  }
@@ -1724,6 +1751,7 @@ class KritzelCore {
1724
1751
  this._kritzelEngine = kritzelEngine;
1725
1752
  this._store = new KritzelStore(DEFAULT_ENGINE_STATE);
1726
1753
  this._history = new KritzelHistory(this);
1754
+ this._commandManager = new KritzelCommandManager(this);
1727
1755
  this._database = new KritzelDatabase('kritzelDB', 1, this._store.state.debugInfo.logDatabase);
1728
1756
  }
1729
1757
  async initializeDatabase() {
@@ -1876,7 +1904,7 @@ class KritzelCore {
1876
1904
  }
1877
1905
  deselectAllObjects() {
1878
1906
  if (this._store.state.selectionGroup) {
1879
- this._history.executeCommand(new RemoveSelectionGroupCommand(this, this));
1907
+ this.commandManager.executeCommand(new RemoveSelectionGroupCommand(this, this, true));
1880
1908
  }
1881
1909
  }
1882
1910
  delete() {
@@ -1886,13 +1914,13 @@ class KritzelCore {
1886
1914
  const deleteSelectedObjectsCommand = this._store.state.selectionGroup.objects.map(obj => new RemoveObjectCommand(this, this._store.state.selectionGroup, obj));
1887
1915
  const removeSelectionGroupCommand = new RemoveSelectionGroupCommand(this, this._store.state.selectionGroup);
1888
1916
  const commands = [...deleteSelectedObjectsCommand, removeSelectionGroupCommand];
1889
- this.history.executeCommand(new BatchCommand(this, this._store.state.selectionGroup, commands));
1917
+ this.commandManager.executeCommand(new BatchCommand(this, this._store.state.selectionGroup, commands));
1890
1918
  }
1891
1919
  deleteObject(id, skipHistory = false) {
1892
1920
  const object = this.findObjectById(id);
1893
1921
  if (object) {
1894
1922
  const removeObjectCommand = new RemoveObjectCommand(this, this, object, skipHistory);
1895
- this.history.executeCommand(removeObjectCommand);
1923
+ this.commandManager.executeCommand(removeObjectCommand);
1896
1924
  }
1897
1925
  }
1898
1926
  copy() {
@@ -1926,7 +1954,7 @@ class KritzelCore {
1926
1954
  const addCopiedObjectsCommands = this._store.state.copiedObjects.objects.map(obj => new AddObjectCommand(this, this, obj));
1927
1955
  const addCopiedObjectsAsSelectionGroupCommand = new AddSelectionGroupCommand(this, this, this._store.state.copiedObjects, previousSelectionGroup);
1928
1956
  commands.push(...addCopiedObjectsCommands, addCopiedObjectsAsSelectionGroupCommand);
1929
- this.history.executeCommand(new BatchCommand(this, this, commands));
1957
+ this.commandManager.executeCommand(new BatchCommand(this, this, commands));
1930
1958
  this._store.state.isSelecting = false;
1931
1959
  this._store.state.copiedObjects = this._store.state.selectionGroup.copy();
1932
1960
  this._store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
@@ -1941,7 +1969,7 @@ class KritzelCore {
1941
1969
  }
1942
1970
  return new UpdateObjectCommand(this, this, obj, { zIndex: obj.zIndex + 1 });
1943
1971
  });
1944
- this.history.executeCommand(new BatchCommand(this, this, increaseZIndexCommands));
1972
+ this.commandManager.executeCommand(new BatchCommand(this, this, increaseZIndexCommands));
1945
1973
  }
1946
1974
  sendBackward(object) {
1947
1975
  const objects = object ? [object] : this._store.state.selectionGroup.objects;
@@ -1953,7 +1981,7 @@ class KritzelCore {
1953
1981
  }
1954
1982
  return new UpdateObjectCommand(this, this, obj, { zIndex: obj.zIndex - 1 });
1955
1983
  });
1956
- this.history.executeCommand(new BatchCommand(this, this, decreaseZIndexCommands));
1984
+ this.commandManager.executeCommand(new BatchCommand(this, this, decreaseZIndexCommands));
1957
1985
  }
1958
1986
  bringToFront(object) {
1959
1987
  const objects = object ? [object] : this._store.state.selectionGroup.objects;
@@ -1962,7 +1990,7 @@ class KritzelCore {
1962
1990
  const increaseZIndexCommands = objects.map(obj => {
1963
1991
  return new UpdateObjectCommand(this, this, obj, { zIndex: max });
1964
1992
  });
1965
- this.history.executeCommand(new BatchCommand(this, this, increaseZIndexCommands));
1993
+ this.commandManager.executeCommand(new BatchCommand(this, this, increaseZIndexCommands));
1966
1994
  }
1967
1995
  sendToBack(object) {
1968
1996
  const objects = object ? [object] : this._store.state.selectionGroup.objects;
@@ -1971,7 +1999,7 @@ class KritzelCore {
1971
1999
  const decreaseZIndexCommands = objects.map(obj => {
1972
2000
  return new UpdateObjectCommand(this, this, obj, { zIndex: min });
1973
2001
  });
1974
- this.history.executeCommand(new BatchCommand(this, this, decreaseZIndexCommands));
2002
+ this.commandManager.executeCommand(new BatchCommand(this, this, decreaseZIndexCommands));
1975
2003
  }
1976
2004
  selectObjects(objects) {
1977
2005
  if (objects.length === 0) {
@@ -1987,7 +2015,7 @@ class KritzelCore {
1987
2015
  if (objects.length === 1) {
1988
2016
  selectionGroup.rotation = selectionGroup.objects[0].rotation;
1989
2017
  }
1990
- this.history.executeCommand(new AddSelectionGroupCommand(this, this, selectionGroup));
2018
+ this.commandManager.executeCommand(new AddSelectionGroupCommand(this, this, selectionGroup));
1991
2019
  }
1992
2020
  selectAllObjectsInViewport() {
1993
2021
  const objectsInViewport = this._store.state.objectsMap
@@ -2004,13 +2032,13 @@ class KritzelCore {
2004
2032
  if (objectsInViewport.length === 1) {
2005
2033
  selectionGroup.rotation = selectionGroup.objects[0].rotation;
2006
2034
  }
2007
- this.history.executeCommand(new AddSelectionGroupCommand(this, this, selectionGroup));
2035
+ this.commandManager.executeCommand(new AddSelectionGroupCommand(this, this, selectionGroup));
2008
2036
  this._store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
2009
2037
  }
2010
2038
  }
2011
2039
  clearSelection() {
2012
- const command = new RemoveSelectionGroupCommand(this, this._store.state.selectionGroup);
2013
- this.history.executeCommand(command);
2040
+ const command = new RemoveSelectionGroupCommand(this, this);
2041
+ this.commandManager.executeCommand(command);
2014
2042
  this._store.state.selectionGroup = null;
2015
2043
  this._store.state.selectionBox = null;
2016
2044
  this._store.state.isSelecting = false;
@@ -2021,11 +2049,9 @@ class KritzelCore {
2021
2049
  resetActiveText() {
2022
2050
  if (this._store.state.activeText) {
2023
2051
  if (this._store.state.activeText.isEmpty) {
2024
- console.log('Deleting empty text object', this._store.state.activeText.id);
2025
2052
  this.deleteObject(this._store.state.activeText.id, true);
2026
2053
  }
2027
2054
  else {
2028
- console.log('Saving active text object before resetting', this._store.state.activeText.id);
2029
2055
  this._store.state.activeText.save();
2030
2056
  }
2031
2057
  }
@@ -2082,15 +2108,21 @@ class KritzelCore {
2082
2108
  const worldY = yWithoutTranslate / this._store.state.scale;
2083
2109
  return { x: worldX, y: worldY };
2084
2110
  }
2111
+ beforeWorkspaceChange() {
2112
+ this.resetActiveText();
2113
+ this.clearSelection();
2114
+ this._store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
2115
+ }
2085
2116
  }
2086
2117
 
2087
- const kritzelEngineCss = ":host{display:block;position:relative;height:100%;width:100%;overflow:hidden;background-color:var(--kritzel-engine-background-color, #ffffff)}:host,:host *{touch-action:none;user-select:none}.ProseMirror{outline:none}p{margin:0;padding:0}.debug-panel{position:absolute;pointer-events:none;top:0;right:0}.origin{position:relative;top:0;left:0;height:0;width:0;pointer-events:none;-webkit-transform-origin:top left;-moz-transform-origin:top left;transform-origin:top left;overflow:visible}.object{overflow:visible}.resize-handle-overlay.top-left,.resize-handle-overlay.bottom-right{cursor:nwse-resize}.resize-handle-overlay.top-right,.resize-handle-overlay.bottom-left{cursor:nesw-resize}.rotation-handle-overlay{cursor:grab}.PlaygroundEditorTheme__quote{margin:0;margin-left:20px;margin-bottom:10px;font-size:15px;color:rgb(101, 103, 107);border-left-color:rgb(206, 208, 212);border-left-width:4px;border-left-style:solid;padding-left:16px}";
2118
+ const kritzelEngineCss = ":host{display:block;position:relative;height:100%;width:100%;overflow:hidden;background-color:var(--kritzel-engine-background-color, #ffffff)}:host,:host *{touch-action:none;user-select:none}.ProseMirror{outline:none}p,h1,h2,h3,h4,h5,h6,blockquote,pre{margin:0;padding:0}.debug-panel{position:absolute;pointer-events:none;top:0;right:0}.origin{position:relative;top:0;left:0;height:0;width:0;pointer-events:none;-webkit-transform-origin:top left;-moz-transform-origin:top left;transform-origin:top left;overflow:visible}.object{overflow:visible}.resize-handle-overlay.top-left,.resize-handle-overlay.bottom-right{cursor:nwse-resize}.resize-handle-overlay.top-right,.resize-handle-overlay.bottom-left{cursor:nesw-resize}.rotation-handle-overlay{cursor:grab}.PlaygroundEditorTheme__quote{margin:0;margin-left:20px;margin-bottom:10px;font-size:15px;color:rgb(101, 103, 107);border-left-color:rgb(206, 208, 212);border-left-width:4px;border-left-style:solid;padding-left:16px}";
2088
2119
 
2089
2120
  const KritzelEngine = class {
2090
2121
  get host() { return getElement(this); }
2091
2122
  workspace;
2092
2123
  onWorkspaceChange(newWorkspace) {
2093
2124
  if (this.core.store.state.activeWorkspace !== newWorkspace) {
2125
+ this.core.beforeWorkspaceChange();
2094
2126
  this.core.initializeWorkspace(newWorkspace);
2095
2127
  }
2096
2128
  }
@@ -2276,19 +2308,19 @@ const KritzelEngine = class {
2276
2308
  object.scale = object.scale ? object.scale : this.core.store.state.scale;
2277
2309
  object.zIndex = this.core.store.currentZIndex;
2278
2310
  const command = new AddObjectCommand(this.core, this, object);
2279
- this.core.history.executeCommand(command);
2311
+ this.core.commandManager.executeCommand(command);
2280
2312
  return object;
2281
2313
  }
2282
2314
  async updateObject(object, updatedProperties) {
2283
2315
  this.core.deselectAllObjects();
2284
2316
  const command = new UpdateObjectCommand(this.core, this, object, updatedProperties);
2285
- this.core.history.executeCommand(command);
2317
+ this.core.commandManager.executeCommand(command);
2286
2318
  return object;
2287
2319
  }
2288
2320
  async removeObject(object) {
2289
2321
  this.core.deselectAllObjects();
2290
2322
  const command = new RemoveObjectCommand(this.core, this, object);
2291
- this.core.history.executeCommand(command);
2323
+ this.core.commandManager.executeCommand(command);
2292
2324
  return object;
2293
2325
  }
2294
2326
  async getSelectedObjects() {
@@ -2312,7 +2344,7 @@ const KritzelEngine = class {
2312
2344
  async centerObjectInViewport(object) {
2313
2345
  object.centerInViewport();
2314
2346
  const command = new UpdateObjectCommand(this.core, this, object, object);
2315
- this.core.history.executeCommand(command);
2347
+ this.core.commandManager.executeCommand(command);
2316
2348
  return object;
2317
2349
  }
2318
2350
  async getCopiedObjects() {
@@ -2379,11 +2411,16 @@ const KritzelEngine = class {
2379
2411
  _handleActiveToolChange(activeTool) {
2380
2412
  if (!(activeTool instanceof KritzelSelectionTool)) {
2381
2413
  this.core.clearSelection();
2414
+ this.core.store.state.selectionBox = null;
2415
+ this.core.store.state.isSelecting = false;
2416
+ this.core.store.state.isResizeHandleSelected = false;
2417
+ this.core.store.state.isRotationHandleSelected = false;
2382
2418
  }
2383
2419
  this.core.store.state.skipContextMenu = false;
2384
2420
  this.core.store.state.copiedObjects = null;
2385
2421
  this.activeToolChange.emit(activeTool);
2386
2422
  KritzelKeyboardHelper.forceHideKeyboard();
2423
+ this.core.rerender();
2387
2424
  }
2388
2425
  render() {
2389
2426
  const computedStyle = window.getComputedStyle(this.host);
@@ -2392,7 +2429,7 @@ const KritzelEngine = class {
2392
2429
  const baseHandleTouchSize = baseHandleSize * 2 < 14 ? 14 : baseHandleSize;
2393
2430
  const viewportCenterX = this.core.store.state.viewportWidth / 2 + this.core.store.state.translateX;
2394
2431
  const viewportCenterY = this.core.store.state.viewportHeight / 2 + this.core.store.state.translateY;
2395
- return (h(Host, { key: 'caabd1ecbf2faccdf7fa50d087a8957df4dd1039' }, h("div", { key: 'd757e7133ed9dd190c17c383fb716f760f2b3906', class: "debug-panel", style: { display: this.core.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, h("div", { key: '00ced12dd956b6eecff7ac80429c0fd05cc7d1c3' }, "ActiveWorkspaceId: ", this.core.store.state?.activeWorkspace?.id), h("div", { key: '771f3269627fbe1ef962027f017cf6bdec7bcf8f' }, "ActiveWorkspaceName: ", this.core.store.state?.activeWorkspace?.name), h("div", { key: '0e49a60afdfb776a61f46b53bd6488786778bf77' }, "TranslateX: ", this.core.store.state?.translateX), h("div", { key: 'e0438479bc9e950ef2cbe88ed0aa0b8ec1888890' }, "TranslateY: ", this.core.store.state?.translateY), h("div", { key: '41d7261ed6b893a97fefb4bb6b199ffea51bd5fe' }, "ViewportWidth: ", this.core.store.state?.viewportWidth), h("div", { key: '7b6470008968eeebc5097252b3b9e3d172fd5d22' }, "ViewportHeight: ", this.core.store.state?.viewportHeight), h("div", { key: '4012ebdc3234ee2775021b38f385dfa0917736cb' }, "Scale: ", this.core.store.state?.scale), h("div", { key: '964d26a0ff4ff93dfa1cc928330c4fbdb0ec9b3d' }, "ActiveTool: ", this.core.store.state?.activeTool?.name), h("div", { key: 'cd68a81778d3e0f83f9453cd813538b2223541e8' }, "HasViewportChanged: ", this.core.store.state?.hasViewportChanged ? 'true' : 'false'), h("div", { key: '2ea80f3b4216a5e3d727c6c94d8b1782fbde80eb' }, "IsEnabled: ", this.core.store.state?.isEnabled ? 'true' : 'false'), h("div", { key: '02966d69182e95a8e91d5252f3dcfc19237caafd' }, "IsScaling: ", this.core.store.state?.isScaling ? 'true' : 'false'), h("div", { key: '85c06265f3af2b793d1827a40bb74b8837690ce3' }, "IsPanning: ", this.core.store.state?.isPanning ? 'true' : 'false'), h("div", { key: '1a2847a815fabc37cae3b7659844975df0c79a81' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), h("div", { key: 'd1482aa165ed6b430ec0e640971c47e233103e87' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), h("div", { key: '3534e455918183d822374edbc80b621939100bd1' }, "IsResizeHandleSelected: ", this.core.store.state.isResizeHandleSelected ? 'true' : 'false'), h("div", { key: '7b061a4b08956660ee305316eea2e1d13d66d5de' }, "IsRotationHandleSelected: ", this.core.store.state.isRotationHandleSelected ? 'true' : 'false'), h("div", { key: '61998d0f4ffc65f5bb155dfe434a3a07667ca5ee' }, "IsDrawing: ", this.core.store.state.isDrawing ? 'true' : 'false'), h("div", { key: 'bdaeb0af59e844351eb46caf7bbe7e246174ccfe' }, "IsWriting: ", this.core.store.state.isWriting ? 'true' : 'false'), h("div", { key: '47518514eb67c486583ee61e6747104b4720924a' }, "PointerX: ", this.core.store.state?.pointerX), h("div", { key: '9b2ef1c30ecb09bc7df7f765e099f87ea836d697' }, "PointerY: ", this.core.store.state?.pointerY), h("div", { key: '72a65218942809918fb5fa1978af83f9442c3ed8' }, "SelectedObjects: ", this.core.store.state.selectionGroup?.objects.length || 0), h("div", { key: '1f2ad6b79f28306becd7e83f21ca877c7d15941d' }, "ViewportCenter: (", viewportCenterX.toFixed(2), ", ", viewportCenterY.toFixed(2), ")")), h("div", { key: 'ae8afa17ce2a1c0a06a3579091d6f1616fe9b9a7', id: "origin", class: "origin", style: {
2432
+ return (h(Host, { key: 'f7fc3c4c6a91ccdabb83832671e36ebf49ce56c0' }, h("div", { key: 'f6a2ce9e78a1d0e9ea0590035f5b8811f62c8633', class: "debug-panel", style: { display: this.core.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, h("div", { key: '5752045746f275223bd42c16dd7e848adaaae9f2' }, "ActiveWorkspaceId: ", this.core.store.state?.activeWorkspace?.id), h("div", { key: 'd99595b135243a7b69a583be33f7b195908ec716' }, "ActiveWorkspaceName: ", this.core.store.state?.activeWorkspace?.name), h("div", { key: '7cecdccad47d3957370ea923f3dfbcd618b5d28e' }, "TranslateX: ", this.core.store.state?.translateX), h("div", { key: '3a5ed989f2343eda92c7c81855c785dbf58fa770' }, "TranslateY: ", this.core.store.state?.translateY), h("div", { key: 'b78074a29463276300ce498b2ddb328cef9026cd' }, "ViewportWidth: ", this.core.store.state?.viewportWidth), h("div", { key: 'd4c8dcfddfa1984eedf695d74f9401fc3284c60b' }, "ViewportHeight: ", this.core.store.state?.viewportHeight), h("div", { key: '566b6dc9afd904ee49e59587ed664e5f46decead' }, "Scale: ", this.core.store.state?.scale), h("div", { key: 'd3feb7a11727c4337ca75a26b3275a0b5d639961' }, "ActiveTool: ", this.core.store.state?.activeTool?.name), h("div", { key: '3991c34df53c7d6fd97c83b0d4b8c9fb438c88fc' }, "HasViewportChanged: ", this.core.store.state?.hasViewportChanged ? 'true' : 'false'), h("div", { key: '5a4244b43871f96d08144483352064804f04e538' }, "IsEnabled: ", this.core.store.state?.isEnabled ? 'true' : 'false'), h("div", { key: '197655c09e24d624ea4dcd312169aeb449ed57ce' }, "IsScaling: ", this.core.store.state?.isScaling ? 'true' : 'false'), h("div", { key: 'a3e4a75a9853c8cee1485cbf8621377466babf90' }, "IsPanning: ", this.core.store.state?.isPanning ? 'true' : 'false'), h("div", { key: '171e0df3e1856e9fe8cd18be5c258c7472317453' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), h("div", { key: '66f5a56333dbac1da34e01f5ee1f577e1a964701' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), h("div", { key: 'b869e07b76c2fa21ab5383788e81a40ffdad1b2c' }, "IsResizeHandleSelected: ", this.core.store.state.isResizeHandleSelected ? 'true' : 'false'), h("div", { key: 'd936326f8ea675e170d418f4e97a5d46057bc385' }, "IsRotationHandleSelected: ", this.core.store.state.isRotationHandleSelected ? 'true' : 'false'), h("div", { key: '8594489402204ae4a9cd1bc7795169dbfa2d633d' }, "IsDrawing: ", this.core.store.state.isDrawing ? 'true' : 'false'), h("div", { key: 'f7a254dc35bfe6d42c32d25d0f277b211d86b03f' }, "IsWriting: ", this.core.store.state.isWriting ? 'true' : 'false'), h("div", { key: '053ebd21504bfa3622e4b3e965e39f707c19794d' }, "PointerX: ", this.core.store.state?.pointerX), h("div", { key: 'f330c65821326062874441355352134927760d61' }, "PointerY: ", this.core.store.state?.pointerY), h("div", { key: 'f6c6902562f3e74afa3a0426e72b0c803977250b' }, "SelectedObjects: ", this.core.store.state.selectionGroup?.objects.length || 0), h("div", { key: '99a2d4280d5e79d7dd9a7a27d809e70f90eac38b' }, "ViewportCenter: (", viewportCenterX.toFixed(2), ", ", viewportCenterY.toFixed(2), ")")), h("div", { key: 'dac21fa0ac9487b74c89ac7408e80d9fb89b4558', id: "origin", class: "origin", style: {
2396
2433
  transform: `matrix(${this.core.store.state?.scale}, 0, 0, ${this.core.store.state?.scale}, ${this.core.store.state?.translateX}, ${this.core.store.state?.translateY})`,
2397
2434
  } }, this.core.store.state.objectsMap.allObjects()?.map(object => {
2398
2435
  return (h("div", { key: object.id, style: {
@@ -2420,17 +2457,17 @@ const KritzelEngine = class {
2420
2457
  borderStyle: 'solid',
2421
2458
  padding: object.padding + 'px',
2422
2459
  overflow: 'visible',
2423
- } }, KritzelClassHelper.isInstanceOf(object, 'KritzelPath') && (h("svg", { ref: el => (el ? object.mount(el) : object.unmount()), xmlns: "http://www.w3.org/2000/svg", style: {
2460
+ } }, KritzelClassHelper.isInstanceOf(object, 'KritzelPath') && (h("svg", { ref: el => object.mount(el), xmlns: "http://www.w3.org/2000/svg", style: {
2424
2461
  height: object?.height.toString(),
2425
2462
  width: object?.width.toString(),
2426
2463
  position: 'absolute',
2427
2464
  overflow: 'visible',
2428
- }, viewBox: object?.viewBox }, h("path", { d: object?.d, fill: object.fill, stroke: object?.stroke }))), KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && (h("img", { ref: el => (el ? object.mount(el) : object.unmount()), src: object.src, style: {
2465
+ }, viewBox: object?.viewBox }, h("path", { d: object?.d, fill: object.fill, stroke: object?.stroke }))), KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && (h("img", { ref: el => object.mount(el), src: object.src, style: {
2429
2466
  width: '100%',
2430
2467
  height: '100%',
2431
2468
  userSelect: 'none',
2432
2469
  pointerEvents: 'none',
2433
- }, draggable: false, onDragStart: e => e.preventDefault() })), KritzelClassHelper.isInstanceOf(object, 'KritzelText') && (h("div", { ref: el => (el ? object.mount(el) : object.unmount()), onPointerDown: e => object.handlePointerDown(e), onPointerMove: e => object.handlePointerMove(e), onPointerUp: e => object.handlePointerUp(e), style: {
2470
+ }, draggable: false, onDragStart: e => e.preventDefault() })), KritzelClassHelper.isInstanceOf(object, 'KritzelText') && (h("div", { ref: el => object.mount(el), onPointerDown: e => object.handlePointerDown(e), onPointerMove: e => object.handlePointerMove(e), onPointerUp: e => object.handlePointerUp(e), style: {
2434
2471
  minWidth: object.initialWidth + 'px',
2435
2472
  minHeight: object.initialHeight + 'px',
2436
2473
  maxWidth: '500px',
@@ -2439,17 +2476,17 @@ const KritzelEngine = class {
2439
2476
  transformOrigin: 'top left',
2440
2477
  transform: `scale(${object.scaleFactor})`,
2441
2478
  backgroundColor: object.backgroundColor,
2442
- overflow: 'visible'
2443
- } })), KritzelClassHelper.isInstanceOf(object, 'KritzelCustomElement') && (h("div", { ref: el => (el ? object.mount(el) : object.unmount()), style: {
2479
+ overflow: 'visible',
2480
+ } })), KritzelClassHelper.isInstanceOf(object, 'KritzelCustomElement') && (h("div", { ref: el => object.mount(el), style: {
2444
2481
  width: '100%',
2445
2482
  height: '100%',
2446
2483
  pointerEvents: 'auto',
2447
2484
  overflow: 'hidden',
2448
2485
  display: 'block',
2449
- } })), KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionGroup') && (h("div", { ref: el => (el ? object.mount(el) : object.unmount()), style: {
2486
+ } })), KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionGroup') && (h("div", { ref: el => object.mount(el), style: {
2450
2487
  width: '100%',
2451
2488
  height: '100%',
2452
- } })), KritzelClassHelper.isInstanceOf(object, 'KrtizelSelectionBox') && (h("div", { ref: el => (el ? object.mount(el) : object.unmount()), style: {
2489
+ } })), KritzelClassHelper.isInstanceOf(object, 'KrtizelSelectionBox') && (h("div", { ref: el => object.mount(el), style: {
2453
2490
  width: '100%',
2454
2491
  height: '100%',
2455
2492
  backgroundColor: KritzelDevicesHelper.isFirefox() ? object.backgroundColor : 'transparent',
@@ -2496,7 +2533,7 @@ const KritzelEngine = class {
2496
2533
  }, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), h("circle", { class: "rotation-handle-overlay", cx: object.totalWidth / 2, cy: -((15 * object.scale) / this.core.store.state?.scale), r: `${(baseHandleTouchSize * object.scale) / this.core.store.state?.scale}`, style: {
2497
2534
  fill: 'transparent',
2498
2535
  cursor: 'grab',
2499
- }, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), h("g", { style: { display: this.core.store.state.debugInfo.showObjectInfo ? 'block' : 'none', pointerEvents: 'none' } }, h("foreignObject", { x: object.totalWidth.toString(), y: "0", width: "400px", height: "160px", style: { minHeight: '0', minWidth: '0', display: object.isDebugInfoVisible ? 'block' : 'none' } }, h("div", { style: { width: '100%', height: '100%' } }, h("div", { style: { whiteSpace: 'nowrap' } }, "zIndex: ", object.zIndex), h("div", { style: { whiteSpace: 'nowrap' } }, "translateX: ", object.translateX), h("div", { style: { whiteSpace: 'nowrap' } }, "translateY: ", object.translateY), h("div", { style: { whiteSpace: 'nowrap' } }, "width: ", object.width), h("div", { style: { whiteSpace: 'nowrap' } }, "height: ", object.height), h("div", { style: { whiteSpace: 'nowrap' } }, "scale: ", object.scale), h("div", { style: { whiteSpace: 'nowrap' } }, "rotation: ", object.rotation), h("div", { style: { whiteSpace: 'nowrap' } }, "x: ", object.x), h("div", { style: { whiteSpace: 'nowrap' } }, "y: ", object.y)))))));
2536
+ }, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), h("g", { style: { display: this.core.store.state.debugInfo.showObjectInfo ? 'block' : 'none', pointerEvents: 'none' } }, h("foreignObject", { x: object.totalWidth.toString(), y: "0", width: "400px", height: "160px", style: { minHeight: '0', minWidth: '0', display: object.isDebugInfoVisible ? 'block' : 'none' } }, h("div", { style: { width: '100%', height: '100%' } }, h("div", { style: { whitespace: 'nowrap' } }, "Id: ", object.id), h("div", { style: { whiteSpace: 'nowrap' } }, "width: ", object.width), h("div", { style: { whiteSpace: 'nowrap' } }, "height: ", object.height)))))));
2500
2537
  }), h("svg", { key: "current-path", class: "object", xmlns: "http://www.w3.org/2000/svg", width: this.core.store.state.currentPath?.width, height: this.core.store.state.currentPath?.height, style: {
2501
2538
  left: '0',
2502
2539
  top: '0',
@@ -2505,7 +2542,7 @@ const KritzelEngine = class {
2505
2542
  transform: this.core.store.state.currentPath?.transformationMatrix,
2506
2543
  transformOrigin: 'top left',
2507
2544
  overflow: 'visible',
2508
- }, viewBox: this.core.store.state.currentPath?.viewBox }, h("path", { key: '9428a1401021b38b8b811fd68af9e24d53301c08', d: this.core.store.state.currentPath?.d, fill: this.core.store.state.currentPath?.fill, stroke: this.core.store.state.currentPath?.stroke }))), this.core.store.state.isContextMenuVisible && (h("kritzel-context-menu", { key: '1ccc963df66e4210886717644503be6304c6c99f', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.core.store.state.contextMenuItems, objects: this.core.store.state.selectionGroup?.objects || [], style: {
2545
+ }, viewBox: this.core.store.state.currentPath?.viewBox }, h("path", { key: 'f3aaf24804430eeb0308a15ae4a38df302d0566f', d: this.core.store.state.currentPath?.d, fill: this.core.store.state.currentPath?.fill, stroke: this.core.store.state.currentPath?.stroke }))), this.core.store.state.isContextMenuVisible && (h("kritzel-context-menu", { key: 'd99a76a11b613167d5723d1c16e9289e45eee8a3', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.core.store.state.contextMenuItems, objects: this.core.store.state.selectionGroup?.objects || [], style: {
2509
2546
  position: 'fixed',
2510
2547
  left: `${this.core.store.state.contextMenuX}px`,
2511
2548
  top: `${this.core.store.state.contextMenuY}px`,
@@ -2516,7 +2553,7 @@ const KritzelEngine = class {
2516
2553
  y: (-this.core.store.state.translateY + this.core.store.state.contextMenuY) / this.core.store.state.scale,
2517
2554
  }, this.core.store.state.selectionGroup?.objects);
2518
2555
  this.hideContextMenu();
2519
- }, onClose: () => this.hideContextMenu() })), this.core.store.state?.activeTool instanceof KritzelEraserTool && !this.core.store.state.isScaling && h("kritzel-cursor-trail", { key: '9b51e52c76f21be679491c21d1921d389d6619fc', core: this.core })));
2556
+ }, onClose: () => this.hideContextMenu() })), this.core.store.state?.activeTool instanceof KritzelEraserTool && !this.core.store.state.isScaling && h("kritzel-cursor-trail", { key: 'fc7c474156442dfb5c057ef4ed4f0e5f015c2502', core: this.core })));
2520
2557
  }
2521
2558
  static get watchers() { return {
2522
2559
  "workspace": ["onWorkspaceChange"],
@@ -1,2 +1,2 @@
1
- export{D as DEFAULT_BRUSH_CONFIG,e as DEFAULT_TEXT_CONFIG,K as KritzelBrushTool,d as KritzelEraserTool,u as KritzelImage,f as KritzelImageTool,t as KritzelPath,c as KritzelSelectionTool,s as KritzelText,a as KritzelTextTool,g as KritzelWorkspace}from"./p-D0Q2MKPn.js";
1
+ export{D as DEFAULT_BRUSH_CONFIG,e as DEFAULT_TEXT_CONFIG,K as KritzelBrushTool,d as KritzelEraserTool,u as KritzelImage,f as KritzelImageTool,t as KritzelPath,c as KritzelSelectionTool,s as KritzelText,a as KritzelTextTool,g as KritzelWorkspace}from"./p-SIM_s7ed.js";
2
2
  //# sourceMappingURL=index.esm.js.map