kritzel-stencil 0.0.164 → 0.0.166

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 (44) hide show
  1. package/dist/cjs/{default-line-tool.config-DJMYrkSu.js → default-line-tool.config-BNBO4I1t.js} +59 -36
  2. package/dist/cjs/default-line-tool.config-BNBO4I1t.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +1 -1
  4. package/dist/cjs/kritzel-color_22.cjs.entry.js +17 -8
  5. package/dist/collection/classes/core/core.class.js +9 -0
  6. package/dist/collection/classes/core/core.class.js.map +1 -1
  7. package/dist/collection/classes/objects/line.class.js +4 -3
  8. package/dist/collection/classes/objects/line.class.js.map +1 -1
  9. package/dist/collection/classes/objects/selection-group.class.js +4 -1
  10. package/dist/collection/classes/objects/selection-group.class.js.map +1 -1
  11. package/dist/collection/classes/tools/brush-tool.class.js +45 -30
  12. package/dist/collection/classes/tools/brush-tool.class.js.map +1 -1
  13. package/dist/collection/classes/tools/selection-tool.class.js +4 -0
  14. package/dist/collection/classes/tools/selection-tool.class.js.map +1 -1
  15. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +7 -7
  16. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
  17. package/dist/components/index.js +3 -3
  18. package/dist/components/kritzel-controls.js +1 -1
  19. package/dist/components/kritzel-editor.js +3 -3
  20. package/dist/components/kritzel-engine.js +1 -1
  21. package/dist/components/{p-Dz2XHHqa.js → p-Bwv1dxAB.js} +47 -32
  22. package/dist/components/{p-Dz2XHHqa.js.map → p-Bwv1dxAB.js.map} +1 -1
  23. package/dist/components/{p-DzUUppVL.js → p-CIXaR1a8.js} +31 -14
  24. package/dist/components/p-CIXaR1a8.js.map +1 -0
  25. package/dist/components/{p-tp96UZ0l.js → p-CRtmNOp1.js} +3 -3
  26. package/dist/components/{p-tp96UZ0l.js.map → p-CRtmNOp1.js.map} +1 -1
  27. package/dist/esm/{default-line-tool.config-C35P3XfD.js → default-line-tool.config-DJ488kil.js} +59 -36
  28. package/dist/{cjs/default-line-tool.config-DJMYrkSu.js.map → esm/default-line-tool.config-DJ488kil.js.map} +1 -1
  29. package/dist/esm/index.js +2 -2
  30. package/dist/esm/kritzel-color_22.entry.js +17 -8
  31. package/dist/stencil/index.esm.js +1 -1
  32. package/dist/stencil/{p-3e2b5c42.entry.js → p-3df115ed.entry.js} +3 -3
  33. package/dist/stencil/p-3df115ed.entry.js.map +1 -0
  34. package/dist/stencil/p-DJ488kil.js +2 -0
  35. package/dist/stencil/p-DJ488kil.js.map +1 -0
  36. package/dist/stencil/stencil.esm.js +1 -1
  37. package/dist/types/classes/objects/selection-group.class.d.ts +1 -0
  38. package/dist/types/classes/tools/brush-tool.class.d.ts +1 -0
  39. package/package.json +1 -1
  40. package/dist/components/p-DzUUppVL.js.map +0 -1
  41. package/dist/esm/default-line-tool.config-C35P3XfD.js.map +0 -1
  42. package/dist/stencil/p-3e2b5c42.entry.js.map +0 -1
  43. package/dist/stencil/p-C35P3XfD.js +0 -2
  44. package/dist/stencil/p-C35P3XfD.js.map +0 -1
