kritzel-stencil 0.0.152 → 0.0.154
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-text-tool.config-BX6sjin6.js → default-text-tool.config-BySzvIox.js} +69 -40
- package/dist/cjs/default-text-tool.config-BySzvIox.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/kritzel-color_22.cjs.entry.js +129 -78
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stencil.cjs.js +1 -1
- package/dist/collection/classes/core/core.class.js +16 -14
- package/dist/collection/classes/core/core.class.js.map +1 -1
- package/dist/collection/classes/core/store.class.js +8 -8
- package/dist/collection/classes/core/store.class.js.map +1 -1
- package/dist/collection/classes/core/viewport.class.js +11 -10
- package/dist/collection/classes/core/viewport.class.js.map +1 -1
- package/dist/collection/classes/handlers/context-menu.handler.js +1 -1
- package/dist/collection/classes/handlers/context-menu.handler.js.map +1 -1
- package/dist/collection/classes/handlers/move.handler.js +2 -0
- package/dist/collection/classes/handlers/move.handler.js.map +1 -1
- package/dist/collection/classes/handlers/resize.handler.js +2 -0
- package/dist/collection/classes/handlers/resize.handler.js.map +1 -1
- package/dist/collection/classes/handlers/rotation.handler.js +2 -0
- package/dist/collection/classes/handlers/rotation.handler.js.map +1 -1
- package/dist/collection/classes/handlers/selection.handler.js +7 -5
- package/dist/collection/classes/handlers/selection.handler.js.map +1 -1
- package/dist/collection/classes/objects/base-object.class.js +11 -5
- package/dist/collection/classes/objects/base-object.class.js.map +1 -1
- package/dist/collection/classes/objects/custom-element.class.js +1 -1
- package/dist/collection/classes/objects/custom-element.class.js.map +1 -1
- package/dist/collection/classes/objects/image.class.js +1 -1
- package/dist/collection/classes/objects/image.class.js.map +1 -1
- package/dist/collection/classes/objects/path.class.js +14 -5
- package/dist/collection/classes/objects/path.class.js.map +1 -1
- package/dist/collection/classes/objects/selection-group.class.js +10 -10
- package/dist/collection/classes/objects/selection-group.class.js.map +1 -1
- package/dist/collection/classes/objects/text.class.js +5 -4
- package/dist/collection/classes/objects/text.class.js.map +1 -1
- package/dist/collection/classes/structures/object-map.structure.js +10 -0
- package/dist/collection/classes/structures/object-map.structure.js.map +1 -1
- package/dist/collection/classes/tools/brush-tool.class.js +8 -6
- package/dist/collection/classes/tools/brush-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/eraser-tool.class.js +2 -0
- package/dist/collection/classes/tools/eraser-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/image-tool.class.js +1 -0
- package/dist/collection/classes/tools/image-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/text-tool.class.js +2 -2
- package/dist/collection/classes/tools/text-tool.class.js.map +1 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +60 -4
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +1 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +89 -27
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
- package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.css +0 -5
- package/dist/collection/components/shared/kritzel-menu/kritzel-menu.css +0 -3
- package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.css +0 -2
- package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.css +0 -1
- package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.css +0 -4
- package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.css +0 -4
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.css +0 -5
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +28 -3
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js.map +1 -1
- package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.css +8 -2
- package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +30 -1
- package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js.map +1 -1
- package/dist/collection/configs/default-engine-config.js +1 -2
- package/dist/collection/configs/default-engine-config.js.map +1 -1
- package/dist/collection/interfaces/engine-state.interface.js.map +1 -1
- package/dist/collection/interfaces/undo-state.interface.js +2 -0
- package/dist/collection/interfaces/undo-state.interface.js.map +1 -0
- package/dist/components/index.js +3 -3
- package/dist/components/kritzel-color-palette.js +1 -1
- package/dist/components/kritzel-control-brush-config.js +1 -1
- package/dist/components/kritzel-control-text-config.js +1 -1
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-editor.js +30 -14
- package/dist/components/kritzel-editor.js.map +1 -1
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/kritzel-menu-item.js +1 -1
- package/dist/components/kritzel-menu.js +1 -1
- package/dist/components/kritzel-split-button.js +1 -1
- package/dist/components/kritzel-stroke-size.js +1 -1
- package/dist/components/kritzel-utility-panel.js +1 -1
- package/dist/components/kritzel-workspace-manager.js +1 -1
- package/dist/components/{p-BP71Fape.js → p-1lIHoOlH.js} +14 -12
- package/dist/components/p-1lIHoOlH.js.map +1 -0
- package/dist/components/{p-BDHz9TkP.js → p-B4kxkVe-.js} +3 -3
- package/dist/components/p-B4kxkVe-.js.map +1 -0
- package/dist/components/{p-G8Xyn7XV.js → p-BQg4YML7.js} +3 -3
- package/dist/components/{p-G8Xyn7XV.js.map → p-BQg4YML7.js.map} +1 -1
- package/dist/components/{p-DIp1AvzL.js → p-BfaEHdtM.js} +127 -82
- package/dist/components/p-BfaEHdtM.js.map +1 -0
- package/dist/components/{p-G2HGJcNm.js → p-CBYBurdY.js} +42 -24
- package/dist/components/p-CBYBurdY.js.map +1 -0
- package/dist/components/{p-DnOeM6VQ.js → p-CK6no3mi.js} +4 -4
- package/dist/components/{p-DnOeM6VQ.js.map → p-CK6no3mi.js.map} +1 -1
- package/dist/components/{p-DKVBZiTy.js → p-CsA9M6me.js} +4 -4
- package/dist/components/p-CsA9M6me.js.map +1 -0
- package/dist/components/{p-CJzBIV7n.js → p-D1uj4A4F.js} +3 -3
- package/dist/components/p-D1uj4A4F.js.map +1 -0
- package/dist/components/{p-Cqpp9wKT.js → p-DAfkuR8U.js} +8 -5
- package/dist/components/p-DAfkuR8U.js.map +1 -0
- package/dist/components/{p-CRB1YGoc.js → p-Ddh40W3x.js} +5 -5
- package/dist/components/p-Ddh40W3x.js.map +1 -0
- package/dist/components/{p-DhDRFCsP.js → p-TdCTkEu0.js} +4 -4
- package/dist/components/p-TdCTkEu0.js.map +1 -0
- package/dist/esm/{default-text-tool.config-Bcel-KfG.js → default-text-tool.config-2YFQA3SF.js} +69 -40
- package/dist/esm/default-text-tool.config-2YFQA3SF.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/kritzel-color_22.entry.js +129 -78
- package/dist/esm/loader.js +1 -1
- package/dist/esm/stencil.js +1 -1
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/p-2YFQA3SF.js +2 -0
- package/dist/stencil/p-2YFQA3SF.js.map +1 -0
- package/dist/stencil/p-bb5b2f78.entry.js +10 -0
- package/dist/stencil/p-bb5b2f78.entry.js.map +1 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/core/store.class.d.ts +4 -3
- package/dist/types/classes/core/viewport.class.d.ts +1 -0
- package/dist/types/classes/objects/path.class.d.ts +1 -0
- package/dist/types/classes/structures/object-map.structure.d.ts +2 -0
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +8 -1
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +5 -0
- package/dist/types/components/ui/kritzel-controls/kritzel-controls.d.ts +2 -0
- package/dist/types/components/ui/kritzel-utility-panel/kritzel-utility-panel.d.ts +2 -0
- package/dist/types/components.d.ts +28 -0
- package/dist/types/interfaces/engine-state.interface.d.ts +1 -2
- package/dist/types/interfaces/undo-state.interface.d.ts +6 -0
- package/package.json +1 -1
- package/dist/cjs/default-text-tool.config-BX6sjin6.js.map +0 -1
- package/dist/components/p-BDHz9TkP.js.map +0 -1
- package/dist/components/p-BP71Fape.js.map +0 -1
- package/dist/components/p-CJzBIV7n.js.map +0 -1
- package/dist/components/p-CRB1YGoc.js.map +0 -1
- package/dist/components/p-Cqpp9wKT.js.map +0 -1
- package/dist/components/p-DIp1AvzL.js.map +0 -1
- package/dist/components/p-DKVBZiTy.js.map +0 -1
- package/dist/components/p-DhDRFCsP.js.map +0 -1
- package/dist/components/p-G2HGJcNm.js.map +0 -1
- package/dist/esm/default-text-tool.config-Bcel-KfG.js.map +0 -1
- package/dist/stencil/p-76adbc98.entry.js +0 -10
- package/dist/stencil/p-76adbc98.entry.js.map +0 -1
- package/dist/stencil/p-Bcel-KfG.js +0 -2
- package/dist/stencil/p-Bcel-KfG.js.map +0 -1
package/dist/cjs/{default-text-tool.config-BX6sjin6.js → default-text-tool.config-BySzvIox.js}
RENAMED
|
@@ -215,6 +215,12 @@ class KritzelBaseObject {
|
|
|
215
215
|
return ObjectHelper.generateUUID();
|
|
216
216
|
}
|
|
217
217
|
isInViewport() {
|
|
218
|
+
const viewportScale = this._core.store.state.scale;
|
|
219
|
+
const scaledWidth = this.boundingBox.width * viewportScale;
|
|
220
|
+
const scaledHeight = this.boundingBox.height * viewportScale;
|
|
221
|
+
if (scaledWidth * scaledHeight < 0.5) {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
218
224
|
const viewportBounds = {
|
|
219
225
|
x: -this._core.store.state.translateX / this._core.store.state.scale,
|
|
220
226
|
y: -this._core.store.state.translateY / this._core.store.state.scale,
|
|
@@ -238,14 +244,14 @@ class KritzelBaseObject {
|
|
|
238
244
|
this.updatePosition(this.translateX + deltaX, this.translateY + deltaY);
|
|
239
245
|
}
|
|
240
246
|
update() {
|
|
241
|
-
this._core.store.state.
|
|
247
|
+
this._core.store.state.objects.update(this);
|
|
242
248
|
}
|
|
243
249
|
move(startX, startY, endX, endY) {
|
|
244
250
|
const deltaX = (startX - endX) / this._core.store.state.scale;
|
|
245
251
|
const deltaY = (startY - endY) / this._core.store.state.scale;
|
|
246
252
|
this.translateX += deltaX;
|
|
247
253
|
this.translateY += deltaY;
|
|
248
|
-
this._core.store.state.
|
|
254
|
+
this._core.store.state.objects.update(this);
|
|
249
255
|
}
|
|
250
256
|
resize(x, y, width, height) {
|
|
251
257
|
if (width <= 1 || height <= 1) {
|
|
@@ -255,11 +261,11 @@ class KritzelBaseObject {
|
|
|
255
261
|
this.height = height;
|
|
256
262
|
this.translateX = x;
|
|
257
263
|
this.translateY = y;
|
|
258
|
-
this._core.store.state.
|
|
264
|
+
this._core.store.state.objects.update(this);
|
|
259
265
|
}
|
|
260
266
|
rotate(value) {
|
|
261
267
|
this.rotation = value;
|
|
262
|
-
this._core.store.state.
|
|
268
|
+
this._core.store.state.objects.update(this);
|
|
263
269
|
}
|
|
264
270
|
clone() {
|
|
265
271
|
const clone = Object.create(Object.getPrototypeOf(this));
|
|
@@ -302,7 +308,7 @@ class KritzelBaseObject {
|
|
|
302
308
|
updatePosition(x, y) {
|
|
303
309
|
this.translateX = x;
|
|
304
310
|
this.translateY = y;
|
|
305
|
-
this._core.store.state.
|
|
311
|
+
this._core.store.state.objects.update(this);
|
|
306
312
|
}
|
|
307
313
|
}
|
|
308
314
|
|
|
@@ -13940,7 +13946,7 @@ class KritzelText extends KritzelBaseObject {
|
|
|
13940
13946
|
this.content = newState.doc.toJSON();
|
|
13941
13947
|
this.adjustSizeOnInput();
|
|
13942
13948
|
if (!transaction.getMeta('fromRemote')) {
|
|
13943
|
-
this._core.store.state.
|
|
13949
|
+
this._core.store.state.objects.update(this, { temporary: true });
|
|
13944
13950
|
}
|
|
13945
13951
|
}
|
|
13946
13952
|
},
|
|
@@ -13993,7 +13999,7 @@ class KritzelText extends KritzelBaseObject {
|
|
|
13993
13999
|
this.height = originalHeight * this.scaleFactor;
|
|
13994
14000
|
this.translateX = x;
|
|
13995
14001
|
this.translateY = y;
|
|
13996
|
-
this._core.store.state.
|
|
14002
|
+
this._core.store.state.objects.update(this);
|
|
13997
14003
|
}
|
|
13998
14004
|
focus(coords) {
|
|
13999
14005
|
if (this.editor) {
|
|
@@ -14045,8 +14051,9 @@ class KritzelText extends KritzelBaseObject {
|
|
|
14045
14051
|
this.editor.setProps({ editable: () => false });
|
|
14046
14052
|
this.editor.dom.blur();
|
|
14047
14053
|
this.isEditing = false;
|
|
14048
|
-
this._core.store.state.
|
|
14049
|
-
this._core.store.state.
|
|
14054
|
+
this._core.store.state.objects.consolidateTemporaryItems();
|
|
14055
|
+
this._core.store.state.objects.update(this);
|
|
14056
|
+
this._core.engine.emitObjectsChange();
|
|
14050
14057
|
}
|
|
14051
14058
|
handlePointerDown(event) {
|
|
14052
14059
|
if (!this.isEditing) {
|
|
@@ -14179,12 +14186,12 @@ class KritzelPath extends KritzelBaseObject {
|
|
|
14179
14186
|
this.translateX = x;
|
|
14180
14187
|
this.translateY = y;
|
|
14181
14188
|
this._adjustedPoints = null;
|
|
14182
|
-
this._core.store.state.
|
|
14189
|
+
this._core.store.state.objects.update(this);
|
|
14183
14190
|
}
|
|
14184
14191
|
rotate(value) {
|
|
14185
14192
|
this.rotation = value;
|
|
14186
14193
|
this._adjustedPoints = null;
|
|
14187
|
-
this._core.store.state.
|
|
14194
|
+
this._core.store.state.objects.update(this);
|
|
14188
14195
|
}
|
|
14189
14196
|
move(startX, startY, endX, endY) {
|
|
14190
14197
|
const deltaX = (startX - endX) / this._core.store.state.scale;
|
|
@@ -14192,7 +14199,7 @@ class KritzelPath extends KritzelBaseObject {
|
|
|
14192
14199
|
this.translateX += deltaX;
|
|
14193
14200
|
this.translateY += deltaY;
|
|
14194
14201
|
this._adjustedPoints = null;
|
|
14195
|
-
this._core.store.state.
|
|
14202
|
+
this._core.store.state.objects.update(this);
|
|
14196
14203
|
}
|
|
14197
14204
|
hitTest(x, y) {
|
|
14198
14205
|
const halfStroke = this.strokeWidth / this.scale / 2;
|
|
@@ -14268,7 +14275,7 @@ class KritzelPath extends KritzelBaseObject {
|
|
|
14268
14275
|
this.translateX = x;
|
|
14269
14276
|
this.translateY = y;
|
|
14270
14277
|
this._adjustedPoints = null;
|
|
14271
|
-
this._core.store.state.
|
|
14278
|
+
this._core.store.state.objects.update(this);
|
|
14272
14279
|
}
|
|
14273
14280
|
computeAdjustedPoints() {
|
|
14274
14281
|
if (!this.points?.length) {
|
|
@@ -14289,7 +14296,7 @@ class KritzelPath extends KritzelBaseObject {
|
|
|
14289
14296
|
const dy = y - cy;
|
|
14290
14297
|
return [cx + dx * cos - dy * sin, cy + dx * sin + dy * cos];
|
|
14291
14298
|
});
|
|
14292
|
-
return rotatedPoints.map(([px, py]) => [
|
|
14299
|
+
return rotatedPoints.map(([px, py]) => [Math.abs(px - this.x) / this.scale + this.translateX, Math.abs(py - this.y) / this.scale + this.translateY]);
|
|
14293
14300
|
}
|
|
14294
14301
|
pointToLineSegmentDistance(x, y, x1, y1, x2, y2) {
|
|
14295
14302
|
const A = x - x1;
|
|
@@ -14381,6 +14388,15 @@ class KritzelPath extends KritzelBaseObject {
|
|
|
14381
14388
|
}
|
|
14382
14389
|
return result;
|
|
14383
14390
|
}
|
|
14391
|
+
isLowRes() {
|
|
14392
|
+
if (!this._core) {
|
|
14393
|
+
return false;
|
|
14394
|
+
}
|
|
14395
|
+
const viewportScale = this._core.store.state.scale;
|
|
14396
|
+
const scaledWidth = this.boundingBox.width * viewportScale;
|
|
14397
|
+
const scaledHeight = this.boundingBox.height * viewportScale;
|
|
14398
|
+
return (scaledWidth * scaledHeight) < 500;
|
|
14399
|
+
}
|
|
14384
14400
|
}
|
|
14385
14401
|
|
|
14386
14402
|
class KritzelImage extends KritzelBaseObject {
|
|
@@ -14422,7 +14438,7 @@ class KritzelImage extends KritzelBaseObject {
|
|
|
14422
14438
|
this.translateX = x;
|
|
14423
14439
|
this.translateY = y;
|
|
14424
14440
|
// Update to sync changes to y.js and propagate to other tabs
|
|
14425
|
-
this._core.store.state.
|
|
14441
|
+
this._core.store.state.objects.update(this);
|
|
14426
14442
|
}
|
|
14427
14443
|
calculateScaledDimensions(img) {
|
|
14428
14444
|
let scaledWidth = img.width;
|
|
@@ -14561,7 +14577,7 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
14561
14577
|
strokeWidth: this.size,
|
|
14562
14578
|
});
|
|
14563
14579
|
path.isCompleted = false;
|
|
14564
|
-
this._core.store.state.
|
|
14580
|
+
this._core.store.state.objects.insert(path);
|
|
14565
14581
|
}
|
|
14566
14582
|
}
|
|
14567
14583
|
if (event.pointerType === 'touch') {
|
|
@@ -14579,7 +14595,7 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
14579
14595
|
strokeWidth: this.size,
|
|
14580
14596
|
});
|
|
14581
14597
|
path.isCompleted = false;
|
|
14582
|
-
this._core.store.state.
|
|
14598
|
+
this._core.store.state.objects.insert(path);
|
|
14583
14599
|
}
|
|
14584
14600
|
}
|
|
14585
14601
|
}
|
|
@@ -14604,7 +14620,7 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
14604
14620
|
updatedPath.id = currentPath.id;
|
|
14605
14621
|
updatedPath.workspaceId = currentPath.workspaceId;
|
|
14606
14622
|
updatedPath.isCompleted = false;
|
|
14607
|
-
this._core.store.state.
|
|
14623
|
+
this._core.store.state.objects.update(updatedPath);
|
|
14608
14624
|
}
|
|
14609
14625
|
}
|
|
14610
14626
|
}
|
|
@@ -14626,7 +14642,7 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
14626
14642
|
updatedPath.id = currentPath.id;
|
|
14627
14643
|
updatedPath.workspaceId = currentPath.workspaceId;
|
|
14628
14644
|
updatedPath.isCompleted = false;
|
|
14629
|
-
this._core.store.state.
|
|
14645
|
+
this._core.store.state.objects.update(updatedPath);
|
|
14630
14646
|
}
|
|
14631
14647
|
}
|
|
14632
14648
|
}
|
|
@@ -14642,7 +14658,8 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
14642
14658
|
if (currentPath) {
|
|
14643
14659
|
currentPath.isCompleted = true;
|
|
14644
14660
|
currentPath.zIndex = this._core.store.currentZIndex;
|
|
14645
|
-
this._core.store.state.
|
|
14661
|
+
this._core.store.state.objects.update(currentPath);
|
|
14662
|
+
this._core.engine.emitObjectsChange();
|
|
14646
14663
|
}
|
|
14647
14664
|
}
|
|
14648
14665
|
}
|
|
@@ -14653,7 +14670,8 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
14653
14670
|
if (currentPath) {
|
|
14654
14671
|
currentPath.isCompleted = true;
|
|
14655
14672
|
currentPath.zIndex = this._core.store.currentZIndex;
|
|
14656
|
-
this._core.store.state.
|
|
14673
|
+
this._core.store.state.objects.update(currentPath);
|
|
14674
|
+
this._core.engine.emitObjectsChange();
|
|
14657
14675
|
}
|
|
14658
14676
|
}
|
|
14659
14677
|
}
|
|
@@ -14722,6 +14740,7 @@ class KritzelEraserTool extends KritzelBaseTool {
|
|
|
14722
14740
|
this._core.rerender();
|
|
14723
14741
|
}
|
|
14724
14742
|
this._core.store.state.isErasing = false;
|
|
14743
|
+
this._core.engine.emitObjectsChange();
|
|
14725
14744
|
}
|
|
14726
14745
|
}
|
|
14727
14746
|
if (event.pointerType === 'touch') {
|
|
@@ -14736,6 +14755,7 @@ class KritzelEraserTool extends KritzelBaseTool {
|
|
|
14736
14755
|
this._core.rerender();
|
|
14737
14756
|
}
|
|
14738
14757
|
this._core.store.state.isErasing = false;
|
|
14758
|
+
this._core.engine.emitObjectsChange();
|
|
14739
14759
|
}
|
|
14740
14760
|
}
|
|
14741
14761
|
}
|
|
@@ -14822,6 +14842,7 @@ class KritzelImageTool extends KritzelBaseTool {
|
|
|
14822
14842
|
this._core.addObject(image);
|
|
14823
14843
|
this._core.store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
|
|
14824
14844
|
this._core.selectObjects([image]);
|
|
14845
|
+
this._core.engine.emitObjectsChange();
|
|
14825
14846
|
}
|
|
14826
14847
|
handleCancel() {
|
|
14827
14848
|
this._core.store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
|
|
@@ -14885,7 +14906,7 @@ class KritzelTextTool extends KritzelBaseTool {
|
|
|
14885
14906
|
text.translateX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;
|
|
14886
14907
|
text.translateY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;
|
|
14887
14908
|
text.zIndex = this._core.store.currentZIndex;
|
|
14888
|
-
this._core.store.state.
|
|
14909
|
+
this._core.store.state.objects.insert(text);
|
|
14889
14910
|
this._core.rerender();
|
|
14890
14911
|
text.edit(event);
|
|
14891
14912
|
}
|
|
@@ -14919,7 +14940,7 @@ class KritzelTextTool extends KritzelBaseTool {
|
|
|
14919
14940
|
text.translateX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;
|
|
14920
14941
|
text.translateY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;
|
|
14921
14942
|
text.zIndex = this._core.store.currentZIndex;
|
|
14922
|
-
this._core.store.state.
|
|
14943
|
+
this._core.store.state.objects.insert(text);
|
|
14923
14944
|
this._core.rerender();
|
|
14924
14945
|
text.edit(event);
|
|
14925
14946
|
}
|
|
@@ -15067,6 +15088,7 @@ class KritzelMoveHandler extends KritzelBaseHandler {
|
|
|
15067
15088
|
this._core.store.state.isDragging = false;
|
|
15068
15089
|
if (this.hasMoved) {
|
|
15069
15090
|
this._core.store.selectionGroup.update();
|
|
15091
|
+
this._core.engine.emitObjectsChange();
|
|
15070
15092
|
this._core.store.state.hasObjectsChanged = true;
|
|
15071
15093
|
}
|
|
15072
15094
|
}
|
|
@@ -15076,6 +15098,7 @@ class KritzelMoveHandler extends KritzelBaseHandler {
|
|
|
15076
15098
|
this._core.store.state.isDragging = false;
|
|
15077
15099
|
if (this.hasMoved) {
|
|
15078
15100
|
this._core.store.selectionGroup.update();
|
|
15101
|
+
this._core.engine.emitObjectsChange();
|
|
15079
15102
|
this._core.store.state.hasObjectsChanged = true;
|
|
15080
15103
|
}
|
|
15081
15104
|
}
|
|
@@ -15252,6 +15275,7 @@ class KritzelResizeHandler extends KritzelBaseHandler {
|
|
|
15252
15275
|
this._core.store.state.isResizing = false;
|
|
15253
15276
|
if (this.hasResized) {
|
|
15254
15277
|
this._core.store.selectionGroup.update();
|
|
15278
|
+
this._core.engine.emitObjectsChange();
|
|
15255
15279
|
this._core.store.state.hasObjectsChanged = true;
|
|
15256
15280
|
}
|
|
15257
15281
|
this.reset();
|
|
@@ -15262,6 +15286,7 @@ class KritzelResizeHandler extends KritzelBaseHandler {
|
|
|
15262
15286
|
this._core.store.state.isResizing = false;
|
|
15263
15287
|
if (this.hasResized) {
|
|
15264
15288
|
this._core.store.selectionGroup.update();
|
|
15289
|
+
this._core.engine.emitObjectsChange();
|
|
15265
15290
|
this._core.store.state.hasObjectsChanged = true;
|
|
15266
15291
|
}
|
|
15267
15292
|
this.reset();
|
|
@@ -15366,6 +15391,7 @@ class KritzelRotationHandler extends KritzelBaseHandler {
|
|
|
15366
15391
|
if (event.pointerType === 'mouse') {
|
|
15367
15392
|
if (this._core.store.state.isRotating) {
|
|
15368
15393
|
this._core.store.selectionGroup.update();
|
|
15394
|
+
this._core.engine.emitObjectsChange();
|
|
15369
15395
|
this._core.store.state.isRotating = false;
|
|
15370
15396
|
this._core.store.state.hasObjectsChanged = true;
|
|
15371
15397
|
this.reset();
|
|
@@ -15374,6 +15400,7 @@ class KritzelRotationHandler extends KritzelBaseHandler {
|
|
|
15374
15400
|
if (event.pointerType === 'touch') {
|
|
15375
15401
|
if (this._core.store.state.isRotating) {
|
|
15376
15402
|
this._core.store.selectionGroup.update();
|
|
15403
|
+
this._core.engine.emitObjectsChange();
|
|
15377
15404
|
this._core.store.state.isRotating = false;
|
|
15378
15405
|
this._core.store.state.hasObjectsChanged = true;
|
|
15379
15406
|
this.reset();
|
|
@@ -15415,7 +15442,7 @@ class KritzelSelectionGroup extends KritzelBaseObject {
|
|
|
15415
15442
|
get objects() {
|
|
15416
15443
|
return this.objectIds
|
|
15417
15444
|
.map(id => {
|
|
15418
|
-
const found = this._core.store.state.
|
|
15445
|
+
const found = this._core.store.state.objects.filter(obj => obj.id === id);
|
|
15419
15446
|
return found.length > 0 ? found[0] : null;
|
|
15420
15447
|
})
|
|
15421
15448
|
.filter(obj => obj !== null);
|
|
@@ -15470,7 +15497,7 @@ class KritzelSelectionGroup extends KritzelBaseObject {
|
|
|
15470
15497
|
});
|
|
15471
15498
|
this.translateX = x;
|
|
15472
15499
|
this.translateY = y;
|
|
15473
|
-
this._core.store.state.
|
|
15500
|
+
this._core.store.state.objects.update(this);
|
|
15474
15501
|
}
|
|
15475
15502
|
/**
|
|
15476
15503
|
* Capture snapshots of current object states for undo/redo operations
|
|
@@ -15514,15 +15541,15 @@ class KritzelSelectionGroup extends KritzelBaseObject {
|
|
|
15514
15541
|
// Only update the selection group itself
|
|
15515
15542
|
// Child objects are already updated during move/resize/rotate operations
|
|
15516
15543
|
// Updating them again here would create redundant y.js updates
|
|
15517
|
-
this._core.store.state.
|
|
15544
|
+
this._core.store.state.objects.update(this);
|
|
15518
15545
|
}
|
|
15519
15546
|
move(startX, startY, endX, endY) {
|
|
15520
15547
|
const deltaX = (startX - endX) / this._core.store.state.scale;
|
|
15521
15548
|
const deltaY = (startY - endY) / this._core.store.state.scale;
|
|
15522
15549
|
this.translateX += deltaX;
|
|
15523
15550
|
this.translateY += deltaY;
|
|
15524
|
-
this._core.store.state.
|
|
15525
|
-
this._core.store.state.
|
|
15551
|
+
this._core.store.state.objects.transaction(() => {
|
|
15552
|
+
this._core.store.state.objects.update(this);
|
|
15526
15553
|
this.objects.forEach(obj => {
|
|
15527
15554
|
obj.move(startX, startY, endX, endY);
|
|
15528
15555
|
});
|
|
@@ -15538,7 +15565,7 @@ class KritzelSelectionGroup extends KritzelBaseObject {
|
|
|
15538
15565
|
const heightScaleFactor = height / this.height;
|
|
15539
15566
|
const deltaX = x - this.translateX;
|
|
15540
15567
|
const deltaY = y - this.translateY;
|
|
15541
|
-
this._core.store.state.
|
|
15568
|
+
this._core.store.state.objects.transaction(() => {
|
|
15542
15569
|
this.objects.forEach(child => {
|
|
15543
15570
|
const updatedWidth = child.width * widthScaleFactor;
|
|
15544
15571
|
const updatedHeight = child.height * heightScaleFactor;
|
|
@@ -15549,7 +15576,7 @@ class KritzelSelectionGroup extends KritzelBaseObject {
|
|
|
15549
15576
|
// Refresh dimensions and update the SelectionGroup to propagate changes to other tabs
|
|
15550
15577
|
this.refreshObjectDimensions();
|
|
15551
15578
|
this.captureUnchangedSnapshots();
|
|
15552
|
-
this._core.store.state.
|
|
15579
|
+
this._core.store.state.objects.update(this);
|
|
15553
15580
|
});
|
|
15554
15581
|
}
|
|
15555
15582
|
rotate(value) {
|
|
@@ -15559,9 +15586,9 @@ class KritzelSelectionGroup extends KritzelBaseObject {
|
|
|
15559
15586
|
const angle = value;
|
|
15560
15587
|
const cos = Math.cos(angle);
|
|
15561
15588
|
const sin = Math.sin(angle);
|
|
15562
|
-
this._core.store.state.
|
|
15589
|
+
this._core.store.state.objects.transaction(() => {
|
|
15563
15590
|
// Update the SelectionGroup itself to propagate rotation to other tabs
|
|
15564
|
-
this._core.store.state.
|
|
15591
|
+
this._core.store.state.objects.update(this);
|
|
15565
15592
|
this.objects.forEach(child => {
|
|
15566
15593
|
const unchangedSnapshot = this.unchangedObjectSnapshots.get(child.id);
|
|
15567
15594
|
if (!unchangedSnapshot)
|
|
@@ -15612,7 +15639,7 @@ class KritzelSelectionGroup extends KritzelBaseObject {
|
|
|
15612
15639
|
this.width = (this.maxX - this.minX - this.padding) * this.scale;
|
|
15613
15640
|
this.height = (this.maxY - this.minY - this.padding) * this.scale;
|
|
15614
15641
|
}
|
|
15615
|
-
this._core.store.state.
|
|
15642
|
+
this._core.store.state.objects.update(this);
|
|
15616
15643
|
}
|
|
15617
15644
|
getOffsetXToCenterFromSnapshot(snapshot) {
|
|
15618
15645
|
const objCenterX = snapshot.translateX + snapshot.totalWidth / snapshot.scale / 2;
|
|
@@ -15695,6 +15722,7 @@ class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
15695
15722
|
this.addSelectedObjectsToSelectionGroup();
|
|
15696
15723
|
this.removeSelectionBox();
|
|
15697
15724
|
}
|
|
15725
|
+
this._core.engine.emitObjectsChange();
|
|
15698
15726
|
}
|
|
15699
15727
|
}
|
|
15700
15728
|
}
|
|
@@ -15715,13 +15743,14 @@ class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
15715
15743
|
this.addSelectedObjectsToSelectionGroup();
|
|
15716
15744
|
this.removeSelectionBox();
|
|
15717
15745
|
}
|
|
15746
|
+
this._core.engine.emitObjectsChange();
|
|
15718
15747
|
this._core.store.state.skipContextMenu = false;
|
|
15719
15748
|
}
|
|
15720
15749
|
}
|
|
15721
15750
|
}
|
|
15722
15751
|
removeSelectionBox() {
|
|
15723
15752
|
this._core.store.state.isSelecting = false;
|
|
15724
|
-
this._core.store.state.
|
|
15753
|
+
this._core.store.state.objects.remove(o => o instanceof KritzelSelectionBox);
|
|
15725
15754
|
}
|
|
15726
15755
|
startMouseSelection(event) {
|
|
15727
15756
|
let clientX, clientY;
|
|
@@ -15733,8 +15762,8 @@ class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
15733
15762
|
selectionBox.translateX = this.startX;
|
|
15734
15763
|
selectionBox.translateY = this.startY;
|
|
15735
15764
|
this._core.store.state.isSelecting = true;
|
|
15736
|
-
this._core.store.state.
|
|
15737
|
-
this._core.store.state.
|
|
15765
|
+
this._core.store.state.objects.remove(o => o instanceof KritzelSelectionBox || o instanceof KritzelSelectionGroup);
|
|
15766
|
+
this._core.store.state.objects.insert(selectionBox);
|
|
15738
15767
|
}
|
|
15739
15768
|
startTouchSelection() {
|
|
15740
15769
|
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
@@ -15753,8 +15782,8 @@ class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
15753
15782
|
selectionBox.translateX = this.startX;
|
|
15754
15783
|
selectionBox.translateY = this.startY;
|
|
15755
15784
|
this._core.store.state.isSelecting = true;
|
|
15756
|
-
this._core.store.state.
|
|
15757
|
-
this._core.store.state.
|
|
15785
|
+
this._core.store.state.objects.remove(o => o instanceof KritzelSelectionBox || o instanceof KritzelSelectionGroup);
|
|
15786
|
+
this._core.store.state.objects.insert(selectionBox);
|
|
15758
15787
|
}
|
|
15759
15788
|
updateMouseSelection(event) {
|
|
15760
15789
|
let clientX, clientY;
|
|
@@ -31233,6 +31262,6 @@ exports.varStorage = varStorage;
|
|
|
31233
31262
|
exports.writeVarString = writeVarString$2;
|
|
31234
31263
|
exports.writeVarUint = writeVarUint$2;
|
|
31235
31264
|
exports.writeVarUint8Array = writeVarUint8Array$2;
|
|
31236
|
-
//# sourceMappingURL=default-text-tool.config-
|
|
31265
|
+
//# sourceMappingURL=default-text-tool.config-BySzvIox.js.map
|
|
31237
31266
|
|
|
31238
|
-
//# sourceMappingURL=default-text-tool.config-
|
|
31267
|
+
//# sourceMappingURL=default-text-tool.config-BySzvIox.js.map
|