kritzel-stencil 0.0.102 → 0.0.103

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,7 +3897,6 @@ 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();
3901
3900
  clearTimeout(this._store.state.longTouchTimeout);
3902
3901
  }
3903
3902
  }
@@ -4354,7 +4353,6 @@ class KritzelReviver {
4354
4353
  let revivedObj;
4355
4354
  switch (obj.__class__) {
4356
4355
  case 'KritzelPath':
4357
- console.log('Reviving KritzelPath');
4358
4356
  revivedObj = new KritzelPath(this._store).revive(obj);
4359
4357
  break;
4360
4358
  case 'KritzelText':
@@ -4364,7 +4362,6 @@ class KritzelReviver {
4364
4362
  revivedObj = new KritzelImage(this._store, obj.img).revive(obj);
4365
4363
  break;
4366
4364
  case 'KritzelSelectionGroup':
4367
- console.log('Reviving KritzelSelectionGroup');
4368
4365
  revivedObj = new KritzelSelectionGroup(this._store).revive(obj);
4369
4366
  break;
4370
4367
  case 'KritzelBrushTool':
@@ -4464,13 +4461,13 @@ class KritzelSelectionGroup extends KritzelBaseObject {
4464
4461
  const heightScaleFactor = height / this.height;
4465
4462
  const deltaX = x - this.translateX;
4466
4463
  const deltaY = y - this.translateY;
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);
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);
4474
4471
  });
4475
4472
  this.refreshObjectDimensions();
4476
4473
  this.unchangedObjects = ObjectHelper.clone(this.objects);
@@ -4491,7 +4488,6 @@ class KritzelSelectionGroup extends KritzelBaseObject {
4491
4488
  child.translateX = centerX + rotatedX - child.totalWidth / 2 / child.scale;
4492
4489
  child.translateY = centerY + rotatedY - child.totalHeight / 2 / child.scale;
4493
4490
  child.rotation = this.objects.length === 1 ? value : value + unchangedChild.rotation;
4494
- this._store.state.objectsOctree.update(child);
4495
4491
  });
4496
4492
  }
4497
4493
  copy() {
@@ -5945,14 +5941,15 @@ const KritzelEngine = class {
5945
5941
  left: '0',
5946
5942
  top: '0',
5947
5943
  position: 'absolute',
5948
- transform: `${object === null || object === void 0 ? void 0 : object.transformationMatrix} rotate(${object.rotationDegrees}deg)`,
5949
- transformOrigin: 'center',
5944
+ transform: object === null || object === void 0 ? void 0 : object.transformationMatrix,
5950
5945
  opacity: object.markedForRemoval ? '0.5' : object.opacity.toString(),
5951
5946
  pointerEvents: object.markedForRemoval ? 'none' : 'auto',
5952
5947
  zIndex: object.zIndex.toString(),
5953
5948
  } }, index.h("g", null, index.h("foreignObject", { x: "0", y: "0", width: object.totalWidth.toString(), height: object.totalHeight.toString(), style: {
5954
5949
  minHeight: '0',
5955
5950
  minWidth: '0',
5951
+ transform: `rotate(${object.rotationDegrees}deg)`,
5952
+ transformOrigin: 'center',
5956
5953
  backgroundColor: object.backgroundColor,
5957
5954
  borderColor: object.borderColor,
5958
5955
  borderWidth: object.borderWidth + 'px',
@@ -5994,44 +5991,74 @@ const KritzelEngine = class {
5994
5991
  stroke: 'var(--kritzel-selection-border-color, #0e1111)',
5995
5992
  strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_b = this.store.state) === null || _b === void 0 ? void 0 : _b.scale})`,
5996
5993
  strokeLinecap: 'square',
5994
+ transform: `rotate(${object.rotationDegrees}deg)`,
5995
+ transformOrigin: 'center',
5997
5996
  }, visibility: object.selected ? 'visible' : 'hidden' }), index.h("line", { x1: "0", y1: "0", x2: "0", y2: object.totalHeight, style: {
5998
5997
  stroke: 'var(--kritzel-selection-border-color, #0e1111)',
5999
5998
  strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_c = this.store.state) === null || _c === void 0 ? void 0 : _c.scale})`,
6000
5999
  strokeLinecap: 'square',
6000
+ transform: `rotate(${object.rotationDegrees}deg)`,
6001
+ transformOrigin: 'center',
6001
6002
  }, visibility: object.selected ? 'visible' : 'hidden' }), index.h("line", { x1: "0", y1: object.totalHeight, x2: object.totalWidth, y2: object.totalHeight, style: {
6002
6003
  stroke: 'var(--kritzel-selection-border-color, #0e1111)',
6003
6004
  strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_d = this.store.state) === null || _d === void 0 ? void 0 : _d.scale})`,
6004
6005
  strokeLinecap: 'square',
6006
+ transform: `rotate(${object.rotationDegrees}deg)`,
6007
+ transformOrigin: 'center',
6005
6008
  }, visibility: object.selected ? 'visible' : 'hidden' }), index.h("line", { x1: object.totalWidth, y1: "0", x2: object.totalWidth, y2: object.totalHeight, style: {
6006
6009
  stroke: 'var(--kritzel-selection-border-color, #0e1111)',
6007
6010
  strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_e = this.store.state) === null || _e === void 0 ? void 0 : _e.scale})`,