@@ -14639,9 +14639,10 @@ class KritzelBrushTool extends KritzelBaseTool {
14639
14639
  color = '#000000';
14640
14640
  size = 6;
14641
14641
  palettes = {
14642
- pen: ['#000000', '#FFFFFF', '#FF0000', '#00FF00', '#0000FF', '#FFFF00', '#FF00FF', '#00FFFF', '#808080', '#C0C0C0', '#800000', '#008000', '#000080', '#808000', '#800080'],
14642
+ pen: ['#000000', '#FFFFFF', '#FF0000', '#00FF00', '#0000FF', '#FFFF00', '#FF00FF', '#00FFFF', '#808080', '#C0C0C0', '#800000', '#008000', '#000080', '#800080'],
14643
14643
  highlighter: ['#ffff00', '#ffb347', '#b4ffb4'],
14644
14644
  };
14645
+ _currentPathId = null;
14645
14646
  constructor(core) {
14646
14647
  super(core);
14647
14648
  }
@@ -14663,6 +14664,7 @@ class KritzelBrushTool extends KritzelBaseTool {
14663
14664
  strokeWidth: this.size,
14664
14665
  });
14665
14666
  path.isCompleted = false;
14667
+ this._currentPathId = path.id;
14666
14668
  this._core.store.state.objects.insert(path);
14667
14669
  }
14668
14670
  }
@@ -14681,6 +14683,7 @@ class KritzelBrushTool extends KritzelBaseTool {
14681
14683
  strokeWidth: this.size,
14682
14684
  });
14683
14685
  path.isCompleted = false;
14686
+ this._currentPathId = path.id;
14684
14687
  this._core.store.state.objects.insert(path);
14685
14688
  }
14686
14689
  }
@@ -14690,8 +14693,9 @@ class KritzelBrushTool extends KritzelBaseTool {
14690
14693
  event.preventDefault();
14691
14694
  }
