kritzel-stencil 0.0.50 → 0.0.52

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.
Files changed (62) hide show
  1. package/dist/cjs/kritzel-brush-style_17.cjs.entry.js +111 -41
  2. package/dist/cjs/kritzel-brush-style_17.cjs.entry.js.map +1 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/stencil.cjs.js +1 -1
  5. package/dist/collection/classes/handlers/move.handler.js +2 -2
  6. package/dist/collection/classes/handlers/move.handler.js.map +1 -1
  7. package/dist/collection/classes/handlers/resize.handler.js +2 -2
  8. package/dist/collection/classes/handlers/resize.handler.js.map +1 -1
  9. package/dist/collection/classes/handlers/rotation.handler.js +2 -2
  10. package/dist/collection/classes/handlers/rotation.handler.js.map +1 -1
  11. package/dist/collection/classes/handlers/selection.handler.js +3 -3
  12. package/dist/collection/classes/handlers/selection.handler.js.map +1 -1
  13. package/dist/collection/classes/objects/text.class.js +6 -0
  14. package/dist/collection/classes/objects/text.class.js.map +1 -1
  15. package/dist/collection/classes/tools/base-tool.class.js +3 -0
  16. package/dist/collection/classes/tools/base-tool.class.js.map +1 -1
  17. package/dist/collection/classes/tools/brush-tool.class.js +2 -2
  18. package/dist/collection/classes/tools/brush-tool.class.js.map +1 -1
  19. package/dist/collection/classes/tools/eraser-tool.class.js +2 -2
  20. package/dist/collection/classes/tools/eraser-tool.class.js.map +1 -1
  21. package/dist/collection/classes/tools/selection-tool.class.js +22 -8
  22. package/dist/collection/classes/tools/selection-tool.class.js.map +1 -1
  23. package/dist/collection/classes/tools/text-tool.class.js +2 -2
  24. package/dist/collection/classes/tools/text-tool.class.js.map +1 -1
  25. package/dist/collection/classes/viewport.class.js +3 -3
  26. package/dist/collection/classes/viewport.class.js.map +1 -1
  27. package/dist/collection/components/core/kritzel-engine/kritzel-engine.css +5 -5
  28. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +52 -22
  29. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
  30. package/dist/collection/helpers/event.helper.js +37 -0
  31. package/dist/collection/helpers/event.helper.js.map +1 -0
  32. package/dist/collection/interfaces/tool.interface.js.map +1 -1
  33. package/dist/components/kritzel-controls.js +1 -1
  34. package/dist/components/kritzel-editor.js +2 -2
  35. package/dist/components/kritzel-engine.js +1 -1
  36. package/dist/components/{p-CtEAGz7l.js → p-BKUZklXg.js} +3 -3
  37. package/dist/components/{p-CtEAGz7l.js.map → p-BKUZklXg.js.map} +1 -1
  38. package/dist/components/{p-HvgL185t.js → p-BU-NnTzn.js} +66 -19
  39. package/dist/components/p-BU-NnTzn.js.map +1 -0
  40. package/dist/components/{p-CB6Ur7Oy.js → p-CQ0It7sw.js} +52 -29
  41. package/dist/components/p-CQ0It7sw.js.map +1 -0
  42. package/dist/esm/kritzel-brush-style_17.entry.js +111 -41
  43. package/dist/esm/kritzel-brush-style_17.entry.js.map +1 -1
  44. package/dist/esm/loader.js +1 -1
  45. package/dist/esm/stencil.js +1 -1
  46. package/dist/stencil/p-dcb3b8e3.entry.js +2 -0
  47. package/dist/stencil/p-dcb3b8e3.entry.js.map +1 -0
  48. package/dist/stencil/stencil.esm.js +1 -1
  49. package/dist/types/classes/objects/text.class.d.ts +1 -0
  50. package/dist/types/classes/tools/base-tool.class.d.ts +1 -0
  51. package/dist/types/classes/tools/selection-tool.class.d.ts +1 -0
  52. package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +1 -0
  53. package/dist/types/helpers/event.helper.d.ts +9 -0
  54. package/dist/types/interfaces/tool.interface.d.ts +1 -0
  55. package/package.json +1 -1
  56. package/dist/collection/helpers/click.helper.js +0 -13
  57. package/dist/collection/helpers/click.helper.js.map +0 -1
  58. package/dist/components/p-CB6Ur7Oy.js.map +0 -1
  59. package/dist/components/p-HvgL185t.js.map +0 -1
  60. package/dist/stencil/p-6ad38a90.entry.js +0 -2
  61. package/dist/stencil/p-6ad38a90.entry.js.map +0 -1
  62. package/dist/types/helpers/click.helper.d.ts +0 -5
