kritzel-stencil 0.0.149 → 0.0.150

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.
@@ -1,4 +1,4 @@
1
- import { P as KritzelEngine$1, N as defineCustomElement$1 } from './p-CE48HcKx.js';
1
+ import { P as KritzelEngine$1, N as defineCustomElement$1 } from './p-D6oQxYXs.js';
2
2
 
3
3
  const KritzelEngine = KritzelEngine$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -34909,27 +34909,21 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
34909
34909
  this.viewport.handlePointerDown(ev);
34910
34910
  this.core.store.state?.activeTool?.handlePointerDown(ev);
34911
34911
  }
34912
+ throttledPointerMoveMulti = lodashExports.throttle((ev) => {
34913
+ this.viewport.handlePointerMove(ev);
34914
+ this.core.store.state?.activeTool?.handlePointerMove(ev);
34915
+ }, 16);
34912
34916
  handlePointerMove(ev) {
34913
34917
  if (this.core.store.isDisabled) {
34914
34918
  return;
34915
34919
  }
34916
34920
  this.core.store.state.pointers.set(ev.pointerId, ev);
34917
- // Use different throttle functions based on pointer count
34918
34921
  if (this.core.store.state.pointers.size > 1) {
34919
34922
  this.throttledPointerMoveMulti(ev);
34920
34923
  }
34921
- else {
34922
- this.throttledPointerMoveSingle(ev);
34923
- }
34924
- }
34925
- throttledPointerMoveSingle = lodashExports.throttle((ev) => {
34926
34924
  this.viewport.handlePointerMove(ev);
34927
34925
  this.core.store.state?.activeTool?.handlePointerMove(ev);
34928
- }, 0);
34929
- throttledPointerMoveMulti = lodashExports.throttle((ev) => {
34930
- this.viewport.handlePointerMove(ev);
34931
- this.core.store.state?.activeTool?.handlePointerMove(ev);
34932
- }, 100);
34926
+ }
34933
34927
  handlePointerUp(ev) {
34934
34928
  if (this.core.store.isDisabled) {
34935
34929
  return;
@@ -35138,7 +35132,6 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
35138
35132
  this.core = new KritzelCore(this);
35139
35133
  }
35140
35134
  disconnectedCallback() {
35141
- this.throttledPointerMoveSingle.cancel();
35142
35135
  this.throttledPointerMoveMulti.cancel();
35143
35136
  }
35144
35137
  componentWillLoad() {
@@ -35191,9 +35184,8 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
35191
35184
  const baseHandleTouchSize = baseHandleSize * 2 < 14 ? 14 : baseHandleSize;
35192
35185
  const viewportCenterX = this.core.store.state.viewportWidth / 2 + this.core.store.state.translateX;
35193
35186
  const viewportCenterY = this.core.store.state.viewportHeight / 2 + this.core.store.state.translateY;
35194
- return (h(Host, { key: '17bf6a3ff6eb5b5d94d786267d3bdff8805cb533' }, h("div", { key: 'f188bf94dcd66074b9e1f71b2c683955f020cb49', class: "debug-panel", style: { display: this.core.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, h("div", { key: 'fbb921e10faf42b323decc4871537191c145fc14' }, "ActiveWorkspaceId: ", this.core.store.state?.activeWorkspace?.id), h("div", { key: '826207310bbdc2f5e28de541de79016df759aebb' }, "ActiveWorkspaceName: ", this.core.store.state?.activeWorkspace?.name), h("div", { key: '42dbb74aa75858a540acabd868a6a16428857028' }, "TranslateX: ", this.core.store.state?.translateX), h("div", { key: 'b3e88f31170b9ac6e107cf96e31173e6e8e193a9' }, "TranslateY: ", this.core.store.state?.translateY), h("div", { key: 'b8f9ac44d9488ab10d7118ec676c6897e08f3cd6' }, "ViewportWidth: ", this.core.store.state?.viewportWidth), h("div", { key: '1a4b6c1ded1d6cda9e2a1777dc3aafeb58f00c46' }, "ViewportHeight: ", this.core.store.state?.viewportHeight), h("div", { key: '993d90e986fe0b5c60dfa15f952e5f752526518c' }, "PointerCount: ", this.core.store.state.pointers.size), h("div", { key: '32ba561e1129ea5550f03daa81cb5ba5bedbea53' }, "Scale: ", this.core.store.state?.scale), h("div", { key: 'de89601fd42ae57349eae765242ebf9151d9b561' }, "ActiveTool: ", this.core.store.state?.activeTool?.name), h("div", { key: 'e661fd788007ef0e0ac68d9950d8a65c54288bc4' }, "HasViewportChanged: ", this.core.store.state?.hasViewportChanged ? 'true' : 'false'), h("div", { key: 'f3c00e656c78ad4e12ebe7dd201f53237687dda0' }, "IsEnabled: ", this.core.store.state?.isEnabled ? 'true' : 'false'), h("div", { key: '00e6183e59a302678ea48b3738e32607f34b06bb' }, "IsScaling: ", this.core.store.state?.isScaling ? 'true' : 'false'), h("div", { key: 'c9cc3a645e47e78e79f28704a3a7a1338c3b14dc' }, "IsPanning: ", this.core.store.state?.isPanning ? 'true' : 'false'), h("div", { key: '4b1a5e76f1bfd1b8f6de5bab444622d5a937caf5' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), h("div", { key: '326852e22e526f67b75da99947427a50ff9b1b3c' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), h("div", { key: 'ca2b54a494f27aff9b9cfa7a09a24c8220412937' }, "IsResizeHandleSelected: ", this.core.store.state.isResizeHandleSelected ? 'true' : 'false'), h("div", { key: '7ede9aee3c18143ac66823b78157e4ed35813c6c' }, "IsRotationHandleSelected: ", this.core.store.state.isRotationHandleSelected ? 'true' : 'false'), h("div", { key: 'fdf9863a45c4861bbd1a45817d029cc7be57e305' }, "IsDrawing: ", this.core.store.state.isDrawing ? 'true' : 'false'), h("div", { key: 'b8352a9390586a99adbdfeaead3a53c2f2adcccb' }, "IsWriting: ", this.core.store.state.isWriting ? 'true' : 'false'), h("div", { key: '8685bfb218fc405abd1e4e060958f05ee5604f5a' }, "PointerX: ", this.core.store.state?.pointerX), h("div", { key: 'bc35c91f407a5d5c06216a6b549bf1870a10b9f8' }, "PointerY: ", this.core.store.state?.pointerY), h("div", { key: '49ca83379e9cd80be9afe8e51ece26bd860e8b2c' }, "SelectedObjects: ", this.core.store.selectionGroup?.objects.length || 0), h("div", { key: '61923c56ee0bbde62ecaf15844465fa2552b2e3a' }, "ViewportCenter: (", viewportCenterX.toFixed(2), ", ", viewportCenterY.toFixed(2), ")")), h("div", { key: '01fad2fea8986db5b423b9ad50fdc729b93f5564', id: "origin", class: "origin", style: {
35187
+ return (h(Host, { key: '3e05ce246b599985a06e54e0d81a63b4765ff506' }, h("div", { key: '6169eb0566bb2965c7d1569492a62a1ef1d4b7ef', class: "debug-panel", style: { display: this.core.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, h("div", { key: '598db5c39099553997248086e392c168c583aca9' }, "ActiveWorkspaceId: ", this.core.store.state?.activeWorkspace?.id), h("div", { key: '6d5de3390f2e32dbaa7fe52521b8fd9c0e8706de' }, "ActiveWorkspaceName: ", this.core.store.state?.activeWorkspace?.name), h("div", { key: '6006c27d020aeea24170a09140e3bc5c2ea459cf' }, "TranslateX: ", this.core.store.state?.translateX), h("div", { key: 'edfa3cb59d47df747dc9f003ce08345348ba586d' }, "TranslateY: ", this.core.store.state?.translateY), h("div", { key: '799f714d6e4b129f59be7cbc52f657e9b21f9879' }, "ViewportWidth: ", this.core.store.state?.viewportWidth), h("div", { key: '4a8f545cf72fe496abf18a4907743ac6b46ef889' }, "ViewportHeight: ", this.core.store.state?.viewportHeight), h("div", { key: '8e665e3c23424cb4e76b2d4354bb4472a5b3ddbe' }, "PointerCount: ", this.core.store.state.pointers.size), h("div", { key: 'c168b114e204b90dafaf8736a571171a748047c1' }, "Scale: ", this.core.store.state?.scale), h("div", { key: 'bee83601a571727a06235c674e7300cdc398dfac' }, "ActiveTool: ", this.core.store.state?.activeTool?.name), h("div", { key: '0a2f5f36143c587ddc9b3ae487ce32196cd17232' }, "HasViewportChanged: ", this.core.store.state?.hasViewportChanged ? 'true' : 'false'), h("div", { key: '515959ec3700ecdc9dd3ca9183bfacd854d173d2' }, "IsEnabled: ", this.core.store.state?.isEnabled ? 'true' : 'false'), h("div", { key: '5a9ca8f3ba91f10e9d6bec07c6005c1e43713d69' }, "IsScaling: ", this.core.store.state?.isScaling ? 'true' : 'false'), h("div", { key: 'f5d1a5d59828be47be31e794b3b41c1e14c50780' }, "IsPanning: ", this.core.store.state?.isPanning ? 'true' : 'false'), h("div", { key: '1db8cdad160c131542fd787d104b4b979415ec4c' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), h("div", { key: 'baae83187cfb4c21ea07c7834017df92a7340d5b' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), h("div", { key: '6b248cb6fad7fb4dd5162fb2529dfec821a708fc' }, "IsResizeHandleSelected: ", this.core.store.state.isResizeHandleSelected ? 'true' : 'false'), h("div", { key: '0eae863f48c27867d0fa0f8c767b50c13be48271' }, "IsRotationHandleSelected: ", this.core.store.state.isRotationHandleSelected ? 'true' : 'false'), h("div", { key: 'a4ca58af5858725d4f1d0e00547e6e42365cb8fe' }, "IsDrawing: ", this.core.store.state.isDrawing ? 'true' : 'false'), h("div", { key: '8f978714060623d3daa9454e04ef929b1f02b143' }, "IsWriting: ", this.core.store.state.isWriting ? 'true' : 'false'), h("div", { key: '9b274d7785a9e4a36128c273bcee6b692d815a86' }, "PointerX: ", this.core.store.state?.pointerX), h("div", { key: '0c248bc24c164c4c52fb06b17347f107e3f0995f' }, "PointerY: ", this.core.store.state?.pointerY), h("div", { key: '21f3664f0978f308d88a976c47b875dd5bb08b95' }, "SelectedObjects: ", this.core.store.selectionGroup?.objects.length || 0), h("div", { key: 'e1161aa45ea02de914e01a93ec159447b5e17e8b' }, "ViewportCenter: (", viewportCenterX.toFixed(2), ", ", viewportCenterY.toFixed(2), ")")), h("div", { key: '87249fcc3f23632739631b8fdbc64371694d6206', id: "origin", class: "origin", style: {
35195
35188
  transform: `matrix(${this.core.store.state?.scale}, 0, 0, ${this.core.store.state?.scale}, ${this.core.store.state?.translateX}, ${this.core.store.state?.translateY})`,
35196
- willChange: 'transform',
35197
35189
  } }, this.core.store.state.objectsMap.allObjects()?.map(object => {
35198
35190
  return (h("div", { key: object.id, style: {
35199
35191
  display: object.isInViewport() ? 'block' : 'none',
@@ -35202,7 +35194,6 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
35202
35194
  zIndex: object.zIndex.toString(),
35203
35195
  position: 'absolute',
35204
35196
  pointerEvents: this.core.store.state.isScaling ? 'none' : 'auto',
35205
- willChange: this.core.store.state.isScaling ? 'transform' : 'auto',
35206
35197
  } }, h("svg", { xmlns: "http://www.w3.org/2000/svg", id: object.id, class: "object", style: {
35207
35198
  height: object?.totalHeight.toString(),
35208
35199
  width: object?.totalWidth.toString(),
@@ -35227,11 +35218,12 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
35227
35218
  width: object?.width.toString(),
35228
35219
  position: 'absolute',
35229
35220
  overflow: 'visible',
35230
- }, viewBox: object?.viewBox }, h("path", { d: object?.d, fill: object.fill, stroke: object?.stroke }))), KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && (h("img", { ref: el => object.mount(el), src: object.src, style: {
35221
+ }, viewBox: object?.viewBox }, h("path", { d: object?.d, fill: object.fill, stroke: object?.stroke, "shape-rendering": this.core.store.state.isScaling ? 'optimizeSpeed' : 'auto' }))), KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && (h("img", { ref: el => object.mount(el), src: object.src, style: {
35231
35222
  width: '100%',
35232
35223
  height: '100%',
35233
35224
  userSelect: 'none',
35234
35225
  pointerEvents: 'none',
35226
+ imageRendering: this.core.store.state.isScaling ? 'pixelated' : 'auto',
35235
35227
  }, draggable: false, onDragStart: e => e.preventDefault() })), KritzelClassHelper.isInstanceOf(object, 'KritzelText') && (h("div", { ref: el => object.mount(el), onPointerDown: e => object.handlePointerDown(e), onPointerMove: e => object.handlePointerMove(e), onPointerUp: e => object.handlePointerUp(e), style: {
35236
35228
  minWidth: object.initialWidth + 'px',
35237
35229
  minHeight: object.initialHeight + 'px',
@@ -35242,6 +35234,7 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
35242
35234
  transform: `scale(${object.scaleFactor})`,
35243
35235
  backgroundColor: object.backgroundColor,
35244
35236
  overflow: 'visible',
35237
+ textRendering: this.core.store.state.isScaling ? 'optimizeSpeed' : 'auto',
35245
35238
  } })), KritzelClassHelper.isInstanceOf(object, 'KritzelCustomElement') && (h("div", { ref: el => object.mount(el), style: {
35246
35239
  width: '100%',
35247
35240
  height: '100%',
@@ -35299,7 +35292,7 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
35299
35292
  fill: 'transparent',
35300
35293
  cursor: 'grab',
35301
35294
  }, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), h("g", { style: { display: this.core.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.isDebugInfoVisible ? 'block' : 'none' } }, h("div", { style: { width: '100%', height: '100%' } }, h("div", { style: { whitespace: 'nowrap' } }, "Id: ", object.id), h("div", { style: { whiteSpace: 'nowrap' } }, "width: ", object.width), h("div", { style: { whiteSpace: 'nowrap' } }, "height: ", object.height), h("div", { style: { whiteSpace: 'nowrap' } }, "translateX: ", object.translateX), h("div", { style: { whiteSpace: 'nowrap' } }, "translateY: ", object.translateY)))))));
35302
- })), this.core.store.state.isContextMenuVisible && (h("kritzel-context-menu", { key: '9a4985baa6f90aeeeca3a32958f79ebee9645c6d', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.core.store.state.contextMenuItems, objects: this.core.store.selectionGroup?.objects || [], style: {
35295
+ })), this.core.store.state.isContextMenuVisible && (h("kritzel-context-menu", { key: 'e99d647c9be209966a4e302773eef855667800e2', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.core.store.state.contextMenuItems, objects: this.core.store.selectionGroup?.objects || [], style: {
35303
35296
  position: 'fixed',
35304
35297
  left: `${this.core.store.state.contextMenuX}px`,
35305
35298
  top: `${this.core.store.state.contextMenuY}px`,
@@ -35310,7 +35303,7 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
35310
35303
  y: (-this.core.store.state.translateY + this.core.store.state.contextMenuY) / this.core.store.state.scale,
35311
35304
  }, this.core.store.selectionGroup?.objects);
35312
35305
  this.hideContextMenu();
35313
- }, onClose: () => this.hideContextMenu() })), this.core.store.state?.activeTool instanceof KritzelEraserTool && !this.core.store.state.isScaling && h("kritzel-cursor-trail", { key: '5793c405666b73a93ba473edf9477653683ef786', core: this.core })));
35306
+ }, onClose: () => this.hideContextMenu() })), this.core.store.state?.activeTool instanceof KritzelEraserTool && !this.core.store.state.isScaling && h("kritzel-cursor-trail", { key: 'a7301f377705b93d2dd1b0f0e8da2bc40522b0a3', core: this.core })));
35314
35307
  }
35315
35308
  static get watchers() { return {
35316
35309
  "workspace": ["onWorkspaceChange"],
@@ -35391,6 +35384,6 @@ function defineCustomElement() {
35391
35384
  }
35392
35385
 
35393
35386
  export { isNode as A, min$2 as B, pow as C, HocuspocusProviderWebsocket as D, KritzelEraserTool as E, KritzelImageTool as F, KritzelSelectionTool as G, HocuspocusProvider as H, IndexedDBSyncProvider as I, KritzelAppStateMap as J, KritzelImage as K, ABSOLUTE_SCALE_MAX as L, ABSOLUTE_SCALE_MIN as M, defineCustomElement as N, Observable$1 as O, KritzelEngine as P, writeVarUint8Array$2 as a, readVarUint8Array$2 as b, applyUpdate as c, encodeStateVector as d, encodeStateAsUpdate as e, createEncoder$1 as f, createDecoder$1 as g, create$8 as h, fromBase64 as i, toBase64 as j, createUint8ArrayFromArrayBuffer as k, offChange as l, readVarString$2 as m, floor$2 as n, onChange as o, getUnixTime$1 as p, equalityDeep$1 as q, readVarUint$2 as r, setIfUndefined$1 as s, toUint8Array$1 as t, writeVarString$2 as u, varStorage as v, writeVarUint$2 as w, map as x, ObservableV2 as y, length$3 as z };
35394
- //# sourceMappingURL=p-CE48HcKx.js.map
35387
+ //# sourceMappingURL=p-D6oQxYXs.js.map
35395
35388
 
35396
- //# sourceMappingURL=p-CE48HcKx.js.map
35389
+ //# sourceMappingURL=p-D6oQxYXs.js.map