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.
@@ -512,7 +512,6 @@ class KritzelRotationHandler extends KritzelBaseHandler {
512
512
  const currentRotation = Math.atan2(groupCenterY - cursorY, groupCenterX - cursorX);
513
513
  this.rotation = currentRotation - this.initialRotation;
514
514
  this._store.state.selectionGroup.rotate(this.rotation);
515
- this._store.rerender();
516
515
  clearTimeout(this._store.state.longTouchTimeout);
517
516
  }
518
517
  }
@@ -969,7 +968,6 @@ class KritzelReviver {
969
968
  let revivedObj;
970
969
  switch (obj.__class__) {
971
970
  case 'KritzelPath':
972
- console.log('Reviving KritzelPath');
973
971
  revivedObj = new KritzelPath(this._store).revive(obj);
974
972
  break;
975
973
  case 'KritzelText':
@@ -979,7 +977,6 @@ class KritzelReviver {
979
977
  revivedObj = new KritzelImage(this._store, obj.img).revive(obj);
980
978
  break;
981
979
  case 'KritzelSelectionGroup':
982
- console.log('Reviving KritzelSelectionGroup');
983
980
  revivedObj = new KritzelSelectionGroup(this._store).revive(obj);
984
981
  break;
985
982
  case 'KritzelBrushTool':
@@ -1079,13 +1076,13 @@ class KritzelSelectionGroup extends KritzelBaseObject {
1079
1076
  const heightScaleFactor = height / this.height;
1080
1077
  const deltaX = x - this.translateX;
1081
1078
  const deltaY = y - this.translateY;
1082
- this.objects.forEach(child => {
1083
- const updatedWidth = child.width * widthScaleFactor;
1084
- const updatedHeight = child.height * heightScaleFactor;
1085
- const updatedX = child.translateX + deltaX + (child.translateX - this.translateX) * (widthScaleFactor - 1);
1086
- const updatedY = child.translateY + deltaY + (child.translateY - this.translateY) * (heightScaleFactor - 1);
1087
- child.resize(updatedX, updatedY, updatedWidth, updatedHeight);
1088
- this._store.state.objectsOctree.update(child);
1079
+ this.objects.forEach(obj => {
1080
+ const updatedWidth = obj.width * widthScaleFactor;
1081
+ const updatedHeight = obj.height * heightScaleFactor;
1082
+ const updatedX = obj.translateX + deltaX + (obj.translateX - this.translateX) * (widthScaleFactor - 1);
1083
+ const updatedY = obj.translateY + deltaY + (obj.translateY - this.translateY) * (heightScaleFactor - 1);
1084
+ obj.resize(updatedX, updatedY, updatedWidth, updatedHeight);
1085
+ this._store.state.objectsOctree.update(obj);
1089
1086
  });
1090
1087
  this.refreshObjectDimensions();
1091
1088
  this.unchangedObjects = ObjectHelper.clone(this.objects);
@@ -1106,7 +1103,6 @@ class KritzelSelectionGroup extends KritzelBaseObject {
1106
1103
  child.translateX = centerX + rotatedX - child.totalWidth / 2 / child.scale;
1107
1104
  child.translateY = centerY + rotatedY - child.totalHeight / 2 / child.scale;
1108
1105
  child.rotation = this.objects.length === 1 ? value : value + unchangedChild.rotation;
1109
- this._store.state.objectsOctree.update(child);
1110
1106
  });
1111
1107
  }
1112
1108
  copy() {
@@ -2123,7 +2119,7 @@ class KritzelContextMenuHandler extends KritzelBaseHandler {
2123
2119
  }
2124
2120
  }
2125
2121
 
2126
- 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}";
2122
+ 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}";
2127
2123
 
2128
2124
  const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine extends H {
2129
2125
  get isSelecting() {
@@ -2393,18 +2389,18 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
2393
2389
  } }, (_t = this.store.objects) === null || _t === void 0 ? void 0 :
2394
2390
  _t.map(object => {
2395
2391
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
2396
- return (h("svg", { xmlns: "http://www.w3.org/2000/svg", key: object.id, id: object.id, class: "object", style: {
2392
+ 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: {
2397
2393
  height: object === null || object === void 0 ? void 0 : object.totalHeight.toString(),
2398
2394
  width: object === null || object === void 0 ? void 0 : object.totalWidth.toString(),
2399
2395
  left: '0',
2400
2396
  top: '0',
2401
2397
  position: 'absolute',
2402
- transform: `${object === null || object === void 0 ? void 0 : object.transformationMatrix} rotate(${object.rotationDegrees}deg)`,
2398
+ transform: `rotate(${object.rotationDegrees}deg)`,
2403
2399
  transformOrigin: 'center',
2404
2400
  opacity: object.markedForRemoval ? '0.5' : object.opacity.toString(),
2405
2401
  pointerEvents: object.markedForRemoval ? 'none' : 'auto',
2406
2402
  zIndex: object.zIndex.toString(),
2407
- } }, h("g", null, h("foreignObject", { x: "0", y: "0", width: object.totalWidth.toString(), height: object.totalHeight.toString(), style: {
2403
+ } }, h("foreignObject", { x: "0", y: "0", width: object.totalWidth.toString(), height: object.totalHeight.toString(), style: {
2408
2404
  minHeight: '0',
2409
2405
  minWidth: '0',
2410
2406
  backgroundColor: object.backgroundColor,
@@ -2484,8 +2480,8 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
2484
2480
  }, 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: {
2485
2481
  fill: 'transparent',
2486
2482
  cursor: 'grab',
2487
- }, 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))))));
2488
- }), h("svg", { key: '89f59077f5b1680ee635f52e91b7e00533ace21b', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
2483
+ }, 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)))))));
2484
+ }), h("svg", { key: '76788f88c63996a85778fac600f568e651f2604f', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
2489
2485
  height: (_u = this.store.state.currentPath) === null || _u === void 0 ? void 0 : _u.height.toString(),
2490
2486
  width: (_v = this.store.state.currentPath) === null || _v === void 0 ? void 0 : _v.width.toString(),
2491
2487
  left: '0',
@@ -2493,13 +2489,14 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
2493
2489
  zIndex: (_w = this.store.state.currentPath) === null || _w === void 0 ? void 0 : _w.zIndex.toString(),
2494
2490
  position: 'absolute',
2495
2491
  transform: (_x = this.store.state.currentPath) === null || _x === void 0 ? void 0 : _x.transformationMatrix,
2492
+ transformOrigin: 'top left',
2496
2493
  overflow: 'visible',
2497
- }, 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: {
2494
+ }, 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: {
2498
2495
  position: 'fixed',
2499
2496
  left: `${this.store.state.contextMenuX}px`,
2500
2497
  top: `${this.store.state.contextMenuY}px`,
2501
2498
  zIndex: '10000',
2502
- }, 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' })));
2499
+ }, 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' })));
2503
2500
  }
2504
2501
  get host() { return this; }
2505
2502
  static get style() { return kritzelEngineCss; }
@@ -2553,6 +2550,6 @@ function defineCustomElement() {
2553
2550
  }
2554
2551
 
2555
2552
  export { KritzelEngine as K, KritzelSelectionTool as a, KritzelEraserTool as b, KritzelImageTool as c, defineCustomElement as d };
2556
- //# sourceMappingURL=p-CF-8joQn.js.map
2553
+ //# sourceMappingURL=p-DMSOfO6k.js.map
2557
2554
 
2558
- //# sourceMappingURL=p-CF-8joQn.js.map
2555
+ //# sourceMappingURL=p-DMSOfO6k.js.map