@@ -233,7 +233,7 @@ var KritzelMouseButton;
233
233
  KritzelMouseButton[KritzelMouseButton["Right"] = 2] = "Right";
234
234
  })(KritzelMouseButton || (KritzelMouseButton = {}));
235
235
 
236
- class KritzelMouseHelper {
236
+ class KritzelEventHelper {
237
237
  static isRightClick(ev) {
238
238
  return ev.button === KritzelMouseButton.Right;
239
239
  }
@@ -243,7 +243,31 @@ class KritzelMouseHelper {
243
243
  static isMainMouseWheel(event) {
244
244
  return Math.abs(event.deltaY) > 0 && Math.abs(event.deltaX) === 0 && Number.isInteger(event.deltaY);
245
245
  }
246
+ static detectDoubleTap(event, host) {
247
+ const currentTime = Date.now();
248
+ const tapLength = currentTime - KritzelEventHelper.lastTapTimestamp;
249
+ if (KritzelEventHelper.tapTimeoutId) {
250
+ clearTimeout(KritzelEventHelper.tapTimeoutId);
251
+ KritzelEventHelper.tapTimeoutId = null;
252
+ }
253
+ if (tapLength < KritzelEventHelper.doubleTapTimeout && tapLength > 0) {
254
+ KritzelEventHelper.lastTapTimestamp = 0;
255
+ const doubleTapEvent = new CustomEvent('doubletap', { detail: event, bubbles: true, composed: true });
256
+ host.dispatchEvent(doubleTapEvent);
257
+ return true;
258
+ }
259
+ else {
260
+ KritzelEventHelper.lastTapTimestamp = currentTime;
261
+ KritzelEventHelper.tapTimeoutId = setTimeout(() => {
262
+ KritzelEventHelper.tapTimeoutId = null;
263
+ }, KritzelEventHelper.doubleTapTimeout);
264
+ return false;
265
+ }
266
+ }
246
267
  }
268
+ KritzelEventHelper.lastTapTimestamp = 0;
269
+ KritzelEventHelper.tapTimeoutId = null;
270
+ KritzelEventHelper.doubleTapTimeout = 300;
247
271
 
248
272
  class KritzelBaseCommand {
249
273
  constructor(store, initiator) {
@@ -313,7 +337,7 @@ class KritzelMoveHandler extends KritzelBaseHandler {
313
337
  }
314
338
  handleMouseDown(event) {
315
339
  var _a;
316
- if (KritzelMouseHelper.isLeftClick(event)) {
340
+ if (KritzelEventHelper.isLeftClick(event)) {
317
341
  if (((_a = this._store.state.selectionGroup) === null || _a === void 0 ? void 0 : _a.selected) && !this._store.state.isResizeHandleSelected && !this._store.state.isRotationHandleSelected) {
318
342
  const clientX = event.clientX - this._store.offsetX;
319
343
  const clientY = event.clientY - this._store.offsetY;
@@ -415,7 +439,7 @@ class KritzelResizeHandler extends KritzelBaseHandler {
415
439
  this.newSize = { x: 0, y: 0, width: 0, height: 0 };
416
440
  }
417
441
  handleMouseDown(event) {
418
- if (KritzelMouseHelper.isLeftClick(event)) {
442
+ if (KritzelEventHelper.isLeftClick(event)) {
419
443
  if (this._store.state.selectionGroup && this._store.state.isResizeHandleSelected) {
420
444
  const clientX = event.clientX - this._store.offsetX;
421
445
  const clientY = event.clientY - this._store.offsetY;
@@ -573,7 +597,7 @@ class KritzelRotationHandler extends KritzelBaseHandler {
573
597
  this.rotation = 0;
574
598
  }
575
599
  handleMouseDown(event) {
576
- if (KritzelMouseHelper.isLeftClick(event)) {
600
+ if (KritzelEventHelper.isLeftClick(event)) {
577
601
  if (this._store.state.selectionGroup && this._store.state.isRotationHandleSelected) {
578
602
  const clientX = event.clientX - this._store.offsetX;
579
603
  const clientY = event.clientY - this._store.offsetY;
@@ -3163,6 +3187,9 @@ class KritzelBaseTool {
3163
3187
  handleDoubleClick(_event) {
3164
3188
  // default implementation
3165
3189
  }
3190
+ handleDoubleTap(_event) {
3191
+ // default implementation
3192
+ }
3166
3193
  handleTouchStart(_event) {
3167
3194
  // default implementation
3168
3195
  }
@@ -3254,7 +3281,7 @@ class KritzelTextTool extends KritzelBaseTool {
3254
3281
  this._store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
3255
3282
  return;
3256
3283
  }
3257
- if (KritzelMouseHelper.isLeftClick(event) === false) {
3284
+ if (KritzelEventHelper.isLeftClick(event) === false) {
3258
3285
  return;
3259
3286
  }
3260
3287
  const clientX = event.clientX - this._store.offsetX;
@@ -3352,6 +3379,12 @@ class KritzelText extends KritzelBaseObject {
3352
3379
  this.translateX = x;
3353
3380
  this.translateY = y;
3354
3381
  }
3382
+ handleKeyDown(event) {
3383
+ if (this.isReadonly) {
3384
+ event.preventDefault();
3385
+ event.stopPropagation();
3386
+ }
3387
+ }
3355
3388
  handleInput(event) {
3356
3389
  const target = event.target;
3357
3390
  if (target.value === '') {
@@ -3425,7 +3458,7 @@ class KritzelBrushTool extends KritzelBaseTool {
3425
3458
  };
3426
3459
  }
3427
3460
  handleMouseDown(event) {
3428
- if (KritzelMouseHelper.isLeftClick(event)) {
3461
+ if (KritzelEventHelper.isLeftClick(event)) {
3429
3462
  this._store.state.isDrawing = true;
3430
3463
  const x = event.clientX - this._store.offsetX;
3431
3464
  const y = event.clientY - this._store.offsetY;
@@ -3540,7 +3573,7 @@ class KritzelEraserTool extends KritzelBaseTool {
3540
3573
  this.touchStartTimeout = null;
3541
3574
  }
3542
3575
  handleMouseDown(event) {
3543
- if (KritzelMouseHelper.isLeftClick(event)) {
3576
+ if (KritzelEventHelper.isLeftClick(event)) {
3544
3577
  this._store.state.isErasing = true;
3545
3578
  }
3546
3579
  }
@@ -3930,7 +3963,7 @@ class KritzelSelectionHandler extends KritzelBaseHandler {
3930
3963
  this.touchStartTimeout = null;
3931
3964
  }
3932
3965
  handleMouseDown(event) {
3933
- if (KritzelMouseHelper.isLeftClick(event) && !this._store.state.selectionGroup) {
3966
+ if (KritzelEventHelper.isLeftClick(event) && !this._store.state.selectionGroup) {
3934
3967
  this.startMouseSelection(event);
3935
3968
  }
3936
3969
  }
@@ -3940,7 +3973,7 @@ class KritzelSelectionHandler extends KritzelBaseHandler {
3940
3973
  }
3941
3974
  }
3942
3975
  handleMouseUp(event) {
3943
- if (KritzelMouseHelper.isLeftClick(event) && this._store.state.isSelecting) {
3976
+ if (KritzelEventHelper.isLeftClick(event) && this._store.state.isSelecting) {
3944
3977
  if (this.isSelectionClick) {
3945
3978
  this.updateMouseSelection(event);
3946
3979
  this.addSelectedObjectAtIndexToSelectionGroup(0);
@@ -4114,7 +4147,7 @@ class KritzelSelectionTool extends KritzelBaseTool {
4114
4147
  this.rotationHandler = new KritzelRotationHandler(this._store);
4115
4148
  }
4116
4149
  handleMouseDown(event) {
4117
- if (KritzelMouseHelper.isLeftClick(event)) {
4150
+ if (KritzelEventHelper.isLeftClick(event)) {
4118
4151
  this._store.state.isResizeHandleSelected = this.isHandleSelected(event);
4119
4152
  this._store.state.isRotationHandleSelected = this.isRotationHandleSelected(event);
4120
4153
  this._store.state.resizeHandleType = this.getHandleType(event);
@@ -4149,13 +4182,13 @@ class KritzelSelectionTool extends KritzelBaseTool {
4149
4182
  }
4150
4183
  handleDoubleClick(event) {
4151
4184
  var _a;
4152
- if (KritzelMouseHelper.isLeftClick(event)) {
4185
+ if (KritzelEventHelper.isLeftClick(event)) {
4153
4186
  if (this._store.state.selectionGroup && ((_a = this._store.state.selectionGroup) === null || _a === void 0 ? void 0 : _a.objects.length) === 1) {
4154
4187
  const selectedObject = this._store.state.selectionGroup.objects[0];
4155
4188
  if (selectedObject instanceof KritzelText) {
4156
- this._store.state.activeText = selectedObject;
4157
- this._store.setState('activeTool', KritzelToolRegistry.getTool('text'));
4158
4189
  this._store.history.executeCommand(new RemoveSelectionGroupCommand(this._store, this._store.state.selectionGroup));
4190
+ this._store.setState('activeTool', KritzelToolRegistry.getTool('text'));
4191
+ this._store.state.activeText = selectedObject;
4159
4192
  setTimeout(() => {
4160
4193
  selectedObject.focus();
4161
4194
  }, 300);
@@ -4163,6 +4196,20 @@ class KritzelSelectionTool extends KritzelBaseTool {
4163
4196
  }
4164
4197
  }
4165
4198
  }
4199
+ handleDoubleTap(event) {
4200
+ const selectionGroup = this.getSelectedObject(event);
4201
+ if (!selectionGroup || selectionGroup.objects.length !== 1) {
4202
+ return;
4203
+ }
4204
+ const selectedObject = selectionGroup.objects[0];
4205
+ if (selectedObject instanceof KritzelText) {
4206
+ this._store.setState('activeTool', KritzelToolRegistry.getTool('text'));
4207
+ this._store.state.activeText = selectedObject;
4208
+ setTimeout(() => {
4209
+ selectedObject.focus();
4210
+ }, 300);
4211
+ }
4212
+ }
4166
4213
  handleTouchStart(event) {
4167
4214
  if (this._store.state.isScaling === true) {
4168
4215
  return;
@@ -4232,7 +4279,7 @@ class KritzelSelectionTool extends KritzelBaseTool {
4232
4279
  return;
4233
4280
  const point = event instanceof TouchEvent ? event.touches[0] : event;
4234
4281
  const elementAtPoint = shadowRoot.elementFromPoint(point.clientX, point.clientY);
4235
- const handle = elementAtPoint.closest('.selection-handle');
4282
+ const handle = elementAtPoint.closest('.resize-handle-overlay');
4236
4283
  return handle === null || handle === void 0 ? void 0 : handle.classList[1];
4237
4284
  }
4238
4285
  isHandleSelected(event) {
@@ -4242,11 +4289,11 @@ class KritzelSelectionTool extends KritzelBaseTool {
4242
4289
  return false;
4243
4290
  const point = event instanceof TouchEvent ? event.touches[0] : event;
4244
4291
  const elementAtPoint = shadowRoot.elementFromPoint(point.clientX, point.clientY);
4245
- return elementAtPoint === null || elementAtPoint === void 0 ? void 0 : elementAtPoint.classList.contains('selection-handle');
4292
+ return elementAtPoint === null || elementAtPoint === void 0 ? void 0 : elementAtPoint.classList.contains('resize-handle-overlay');
4246
4293
  }
4247
4294
  isRotationHandleSelected(event) {
4248
4295
  const path = event.composedPath();
4249
- return !!path.find(element => element.classList && element.classList.contains('rotation-handle'));
4296
+ return !!path.find(element => element.classList && element.classList.contains('rotation-handle-overlay'));
4250
4297
  }
4251
4298
  }
4252
4299
 
@@ -4777,7 +4824,7 @@ class KritzelViewport {
4777
4824
  handleMouseDown(event) {
4778
4825
  const adjustedClientX = event.clientX - this._store.offsetX;
4779
4826
  const adjustedClientY = event.clientY - this._store.offsetY;
4780
- if (KritzelMouseHelper.isRightClick(event)) {
4827
+ if (KritzelEventHelper.isRightClick(event)) {
4781
4828
  this._store.state.isPanning = true;
4782
4829
  this._store.state.startX = adjustedClientX;
4783
4830
  this._store.state.startY = adjustedClientY;
@@ -4855,7 +4902,7 @@ class KritzelViewport {
4855
4902
  }
4856
4903
  handleWheel(event) {
4857
4904
  event.preventDefault();
4858
- if (event.ctrlKey === true && KritzelMouseHelper.isMainMouseWheel(event)) {
4905
+ if (event.ctrlKey === true && KritzelEventHelper.isMainMouseWheel(event)) {
4859
4906
  this.handleZoom(event);
4860
4907
  }
4861
4908
  if (!event.ctrlKey) {
@@ -5603,7 +5650,7 @@ class KritzelContextMenuHandler extends KritzelBaseHandler {
5603
5650
  }
5604
5651
  }
5605
5652
 
5606
- const kritzelEngineCss = ":host{display:block;position:relative;height:100%;width:100%;overflow:hidden;background-color:var(--kritzel-engine-background-color)}.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}.selection-handle.top-left,.selection-handle.bottom-right{cursor:nwse-resize}.selection-handle.top-right,.selection-handle.bottom-left{cursor:nesw-resize}.rotation-handle{cursor:grab}";
5653
+ const kritzelEngineCss = ":host{display:block;position:relative;height:100%;width:100%;overflow:hidden;background-color:var(--kritzel-engine-background-color)}.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}";
5607
5654
 
5608
5655
  const KritzelEngine = class {
5609
5656
  get isSelecting() {
@@ -5708,11 +5755,22 @@ const KritzelEngine = class {
5708
5755
  }
5709
5756
  (_b = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.activeTool) === null || _b === void 0 ? void 0 : _b.handleDoubleClick(ev);
5710
5757
  }
5758
+ handleDoubleTap(ev) {
5759
+ var _a, _b;
5760
+ if (this.store.state.isEnabled === false) {
5761
+ return;
5762
+ }
5763
+ const touchEvent = (ev instanceof CustomEvent && ev.detail) ? ev.detail : ev;
5764
+ (_b = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.activeTool) === null || _b === void 0 ? void 0 : _b.handleDoubleTap(touchEvent);
5765
+ }
5711
5766
  handleTouchStart(ev) {
5712
5767
  var _a, _b;
5713
5768
  if (this.store.state.isEnabled === false) {
5714
5769
  return;
5715
5770
  }
5771
+ if (KritzelEventHelper.detectDoubleTap(ev, this.host)) {
5772
+ ev.preventDefault();
5773
+ }
5716
5774
  if (ev.touches.length > 1) {
5717
5775
  clearTimeout(this.store.state.longTouchTimeout);
5718
5776
  }
@@ -5834,19 +5892,20 @@ const KritzelEngine = class {
5834
5892
  const computedStyle = window.getComputedStyle(this.host);
5835
5893
  const baseHandleSizePx = computedStyle.getPropertyValue('--kritzel-selection-handle-size').trim() || '6px';
5836
5894
  const baseHandleSize = parseFloat(baseHandleSizePx);
5837
- return (index.h(index.Host, { key: '8c93c1725067a1b209f93cb8b5499bf02bcc381d' }, index.h("div", { key: '62a6bb281adafffcb6ad081af034b993cbe96eff', class: "debug-panel", style: { display: this.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, index.h("div", { key: 'f18e33c6aa209c6f06fb75ba32dab544de783633' }, "TranslateX: ", (_a = this.store.state) === null || _a === void 0 ? void 0 :
5838
- _a.translateX), index.h("div", { key: '08b39e966de61168724628e5bc13976d259b8ad8' }, "TranslateY: ", (_b = this.store.state) === null || _b === void 0 ? void 0 :
5839
- _b.translateY), index.h("div", { key: '3db0df41766210bbb6519751173bb3fdeb86e1e6' }, "ViewportWidth: ", (_c = this.store.state) === null || _c === void 0 ? void 0 :
5840
- _c.viewportWidth), index.h("div", { key: '1612a639fd88b20d0ed0b5d166f812956bac66a3' }, "ViewportHeight: ", (_d = this.store.state) === null || _d === void 0 ? void 0 :
5841
- _d.viewportHeight), index.h("div", { key: 'edc00a19dec1b352a3bb949ac3bde345b8df89ec' }, "ObjectsInViewport. ", this.store.objects.length), index.h("div", { key: 'fb79923fd43b3ff8bb41c3421d268404ee0fc1e5' }, "Scale: ", (_e = this.store.state) === null || _e === void 0 ? void 0 :
5842
- _e.scale), index.h("div", { key: 'c24a7021dcad79513ad5bacb043e514ac3744eff' }, "ActiveTool: ", (_g = (_f = this.store.state) === null || _f === void 0 ? void 0 : _f.activeTool) === null || _g === void 0 ? void 0 :
5843
- _g.name), index.h("div", { key: 'c7900987b3e46ce4fb3954769f3532e2bbf60490' }, "HasViewportChanged: ", ((_h = this.store.state) === null || _h === void 0 ? void 0 : _h.hasViewportChanged) ? 'true' : 'false'), index.h("div", { key: 'cb7d370322991cad920610bd236fd62e478b5941' }, "IsEnabled: ", ((_j = this.store.state) === null || _j === void 0 ? void 0 : _j.isEnabled) ? 'true' : 'false'), index.h("div", { key: '24f9f86ed96cc3bdaff35674e02cbc14bff7049f' }, "IsScaling: ", ((_k = this.store.state) === null || _k === void 0 ? void 0 : _k.isScaling) ? 'true' : 'false'), index.h("div", { key: '2d2bd520b15c44ecd26598c28a2ad68305cc0580' }, "IsPanning: ", ((_l = this.store.state) === null || _l === void 0 ? void 0 : _l.isPanning) ? 'true' : 'false'), index.h("div", { key: '806457d97d7bbb796ab33375f37d4a011202fb30' }, "IsFocused: ", this.store.state.isFocused ? 'true' : 'false'), index.h("div", { key: '1fe2c8e7e804180dea9af6ffc5b271f00603a2a8' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), index.h("div", { key: 'd3121fd8e82121a1a60a01e5ce307bfb74e58fc4' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), index.h("div", { key: '2159b067c26e9789f3017c8aadfab3377f6b7605' }, "IsResizeHandleSelected: ", this.store.state.isResizeHandleSelected ? 'true' : 'false'), index.h("div", { key: '8cd49fbdb55ee43f221b36639567f42ff4ea0dab' }, "IsRotationHandleSelected: ", this.store.state.isRotationHandleSelected ? 'true' : 'false'), index.h("div", { key: '44e59b9c97318deb4ea956f3185fd05e8e97995e' }, "IsDrawing: ", this.store.state.isDrawing ? 'true' : 'false'), index.h("div", { key: '196b21a2a1a61d0f27557a17c574f26d37699435' }, "IsWriting: ", this.store.state.isWriting ? 'true' : 'false'), index.h("div", { key: '9c0d83063a944b5e726d33478b96f06f820a0c76' }, "CursorX: ", (_m = this.store.state) === null || _m === void 0 ? void 0 :
5844
- _m.cursorX), index.h("div", { key: '9cfe8d127fe2392e04a863087c70262684a7088a' }, "CursorY: ", (_o = this.store.state) === null || _o === void 0 ? void 0 :
5845
- _o.cursorY)), index.h("div", { key: '5c130983eed8d66cc1dabb3c075b8d9f7b6f44d0', class: "origin", style: {
5895
+ const baseHandleTouchSize = baseHandleSize * 2 < 14 ? 14 : baseHandleSize;
5896
+ return (index.h(index.Host, { key: 'cfc40455bc3f5fb0377eef4d1edd0ecfdf474553' }, index.h("div", { key: 'a2cc196502f0ec1921044b673146d4889ccad31c', class: "debug-panel", style: { display: this.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, index.h("div", { key: '8f801674235f2722c0e9eca8d410cfb886d98730' }, "TranslateX: ", (_a = this.store.state) === null || _a === void 0 ? void 0 :
5897
+ _a.translateX), index.h("div", { key: 'e57278a7473aa8ba3dc25357503a8fd98785f7bb' }, "TranslateY: ", (_b = this.store.state) === null || _b === void 0 ? void 0 :
5898
+ _b.translateY), index.h("div", { key: 'c3b143bfc716ec1612fd33af71127014532621b4' }, "ViewportWidth: ", (_c = this.store.state) === null || _c === void 0 ? void 0 :
5899
+ _c.viewportWidth), index.h("div", { key: 'b640c3dac0e91e6669101153d42b9c1ba31cb2c8' }, "ViewportHeight: ", (_d = this.store.state) === null || _d === void 0 ? void 0 :
5900
+ _d.viewportHeight), index.h("div", { key: '759f07afb8b704061f324a552592238db16d35cc' }, "ObjectsInViewport. ", this.store.objects.length), index.h("div", { key: 'ee31e205a54e2e3414ed54893e9bc969289acca6' }, "Scale: ", (_e = this.store.state) === null || _e === void 0 ? void 0 :
5901
+ _e.scale), index.h("div", { key: 'dc30db434fcbb98a42de01572699bc65c4533e38' }, "ActiveTool: ", (_g = (_f = this.store.state) === null || _f === void 0 ? void 0 : _f.activeTool) === null || _g === void 0 ? void 0 :
5902
+ _g.name), index.h("div", { key: 'ddb51c71c7cf834aa13d437118a157994d04be70' }, "HasViewportChanged: ", ((_h = this.store.state) === null || _h === void 0 ? void 0 : _h.hasViewportChanged) ? 'true' : 'false'), index.h("div", { key: 'aa69549f8a095f38447ab84a0a436b830f0fe773' }, "IsEnabled: ", ((_j = this.store.state) === null || _j === void 0 ? void 0 : _j.isEnabled) ? 'true' : 'false'), index.h("div", { key: 'fc4fd3bddff308fc7529b5421fc6c795a5b5b745' }, "IsScaling: ", ((_k = this.store.state) === null || _k === void 0 ? void 0 : _k.isScaling) ? 'true' : 'false'), index.h("div", { key: '3144803bbb9666351335bbb0983a1ecd851042fa' }, "IsPanning: ", ((_l = this.store.state) === null || _l === void 0 ? void 0 : _l.isPanning) ? 'true' : 'false'), index.h("div", { key: '4318425d94911575400d87aea833735646c2c8b3' }, "IsFocused: ", this.store.state.isFocused ? 'true' : 'false'), index.h("div", { key: 'a70619abc78f3aa56b020a09d313d1b0433dac29' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), index.h("div", { key: 'dd1b606fc3dee2e7c043bce197bd65e84b70c215' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), index.h("div", { key: 'b616e4fa095b02371ce78ba6cb3ebfbc4666becc' }, "IsResizeHandleSelected: ", this.store.state.isResizeHandleSelected ? 'true' : 'false'), index.h("div", { key: 'a2abcdfa04001f41d6eb0317e38e76de86ff1f4d' }, "IsRotationHandleSelected: ", this.store.state.isRotationHandleSelected ? 'true' : 'false'), index.h("div", { key: 'c9c35825821e4848f0f0715fd659961d0eca7733' }, "IsDrawing: ", this.store.state.isDrawing ? 'true' : 'false'), index.h("div", { key: '36dcb2a9fb25c033344eefaf17124013db46ddfe' }, "IsWriting: ", this.store.state.isWriting ? 'true' : 'false'), index.h("div", { key: 'ecef1dd46e0d5d601fb8c7a9379d44b4bfcc1e82' }, "CursorX: ", (_m = this.store.state) === null || _m === void 0 ? void 0 :
5903
+ _m.cursorX), index.h("div", { key: 'ecd11b0ff8f390df327bdc2dea8bb7e435bf3a7f' }, "CursorY: ", (_o = this.store.state) === null || _o === void 0 ? void 0 :
5904
+ _o.cursorY)), index.h("div", { key: '6b3e872322979d3ceaae04dea12443cc4ba4ae33', class: "origin", style: {
5846
5905
  transform: `matrix(${(_p = this.store.state) === null || _p === void 0 ? void 0 : _p.scale}, 0, 0, ${(_q = this.store.state) === null || _q === void 0 ? void 0 : _q.scale}, ${(_r = this.store.state) === null || _r === void 0 ? void 0 : _r.translateX}, ${(_s = this.store.state) === null || _s === void 0 ? void 0 : _s.translateY})`,
5847
5906
  } }, (_t = this.store.objects) === null || _t === void 0 ? void 0 :
5848
5907
  _t.map(object => {
5849
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
5908
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
5850
5909
  return (index.h("svg", { xmlns: "http://www.w3.org/2000/svg", key: object.id, id: object.id, class: "object", style: {
5851
5910
  height: object === null || object === void 0 ? void 0 : object.totalHeight.toString(),
5852
5911
  width: object === null || object === void 0 ? void 0 : object.totalWidth.toString(),
@@ -5878,7 +5937,7 @@ const KritzelEngine = class {
5878
5937
  height: '100%',
5879
5938
  userSelect: 'none',
5880
5939
  pointerEvents: 'none',
5881
- }, draggable: false, onDragStart: e => e.preventDefault() })), object instanceof KritzelText && (index.h("textarea", { ref: el => object.mount(el), value: object.value, onInput: event => object.handleInput(event), rows: object.rows, style: {
5940
+ }, draggable: false, onDragStart: e => e.preventDefault() })), object instanceof KritzelText && (index.h("textarea", { ref: el => object.mount(el), value: object.value, onKeyDown: event => object.handleKeyDown(event), onInput: event => object.handleInput(event), rows: object.rows, style: {
5882
5941
  width: '100%',
5883
5942
  height: '100%',
5884
5943
  color: object.fontColor,
@@ -5888,8 +5947,8 @@ const KritzelEngine = class {
5888
5947
  outline: 'none',
5889
5948
  resize: 'none',
5890
5949
  overflow: 'hidden',
5891
- backgroundColor: 'var(--kritzel-engine-background-color)',
5892
5950
  display: 'block',
5951
+ padding: '1px',
5893
5952
  whiteSpace: 'nowrap',
5894
5953
  cursor: object.isReadonly ? 'default' : 'text',
5895
5954
  caretColor: object.isReadonly ? 'transparent' : 'auto',
@@ -5915,21 +5974,32 @@ const KritzelEngine = class {
5915
5974
  stroke: 'var(--kritzel-selection-border-color)',
5916
5975
  strokeWidth: `calc(var(--kritzel-selection-border-width, 1) * ${object.scale} / ${(_e = this.store.state) === null || _e === void 0 ? void 0 : _e.scale})`,
5917
5976
  strokeLinecap: 'square',
5918
- }, visibility: object.selected ? 'visible' : 'hidden' }), index.h("circle", { class: "selection-handle top-left", cx: "0", cy: "0", r: `${(baseHandleSize * object.scale) / ((_f = this.store.state) === null || _f === void 0 ? void 0 : _f.scale)}`, style: {
5977
+ }, 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: {
5919
5978
  fill: 'var(--kritzel-selection-handle-color)',
5920
- }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "selection-handle top-right", cx: object.totalWidth, cy: "0", r: `${(baseHandleSize * object.scale) / ((_g = this.store.state) === null || _g === void 0 ? void 0 : _g.scale)}`, style: {
5979
+ }, 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: {
5980
+ fill: 'transparent',
5981
+ }, 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: {
5921
5982
  fill: 'var(--kritzel-selection-handle-color)',
5922
- }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "selection-handle bottom-left", cx: "0", cy: object.totalHeight, r: `${(baseHandleSize * object.scale) / ((_h = this.store.state) === null || _h === void 0 ? void 0 : _h.scale)}`, style: {
5983
+ }, 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: {
5984
+ fill: 'transparent',
5985
+ }, 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: {
5923
5986
  fill: 'var(--kritzel-selection-handle-color)',
5924
- }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "selection-handle bottom-right", cx: object.totalWidth, cy: object.totalHeight, r: `${(baseHandleSize * object.scale) / ((_j = this.store.state) === null || _j === void 0 ? void 0 : _j.scale)}`, style: {
5987
+ }, 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: {
5988
+ fill: 'transparent',
5989
+ }, 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: {
5925
5990
  fill: 'var(--kritzel-selection-handle-color)',
5926
- }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("line", { x1: object.totalWidth / 2, y1: "0", x2: object.totalWidth / 2, y2: -((15 * object.scale) / ((_k = this.store.state) === null || _k === void 0 ? void 0 : _k.scale)), style: {
5991
+ }, 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: {
5992
+ fill: 'transparent',
5993
+ }, 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: {
5927
5994
  stroke: 'var(--kritzel-selection-border-color)',
5928
- strokeWidth: `calc(var(--kritzel-selection-border-width, 1) * ${object.scale} / ${(_l = this.store.state) === null || _l === void 0 ? void 0 : _l.scale})`,
5929
- }, visibility: object.selected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "rotation-handle", cx: object.totalWidth / 2, cy: -((15 * object.scale) / ((_m = this.store.state) === null || _m === void 0 ? void 0 : _m.scale)), r: `${(baseHandleSize * object.scale) / ((_o = this.store.state) === null || _o === void 0 ? void 0 : _o.scale)}`, style: {
5995
+ strokeWidth: `calc(var(--kritzel-selection-border-width, 1) * ${object.scale} / ${(_q = this.store.state) === null || _q === void 0 ? void 0 : _q.scale})`,
5996
+ }, 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: {
5930
5997
  fill: 'var(--kritzel-selection-handle-color)',
5998
+ }, 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: {
5999
+ fill: 'transparent',
6000
+ cursor: 'grab',
5931
6001
  }, 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))))));
5932
- }), index.h("svg", { key: 'cd9652cfc5b65d4b12adcf8d55fa148d9bbae0d3', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
6002
+ }), index.h("svg", { key: '0c747372fd0def96d89e38cd2a7b9c89573c24cb', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
5933
6003
  height: (_u = this.store.state.currentPath) === null || _u === void 0 ? void 0 : _u.height.toString(),
5934
6004
  width: (_v = this.store.state.currentPath) === null || _v === void 0 ? void 0 : _v.width.toString(),
5935
6005
  left: '0',
@@ -5938,12 +6008,12 @@ const KritzelEngine = class {
5938
6008
  position: 'absolute',
5939
6009
  transform: (_x = this.store.state.currentPath) === null || _x === void 0 ? void 0 : _x.transformationMatrix,
5940
6010
  overflow: 'visible',
5941
- }, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, index.h("path", { key: '9577626d34bf092a8c6ef72ca8dacbe8923f65b4', 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: 'f31f38f4efd7a71ecf0bb83a800c5864632cc12c', ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, style: {
6011
+ }, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, index.h("path", { key: 'b4cef8aa97ec68c3cdbe0a241d9dbaf386fa4230', 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: '0abe98e7623008c4b7900e0f4c407e6828f2b438', ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, style: {
5942
6012
  position: 'fixed',
5943
6013
  left: `${this.store.state.contextMenuX}px`,
5944
6014
  top: `${this.store.state.contextMenuY}px`,
5945
6015
  zIndex: '10000',
5946
- }, 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: '3619d7b541443313743661171931a8f202327db3' })));
6016
+ }, 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: 'bc13f6965a71a03dec9c8297f64cdcbd923fe53d' })));
5947
6017
  }
5948
6018
  get host() { return index.getElement(this); }
5949
6019
  };