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.
- package/dist/cjs/{default-line-tool.config-DJMYrkSu.js → default-line-tool.config-BNBO4I1t.js} +59 -36
- package/dist/cjs/default-line-tool.config-BNBO4I1t.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/kritzel-color_22.cjs.entry.js +17 -8
- package/dist/collection/classes/core/core.class.js +9 -0
- package/dist/collection/classes/core/core.class.js.map +1 -1
- package/dist/collection/classes/objects/line.class.js +4 -3
- package/dist/collection/classes/objects/line.class.js.map +1 -1
- package/dist/collection/classes/objects/selection-group.class.js +4 -1
- package/dist/collection/classes/objects/selection-group.class.js.map +1 -1
- package/dist/collection/classes/tools/brush-tool.class.js +45 -30
- package/dist/collection/classes/tools/brush-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/selection-tool.class.js +4 -0
- package/dist/collection/classes/tools/selection-tool.class.js.map +1 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +7 -7
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
- package/dist/components/index.js +3 -3
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-editor.js +3 -3
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/{p-Dz2XHHqa.js → p-Bwv1dxAB.js} +47 -32
- package/dist/components/{p-Dz2XHHqa.js.map → p-Bwv1dxAB.js.map} +1 -1
- package/dist/components/{p-DzUUppVL.js → p-CIXaR1a8.js} +31 -14
- package/dist/components/p-CIXaR1a8.js.map +1 -0
- package/dist/components/{p-tp96UZ0l.js → p-CRtmNOp1.js} +3 -3
- package/dist/components/{p-tp96UZ0l.js.map → p-CRtmNOp1.js.map} +1 -1
- package/dist/esm/{default-line-tool.config-C35P3XfD.js → default-line-tool.config-DJ488kil.js} +59 -36
- package/dist/{cjs/default-line-tool.config-DJMYrkSu.js.map → esm/default-line-tool.config-DJ488kil.js.map} +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/kritzel-color_22.entry.js +17 -8
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/{p-3e2b5c42.entry.js → p-3df115ed.entry.js} +3 -3
- package/dist/stencil/p-3df115ed.entry.js.map +1 -0
- package/dist/stencil/p-DJ488kil.js +2 -0
- package/dist/stencil/p-DJ488kil.js.map +1 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/objects/selection-group.class.d.ts +1 -0
- package/dist/types/classes/tools/brush-tool.class.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/p-DzUUppVL.js.map +0 -1
- package/dist/esm/default-line-tool.config-C35P3XfD.js.map +0 -1
- package/dist/stencil/p-3e2b5c42.entry.js.map +0 -1
- package/dist/stencil/p-C35P3XfD.js +0 -2
- 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', '#
|
|
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
|
|
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
|
-
|
|
14718
|
-
|
|
14719
|
-
const
|
|
14720
|
-
|
|
14721
|
-
|
|
14722
|
-
|
|
14723
|
-
|
|
14724
|
-
|
|
14725
|
-
|
|
14726
|
-
|
|
14727
|
-
|
|
14728
|
-
|
|
14729
|
-
|
|
14730
|
-
|
|
14731
|
-
|
|
14732
|
-
|
|
14733
|
-
|
|
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
|
-
|
|
14746
|
-
|
|
14747
|
-
currentPath
|
|
14748
|
-
|
|
14749
|
-
|
|
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
|
-
|
|
14757
|
-
|
|
14758
|
-
currentPath
|
|
14759
|
-
|
|
14760
|
-
|
|
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-
|
|
14887
|
+
//# sourceMappingURL=p-Bwv1dxAB.js.map
|
|
14873
14888
|
|
|
14874
|
-
//# sourceMappingURL=p-
|
|
14889
|
+
//# sourceMappingURL=p-Bwv1dxAB.js.map
|