6008
6011
  strokeLinecap: 'square',
6012
+ transform: `rotate(${object.rotationDegrees}deg)`,
6013
+ transformOrigin: 'center',
6009
6014
  }, visibility: object.selected ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle top-left", cx: "0", cy: "0", r: `${(baseHandleSize * object.scale) / ((_f = this.store.state) === null || _f === void 0 ? void 0 : _f.scale)}`, style: {
6010
6015
  fill: 'var(--kritzel-selection-handle-color, #000000)',
6016
+ transform: `rotate(${object.rotationDegrees}deg)`,
6017
+ transformOrigin: 'center',
6011
6018
  }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle-overlay top-left", cx: "0", cy: "0", r: `${(baseHandleTouchSize * object.scale) / ((_g = this.store.state) === null || _g === void 0 ? void 0 : _g.scale)}`, style: {
6012
6019
  fill: 'transparent',
6020
+ transform: `rotate(${object.rotationDegrees}deg)`,
6021
+ transformOrigin: 'center',
6013
6022
  }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle top-right", cx: object.totalWidth, cy: "0", r: `${(baseHandleSize * object.scale) / ((_h = this.store.state) === null || _h === void 0 ? void 0 : _h.scale)}`, style: {
6014
6023
  fill: 'var(--kritzel-selection-handle-color, #000000)',
6024
+ transform: `rotate(${object.rotationDegrees}deg)`,
6025
+ transformOrigin: 'center',
6015
6026
  }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle-overlay top-right", cx: object.totalWidth, cy: "0", r: `${(baseHandleTouchSize * object.scale) / ((_j = this.store.state) === null || _j === void 0 ? void 0 : _j.scale)}`, style: {
6016
6027
  fill: 'transparent',
6028
+ transform: `rotate(${object.rotationDegrees}deg)`,
6029
+ transformOrigin: 'center',
6017
6030
  }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle bottom-left", cx: "0", cy: object.totalHeight, r: `${(baseHandleSize * object.scale) / ((_k = this.store.state) === null || _k === void 0 ? void 0 : _k.scale)}`, style: {
6018
6031
  fill: 'var(--kritzel-selection-handle-color, #000000)',
6032
+ transform: `rotate(${object.rotationDegrees}deg)`,
6033
+ transformOrigin: 'center',
6019
6034
  }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle-overlay bottom-left", cx: "0", cy: object.totalHeight, r: `${(baseHandleTouchSize * object.scale) / ((_l = this.store.state) === null || _l === void 0 ? void 0 : _l.scale)}`, style: {
6020
6035
  fill: 'transparent',