14692
14695
  if (event.pointerType === 'mouse') {
14693
- if (this._core.store.state.isDrawing) {
14694
- const currentPath = this._core.store.currentPath;
14696
+ if (this._core.store.state.isDrawing && this._currentPathId) {
14697
+ const matchingObjects = this._core.store.state.objects.filter(o => o.id === this._currentPathId);
14698
+ const currentPath = matchingObjects.length > 0 ? matchingObjects[0] : null;
14695
14699
  if (currentPath) {
14696
14700
  const x = event.clientX - this._core.store.offsetX;
14697
14701
  const y = event.clientY - this._core.store.offsetY;
@@ -14714,23 +14718,26 @@ class KritzelBrushTool extends KritzelBaseTool {
14714
14718
  if (event.pointerType === 'touch') {
14715
14719
  const activePointers = Array.from(this._core.store.state.pointers.values());
14716
14720
  if (activePointers.length === 1) {
14717
- const currentPath = this._core.store.currentPath;
14718
- if (currentPath) {
14719
- const x = Math.round(activePointers[0].clientX - this._core.store.offsetX);
14720
- const y = Math.round(activePointers[0].clientY - this._core.store.offsetY);
14721
- const updatedPath = KritzelPath.create(this._core, {
14722
- points: [...currentPath.points, [x, y]],
14723
- translateX: -this._core.store.state.translateX,
14724
- translateY: -this._core.store.state.translateY,
14725
- scale: this._core.store.state.scale,
14726
- fill: this.color,
14727
- strokeWidth: this.size,
14728
- });
14729
- updatedPath.id = currentPath.id;
14730
- updatedPath.workspaceId = currentPath.workspaceId;
14731
- updatedPath.zIndex = currentPath.zIndex;
14732
- updatedPath.isCompleted = false;
14733
- this._core.store.state.objects.update(updatedPath);
14721
+ if (this._currentPathId) {
14722
+ const matchingObjects = this._core.store.state.objects.filter(o => o.id === this._currentPathId);
14723
+ const currentPath = matchingObjects.length > 0 ? matchingObjects[0] : null;
14724
+ if (currentPath) {
14725
+ const x = Math.round(activePointers[0].clientX - this._core.store.offsetX);
14726
+ const y = Math.round(activePointers[0].clientY - this._core.store.offsetY);
14727
+ const updatedPath = KritzelPath.create(this._core, {
14728
+ points: [...currentPath.points, [x, y]],
14729
+ translateX: -this._core.store.state.translateX,
14730
+ translateY: -this._core.store.state.translateY,
14731
+ scale: this._core.store.state.scale,
14732
+ fill: this.color,
14733
+ strokeWidth: this.size,
14734
+ });
14735
+ updatedPath.id = currentPath.id;
14736
+ updatedPath.workspaceId = currentPath.workspaceId;
14737
+ updatedPath.zIndex = currentPath.zIndex;
14738
+ updatedPath.isCompleted = false;
14739
+ this._core.store.state.objects.update(updatedPath);
14740
+ }
14734
14741
  }
14735
14742
  }
14736
14743
  }
@@ -14742,22 +14749,30 @@ class KritzelBrushTool extends KritzelBaseTool {
14742
14749
  if (event.pointerType === 'mouse') {
14743
14750
  if (this._core.store.state.isDrawing) {
14744
14751
  this._core.store.state.isDrawing = false;
14745
- const currentPath = this._core.store.currentPath;
14746
- if (currentPath) {
14747
- currentPath.isCompleted = true;
14748
- this._core.store.state.objects.update(currentPath);
14749
- this._core.engine.emitObjectsChange();
14752
+ if (this._currentPathId) {
14753
+ const matchingObjects = this._core.store.state.objects.filter(o => o.id === this._currentPathId);
14754
+ const currentPath = matchingObjects.length > 0 ? matchingObjects[0] : null;
14755
+ if (currentPath) {
14756
+ currentPath.isCompleted = true;
14757
+ this._core.store.state.objects.update(currentPath);
14758
+ this._core.engine.emitObjectsChange();
14759
+ }
14760
+ this._currentPathId = null;
14750
14761
  }
14751
14762
  }
14752
14763
  }
14753
14764
  if (event.pointerType === 'touch') {
14754
14765
  if (this._core.store.state.isDrawing) {
14755
14766
  this._core.store.state.isDrawing = false;
14756
- const currentPath = this._core.store.currentPath;
14757
- if (currentPath) {
14758
- currentPath.isCompleted = true;
14759
- this._core.store.state.objects.update(currentPath);
14760
- this._core.engine.emitObjectsChange();
14767
+ if (this._currentPathId) {
14768
+ const matchingObjects = this._core.store.state.objects.filter(o => o.id === this._currentPathId);
14769
+ const currentPath = matchingObjects.length > 0 ? matchingObjects[0] : null;
14770
+ if (currentPath) {
14771
+ currentPath.isCompleted = true;
14772
+ this._core.store.state.objects.update(currentPath);
14773
+ this._core.engine.emitObjectsChange();
14774
+ }
14775
+ this._currentPathId = null;
14761
14776
  }
14762
14777
  }
14763
14778
  }
@@ -14869,6 +14884,6 @@ class KritzelTextTool extends KritzelBaseTool {
14869
14884
  }
14870
14885
 
14871
14886
  export { EditorView as E, KritzelText as K, Schema as S, TextSelection as T, KritzelPath as a, KritzelBrushTool as b, KritzelTextTool as c, KritzelKeyboardHelper as d, KritzelBaseObject as e, KritzelGeometryHelper as f, KritzelBaseTool as g, KritzelEventHelper as h, KritzelToolRegistry as i, addListNodes as j, EditorState as k, keymap as l, baseKeymap as m, schema as s };
14872
- //# sourceMappingURL=p-Dz2XHHqa.js.map
14887
+ //# sourceMappingURL=p-Bwv1dxAB.js.map
14873
14888
 
14874
- //# sourceMappingURL=p-Dz2XHHqa.js.map
14889
+ //# sourceMappingURL=p-Bwv1dxAB.js.map