kritzel-stencil 0.0.101 → 0.0.102

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.
@@ -3897,6 +3897,7 @@ class KritzelRotationHandler extends KritzelBaseHandler {
3897
3897
  const currentRotation = Math.atan2(groupCenterY - cursorY, groupCenterX - cursorX);
3898
3898
  this.rotation = currentRotation - this.initialRotation;
3899
3899
  this._store.state.selectionGroup.rotate(this.rotation);
3900
+ this._store.rerender();
3900
3901
  clearTimeout(this._store.state.longTouchTimeout);
3901
3902
  }
3902
3903
  }
@@ -4353,6 +4354,7 @@ class KritzelReviver {
4353
4354
  let revivedObj;
4354
4355
  switch (obj.__class__) {
4355
4356
  case 'KritzelPath':
4357
+ console.log('Reviving KritzelPath');
4356
4358
  revivedObj = new KritzelPath(this._store).revive(obj);
4357
4359
  break;
4358
4360
  case 'KritzelText':
@@ -4362,6 +4364,7 @@ class KritzelReviver {
4362
4364
  revivedObj = new KritzelImage(this._store, obj.img).revive(obj);
4363
4365
  break;
4364
4366
  case 'KritzelSelectionGroup':
4367
+ console.log('Reviving KritzelSelectionGroup');
4365
4368
  revivedObj = new KritzelSelectionGroup(this._store).revive(obj);
4366
4369
  break;
4367
4370
  case 'KritzelBrushTool':
@@ -4461,13 +4464,13 @@ class KritzelSelectionGroup extends KritzelBaseObject {
4461
4464
  const heightScaleFactor = height / this.height;
4462
4465
  const deltaX = x - this.translateX;
4463
4466
  const deltaY = y - this.translateY;
4464
- this.objects.forEach(obj => {
4465
- const updatedWidth = obj.width * widthScaleFactor;
4466
- const updatedHeight = obj.height * heightScaleFactor;
4467
- const updatedX = obj.translateX + deltaX + (obj.translateX - this.translateX) * (widthScaleFactor - 1);
4468
- const updatedY = obj.translateY + deltaY + (obj.translateY - this.translateY) * (heightScaleFactor - 1);
4469
- obj.resize(updatedX, updatedY, updatedWidth, updatedHeight);
4470
- this._store.state.objectsOctree.update(obj);
4467
+ this.objects.forEach(child => {
4468
+ const updatedWidth = child.width * widthScaleFactor;
4469
+ const updatedHeight = child.height * heightScaleFactor;
4470
+ const updatedX = child.translateX + deltaX + (child.translateX - this.translateX) * (widthScaleFactor - 1);
4471
+ const updatedY = child.translateY + deltaY + (child.translateY - this.translateY) * (heightScaleFactor - 1);
4472
+ child.resize(updatedX, updatedY, updatedWidth, updatedHeight);
4473
+ this._store.state.objectsOctree.update(child);
4471
4474
  });
4472
4475
  this.refreshObjectDimensions();
4473
4476
  this.unchangedObjects = ObjectHelper.clone(this.objects);
@@ -4481,7 +4484,6 @@ class KritzelSelectionGroup extends KritzelBaseObject {
4481
4484
  const sin = Math.sin(angle);
4482
4485
  this.objects.forEach(child => {
4483
4486
  const unchangedChild = this.getUnchangedObject(child.id);
4484
- console.log(unchangedChild);
4485
4487
  const offsetX = this.getOffsetXToCenter(unchangedChild);
4486
4488
  const offsetY = this.getOffsetYToCenter(unchangedChild);
4487
4489
  const rotatedX = cos * offsetX - sin * offsetY;
@@ -4489,6 +4491,7 @@ class KritzelSelectionGroup extends KritzelBaseObject {
4489
4491
  child.translateX = centerX + rotatedX - child.totalWidth / 2 / child.scale;
4490
4492
  child.translateY = centerY + rotatedY - child.totalHeight / 2 / child.scale;
4491
4493
  child.rotation = this.objects.length === 1 ? value : value + unchangedChild.rotation;
4494
+ this._store.state.objectsOctree.update(child);
4492
4495
  });
4493
4496
  }
4494
4497
  copy() {
@@ -5942,13 +5945,12 @@ const KritzelEngine = class {
5942
5945
  left: '0',
5943
5946
  top: '0',
5944
5947
  position: 'absolute',
5945
- transform: object === null || object === void 0 ? void 0 : object.transformationMatrix,
5948
+ transform: `${object === null || object === void 0 ? void 0 : object.transformationMatrix} rotate(${object.rotationDegrees}deg)`,
5949
+ transformOrigin: 'center',
5946
5950
  opacity: object.markedForRemoval ? '0.5' : object.opacity.toString(),
5947
5951
  pointerEvents: object.markedForRemoval ? 'none' : 'auto',
5948
5952
  zIndex: object.zIndex.toString(),
5949
- } }, index.h("g", { transform: `rotate(${object.rotationDegrees})`, style: {
5950
- transformOrigin: 'center',
5951
- } }, index.h("foreignObject", { x: "0", y: "0", width: object.totalWidth.toString(), height: object.totalHeight.toString(), style: {
5953
+ } }, index.h("g", null, index.h("foreignObject", { x: "0", y: "0", width: object.totalWidth.toString(), height: object.totalHeight.toString(), style: {
5952
5954
  minHeight: '0',
5953
5955
  minWidth: '0',
5954
5956
  backgroundColor: object.backgroundColor,
@@ -6029,7 +6031,7 @@ const KritzelEngine = class {
6029
6031
  fill: 'transparent',
6030
6032
  cursor: 'grab',
6031
6033
  }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' })), index.h("g", { style: { display: this.store.state.debugInfo.showObjectInfo ? 'block' : 'none' } }, index.h("foreignObject", { x: object.totalWidth.toString(), y: "0", width: "400px", height: "160px", style: { minHeight: '0', minWidth: '0', display: object.debugInfoVisible ? 'block' : 'none' } }, index.h("div", { style: { width: '100%', height: '100%' } }, index.h("div", { style: { whiteSpace: 'nowrap' } }, "zIndex: ", object.zIndex), index.h("div", { style: { whiteSpace: 'nowrap' } }, "translateX: ", object.translateX), index.h("div", { style: { whiteSpace: 'nowrap' } }, "translateY: ", object.translateY), index.h("div", { style: { whiteSpace: 'nowrap' } }, "width: ", object.width), index.h("div", { style: { whiteSpace: 'nowrap' } }, "height: ", object.height), index.h("div", { style: { whiteSpace: 'nowrap' } }, "scale: ", object.scale), index.h("div", { style: { whiteSpace: 'nowrap' } }, "rotation: ", object.rotation))))));
6032
- }), index.h("svg", { key: '78d7e80038f073d4952a6c120baad688a8453042', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
6034
+ }), index.h("svg", { key: '89f59077f5b1680ee635f52e91b7e00533ace21b', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
6033
6035
  height: (_u = this.store.state.currentPath) === null || _u === void 0 ? void 0 : _u.height.toString(),
6034
6036
  width: (_v = this.store.state.currentPath) === null || _v === void 0 ? void 0 : _v.width.toString(),
6035
6037
  left: '0',
@@ -6038,12 +6040,12 @@ const KritzelEngine = class {
6038
6040
  position: 'absolute',
6039
6041
  transform: (_x = this.store.state.currentPath) === null || _x === void 0 ? void 0 : _x.transformationMatrix,
6040
6042
  overflow: 'visible',
6041
- }, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, index.h("path", { key: '46750fadd22eb902105219948ac8293c0c9372bd', d: (_z = this.store.state.currentPath) === null || _z === void 0 ? void 0 : _z.d, fill: (_0 = this.store.state.currentPath) === null || _0 === void 0 ? void 0 : _0.fill, stroke: (_1 = this.store.state.currentPath) === null || _1 === void 0 ? void 0 : _1.stroke }))), this.store.state.isContextMenuVisible && (index.h("kritzel-context-menu", { key: 'c7a30dfd8b8d33cd05775e21fb982f7b51055a78', ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, style: {
6043
+ }, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, index.h("path", { key: '5c0e738bd4b4a373a3d107988045029917f583ee', d: (_z = this.store.state.currentPath) === null || _z === void 0 ? void 0 : _z.d, fill: (_0 = this.store.state.currentPath) === null || _0 === void 0 ? void 0 : _0.fill, stroke: (_1 = this.store.state.currentPath) === null || _1 === void 0 ? void 0 : _1.stroke }))), this.store.state.isContextMenuVisible && (index.h("kritzel-context-menu", { key: '62f514da488f41bd0f7c00322f44e99b3711306d', ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, style: {
6042
6044
  position: 'fixed',
6043
6045
  left: `${this.store.state.contextMenuX}px`,
6044
6046
  top: `${this.store.state.contextMenuY}px`,
6045
6047
  zIndex: '10000',
6046
- }, onActionSelected: event => this.handleContextMenuAction(event) })), ((_2 = this.store.state) === null || _2 === void 0 ? void 0 : _2.activeTool) instanceof KritzelEraserTool && !this.store.state.isScaling && index.h("kritzel-cursor-trail", { key: '2c21c6e8b023986291ab675307c31243670d2acf' })));
6048
+ }, onActionSelected: event => this.handleContextMenuAction(event) })), ((_2 = this.store.state) === null || _2 === void 0 ? void 0 : _2.activeTool) instanceof KritzelEraserTool && !this.store.state.isScaling && index.h("kritzel-cursor-trail", { key: '841e02523a20413a9e69ca6976dfb95f670620aa' })));
6047
6049
  }
6048
6050
  get host() { return index.getElement(this); }
6049
6051
  };