6036
+ transform: `rotate(${object.rotationDegrees}deg)`,
6037
+ transformOrigin: 'center',
6021
6038
  }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle bottom-right", cx: object.totalWidth, cy: object.totalHeight, r: `${(baseHandleSize * object.scale) / ((_m = this.store.state) === null || _m === void 0 ? void 0 : _m.scale)}`, style: {
6022
6039
  fill: 'var(--kritzel-selection-handle-color, #000000)',
6040
+ transform: `rotate(${object.rotationDegrees}deg)`,
6041
+ transformOrigin: 'center',
6023
6042
  }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle-overlay bottom-right", cx: object.totalWidth, cy: object.totalHeight, r: `${(baseHandleTouchSize * object.scale) / ((_o = this.store.state) === null || _o === void 0 ? void 0 : _o.scale)}`, style: {
6024
6043
  fill: 'transparent',
6044
+ transform: `rotate(${object.rotationDegrees}deg)`,
6045
+ transformOrigin: 'center',
6025
6046
  }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("line", { x1: object.totalWidth / 2, y1: "0", x2: object.totalWidth / 2, y2: -((15 * object.scale) / ((_p = this.store.state) === null || _p === void 0 ? void 0 : _p.scale)), style: {
6026
6047
  stroke: 'var(--kritzel-selection-border-color, #0e1111)',
6027
6048
  strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_q = this.store.state) === null || _q === void 0 ? void 0 : _q.scale})`,
6049
+ transform: `rotate(${object.rotationDegrees}deg)`,
6050
+ transformOrigin: 'center',
6028
6051
  }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "rotation-handle", cx: object.totalWidth / 2, cy: -((15 * object.scale) / ((_r = this.store.state) === null || _r === void 0 ? void 0 : _r.scale)), r: `${(baseHandleSize * object.scale) / ((_s = this.store.state) === null || _s === void 0 ? void 0 : _s.scale)}`, style: {
6029
6052
  fill: 'var(--kritzel-selection-handle-color, #000000)',
6053
+ transform: `rotate(${object.rotationDegrees}deg)`,
6054
+ transformOrigin: 'center',
6030
6055
  }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "rotation-handle-overlay", cx: object.totalWidth / 2, cy: -((15 * object.scale) / ((_t = this.store.state) === null || _t === void 0 ? void 0 : _t.scale)), r: `${(baseHandleTouchSize * object.scale) / ((_u = this.store.state) === null || _u === void 0 ? void 0 : _u.scale)}`, style: {
6031
6056
  fill: 'transparent',
6032
6057
  cursor: 'grab',
6058
+ transform: `rotate(${object.rotationDegrees}deg)`,
6059
+ transformOrigin: 'center'
6033
6060
  }, 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))))));
6034
- }), index.h("svg", { key: '89f59077f5b1680ee635f52e91b7e00533ace21b', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
6061
+ }), index.h("svg", { key: '6e836f2ab225812cbca612e78cfc5d1768b983a0', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
6035
6062
  height: (_u = this.store.state.currentPath) === null || _u === void 0 ? void 0 : _u.height.toString(),
6036
6063
  width: (_v = this.store.state.currentPath) === null || _v === void 0 ? void 0 : _v.width.toString(),
6037
6064
  left: '0',
@@ -6040,12 +6067,12 @@ const KritzelEngine = class {
6040
6067
  position: 'absolute',
6041
6068
  transform: (_x = this.store.state.currentPath) === null || _x === void 0 ? void 0 : _x.transformationMatrix,
6042
6069
  overflow: 'visible',
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: {
6070
+ }, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, index.h("path", { key: 'd3649d4a3f4b08a384cd81aa9db2da59509f979e', 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: 'c2cc2230bd4e080c8beac650c65b0c7808893478', ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, style: {
6044
6071
  position: 'fixed',
6045
6072
  left: `${this.store.state.contextMenuX}px`,
6046
6073
  top: `${this.store.state.contextMenuY}px`,
6047
6074
  zIndex: '10000',
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' })));
6075
+ }, 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: '10aeba615cd927920793f83c3a53dc75397b617c' })));
6049
6076
  }
6050
6077
  get host() { return index.getElement(this); }
6051
6078
  };