kritzel-stencil 0.0.102 → 0.0.104

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.
@@ -3895,7 +3895,6 @@ class KritzelRotationHandler extends KritzelBaseHandler {
3895
3895
  const currentRotation = Math.atan2(groupCenterY - cursorY, groupCenterX - cursorX);
3896
3896
  this.rotation = currentRotation - this.initialRotation;
3897
3897
  this._store.state.selectionGroup.rotate(this.rotation);
3898
- this._store.rerender();
3899
3898
  clearTimeout(this._store.state.longTouchTimeout);
3900
3899
  }
3901
3900
  }
@@ -4352,7 +4351,6 @@ class KritzelReviver {
4352
4351
  let revivedObj;
4353
4352
  switch (obj.__class__) {
4354
4353
  case 'KritzelPath':
4355
- console.log('Reviving KritzelPath');
4356
4354
  revivedObj = new KritzelPath(this._store).revive(obj);
4357
4355
  break;
4358
4356
  case 'KritzelText':
@@ -4362,7 +4360,6 @@ class KritzelReviver {
4362
4360
  revivedObj = new KritzelImage(this._store, obj.img).revive(obj);
4363
4361
  break;
4364
4362
  case 'KritzelSelectionGroup':
4365
- console.log('Reviving KritzelSelectionGroup');
4366
4363
  revivedObj = new KritzelSelectionGroup(this._store).revive(obj);
4367
4364
  break;
4368
4365
  case 'KritzelBrushTool':
@@ -4462,13 +4459,13 @@ class KritzelSelectionGroup extends KritzelBaseObject {
4462
4459
  const heightScaleFactor = height / this.height;
4463
4460
  const deltaX = x - this.translateX;
4464
4461
  const deltaY = y - this.translateY;
4465
- this.objects.forEach(child => {
4466
- const updatedWidth = child.width * widthScaleFactor;
4467
- const updatedHeight = child.height * heightScaleFactor;
4468
- const updatedX = child.translateX + deltaX + (child.translateX - this.translateX) * (widthScaleFactor - 1);
4469
- const updatedY = child.translateY + deltaY + (child.translateY - this.translateY) * (heightScaleFactor - 1);
4470
- child.resize(updatedX, updatedY, updatedWidth, updatedHeight);
4471
- this._store.state.objectsOctree.update(child);
4462
+ this.objects.forEach(obj => {
4463
+ const updatedWidth = obj.width * widthScaleFactor;
4464
+ const updatedHeight = obj.height * heightScaleFactor;
4465
+ const updatedX = obj.translateX + deltaX + (obj.translateX - this.translateX) * (widthScaleFactor - 1);
4466
+ const updatedY = obj.translateY + deltaY + (obj.translateY - this.translateY) * (heightScaleFactor - 1);
4467
+ obj.resize(updatedX, updatedY, updatedWidth, updatedHeight);
4468
+ this._store.state.objectsOctree.update(obj);
4472
4469
  });
4473
4470
  this.refreshObjectDimensions();
4474
4471
  this.unchangedObjects = ObjectHelper.clone(this.objects);
@@ -4489,7 +4486,6 @@ class KritzelSelectionGroup extends KritzelBaseObject {
4489
4486
  child.translateX = centerX + rotatedX - child.totalWidth / 2 / child.scale;
4490
4487
  child.translateY = centerY + rotatedY - child.totalHeight / 2 / child.scale;
4491
4488
  child.rotation = this.objects.length === 1 ? value : value + unchangedChild.rotation;
4492
- this._store.state.objectsOctree.update(child);
4493
4489
  });
4494
4490
  }
4495
4491
  copy() {
@@ -5669,7 +5665,7 @@ class KritzelContextMenuHandler extends KritzelBaseHandler {
5669
5665
  }
5670
5666
  }
5671
5667
 
5672
- const kritzelEngineCss = ":host{display:block;position:relative;height:100%;width:100%;overflow:hidden;background-color:var(--kritzel-engine-background-color, #ffffff)}.debug-panel{position:absolute;top:0;right:0}.origin{position:relative;top:0;left:0;height:0;width:0;-webkit-transform-origin:top left;-moz-transform-origin:top left;transform-origin:top left;overflow:visible}.object{-webkit-transform-origin:top left;-moz-transform-origin:top left;transform-origin:top left;overflow:visible}textarea{all:unset;box-sizing:border-box;outline:none !important;border:none !important;overflow:visible}.resize-handle-overlay.top-left,.resize-handle-overlay.bottom-right{cursor:nwse-resize}.resize-handle-overlay.top-right,.resize-handle-overlay.bottom-left{cursor:nesw-resize}.rotation-handle-overlay{cursor:grab}";
5668
+ const kritzelEngineCss = ":host{display:block;position:relative;height:100%;width:100%;overflow:hidden;background-color:var(--kritzel-engine-background-color, #ffffff)}.debug-panel{position:absolute;pointer-events:none;top:0;right:0}.origin{position:relative;top:0;left:0;height:0;width:0;pointer-events:none;-webkit-transform-origin:top left;-moz-transform-origin:top left;transform-origin:top left;overflow:visible}.object{overflow:visible}textarea{all:unset;box-sizing:border-box;outline:none !important;border:none !important;overflow:visible}.resize-handle-overlay.top-left,.resize-handle-overlay.bottom-right{cursor:nwse-resize}.resize-handle-overlay.top-right,.resize-handle-overlay.bottom-left{cursor:nesw-resize}.rotation-handle-overlay{cursor:grab}";
5673
5669
 
5674
5670
  const KritzelEngine = class {
5675
5671
  get isSelecting() {
@@ -5937,18 +5933,18 @@ const KritzelEngine = class {
5937
5933
  } }, (_t = this.store.objects) === null || _t === void 0 ? void 0 :
5938
5934
  _t.map(object => {
5939
5935
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
5940
- return (h("svg", { xmlns: "http://www.w3.org/2000/svg", key: object.id, id: object.id, class: "object", style: {
5936
+ return (h("div", { style: { transform: object === null || object === void 0 ? void 0 : object.transformationMatrix, transformOrigin: 'top left' } }, h("svg", { xmlns: "http://www.w3.org/2000/svg", key: object.id, id: object.id, class: "object", style: {
5941
5937
  height: object === null || object === void 0 ? void 0 : object.totalHeight.toString(),
5942
5938
  width: object === null || object === void 0 ? void 0 : object.totalWidth.toString(),
5943
5939
  left: '0',
5944
5940
  top: '0',
5945
5941
  position: 'absolute',
5946
- transform: `${object === null || object === void 0 ? void 0 : object.transformationMatrix} rotate(${object.rotationDegrees}deg)`,
5942
+ transform: `rotate(${object.rotationDegrees}deg)`,
5947
5943
  transformOrigin: 'center',
5948
5944
  opacity: object.markedForRemoval ? '0.5' : object.opacity.toString(),
5949
5945
  pointerEvents: object.markedForRemoval ? 'none' : 'auto',
5950
5946
  zIndex: object.zIndex.toString(),
5951
- } }, h("g", null, h("foreignObject", { x: "0", y: "0", width: object.totalWidth.toString(), height: object.totalHeight.toString(), style: {
5947
+ } }, h("foreignObject", { x: "0", y: "0", width: object.totalWidth.toString(), height: object.totalHeight.toString(), style: {
5952
5948
  minHeight: '0',
5953
5949
  minWidth: '0',
5954
5950
  backgroundColor: object.backgroundColor,
@@ -6028,8 +6024,8 @@ const KritzelEngine = class {
6028
6024
  }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), 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: {
6029
6025
  fill: 'transparent',
6030
6026
  cursor: 'grab',
6031
- }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' })), h("g", { style: { display: this.store.state.debugInfo.showObjectInfo ? 'block' : 'none' } }, h("foreignObject", { x: object.totalWidth.toString(), y: "0", width: "400px", height: "160px", style: { minHeight: '0', minWidth: '0', display: object.debugInfoVisible ? 'block' : 'none' } }, h("div", { style: { width: '100%', height: '100%' } }, h("div", { style: { whiteSpace: 'nowrap' } }, "zIndex: ", object.zIndex), h("div", { style: { whiteSpace: 'nowrap' } }, "translateX: ", object.translateX), h("div", { style: { whiteSpace: 'nowrap' } }, "translateY: ", object.translateY), h("div", { style: { whiteSpace: 'nowrap' } }, "width: ", object.width), h("div", { style: { whiteSpace: 'nowrap' } }, "height: ", object.height), h("div", { style: { whiteSpace: 'nowrap' } }, "scale: ", object.scale), h("div", { style: { whiteSpace: 'nowrap' } }, "rotation: ", object.rotation))))));
6032
- }), h("svg", { key: '89f59077f5b1680ee635f52e91b7e00533ace21b', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
6027
+ }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), h("g", { style: { display: this.store.state.debugInfo.showObjectInfo ? 'block' : 'none', pointerEvents: 'none' } }, h("foreignObject", { x: object.totalWidth.toString(), y: "0", width: "400px", height: "160px", style: { minHeight: '0', minWidth: '0', display: object.debugInfoVisible ? 'block' : 'none' } }, h("div", { style: { width: '100%', height: '100%' } }, h("div", { style: { whiteSpace: 'nowrap' } }, "zIndex: ", object.zIndex), h("div", { style: { whiteSpace: 'nowrap' } }, "translateX: ", object.translateX), h("div", { style: { whiteSpace: 'nowrap' } }, "translateY: ", object.translateY), h("div", { style: { whiteSpace: 'nowrap' } }, "width: ", object.width), h("div", { style: { whiteSpace: 'nowrap' } }, "height: ", object.height), h("div", { style: { whiteSpace: 'nowrap' } }, "scale: ", object.scale), h("div", { style: { whiteSpace: 'nowrap' } }, "rotation: ", object.rotation)))))));
6028
+ }), h("svg", { key: '76788f88c63996a85778fac600f568e651f2604f', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
6033
6029
  height: (_u = this.store.state.currentPath) === null || _u === void 0 ? void 0 : _u.height.toString(),
6034
6030
  width: (_v = this.store.state.currentPath) === null || _v === void 0 ? void 0 : _v.width.toString(),
6035
6031
  left: '0',
@@ -6037,13 +6033,14 @@ const KritzelEngine = class {
6037
6033
  zIndex: (_w = this.store.state.currentPath) === null || _w === void 0 ? void 0 : _w.zIndex.toString(),
6038
6034
  position: 'absolute',
6039
6035
  transform: (_x = this.store.state.currentPath) === null || _x === void 0 ? void 0 : _x.transformationMatrix,
6036
+ transformOrigin: 'top left',
6040
6037
  overflow: 'visible',
6041
- }, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, 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 && (h("kritzel-context-menu", { key: '62f514da488f41bd0f7c00322f44e99b3711306d', ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, style: {
6038
+ }, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, h("path", { key: 'e0356205729f20a61f5bbac14393d4d607a7c865', 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 && (h("kritzel-context-menu", { key: '23ab721c25518e6c6a6e6e163fa0753e054cb5e7', ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, style: {
6042
6039
  position: 'fixed',
6043
6040
  left: `${this.store.state.contextMenuX}px`,
6044
6041
  top: `${this.store.state.contextMenuY}px`,
6045
6042
  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 && h("kritzel-cursor-trail", { key: '841e02523a20413a9e69ca6976dfb95f670620aa' })));
6043
+ }, onActionSelected: event => this.handleContextMenuAction(event) })), ((_2 = this.store.state) === null || _2 === void 0 ? void 0 : _2.activeTool) instanceof KritzelEraserTool && !this.store.state.isScaling && h("kritzel-cursor-trail", { key: '01f90ff856d6a3b0812ce47796fd59dbbf0cd52d' })));
6047
6044
  }
6048
6045
  get host() { return getElement(this); }
6049
6046
  };