kritzel-stencil 0.0.160 → 0.0.161
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.
- package/dist/cjs/{default-text-tool.config-D10FksvZ.js → default-text-tool.config-zB3FPuXq.js} +167 -44
- package/dist/cjs/default-text-tool.config-zB3FPuXq.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/kritzel-brush-style.cjs.entry.js +1 -1
- package/dist/cjs/kritzel-brush-style.entry.cjs.js.map +1 -1
- package/dist/cjs/kritzel-color_22.cjs.entry.js +108 -101
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stencil.cjs.js +1 -1
- package/dist/collection/classes/core/store.class.js +3 -0
- package/dist/collection/classes/core/store.class.js.map +1 -1
- package/dist/collection/classes/handlers/resize.handler.js +42 -34
- package/dist/collection/classes/handlers/resize.handler.js.map +1 -1
- package/dist/collection/classes/handlers/rotation.handler.js +12 -8
- package/dist/collection/classes/handlers/rotation.handler.js.map +1 -1
- package/dist/collection/classes/registries/icon-registry.class.js +6 -1
- package/dist/collection/classes/registries/icon-registry.class.js.map +1 -1
- package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js +1 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +1 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.css +0 -14
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +80 -10
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
- package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.css +0 -1
- package/dist/collection/components/shared/kritzel-color/kritzel-color.js +2 -2
- package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.css +1 -1
- package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js +1 -1
- package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.css +1 -1
- package/dist/collection/components/shared/kritzel-font/kritzel-font.js +1 -1
- package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.css +1 -1
- package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js +1 -1
- package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.css +1 -1
- package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js +1 -1
- package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js +1 -1
- package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.css +1 -2
- package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js +2 -2
- package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js +1 -1
- package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.css +1 -1
- package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js +1 -1
- package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.css +1 -1
- package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +1 -1
- package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js +4 -4
- package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.css +1 -2
- package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js +1 -1
- package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.css +1 -1
- package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js +2 -2
- package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.css +1 -1
- package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.js +2 -2
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.css +4 -4
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +3 -3
- package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.css +1 -1
- package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +1 -1
- package/dist/collection/configs/default-engine-config.js +6 -0
- package/dist/collection/configs/default-engine-config.js.map +1 -1
- package/dist/collection/helpers/cursor.helper.js +58 -0
- package/dist/collection/helpers/cursor.helper.js.map +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/interfaces/engine-state.interface.js.map +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/kritzel-brush-style.js +3 -3
- package/dist/components/kritzel-brush-style.js.map +1 -1
- package/dist/components/kritzel-color-palette.js +1 -1
- package/dist/components/kritzel-color.js +1 -1
- package/dist/components/kritzel-context-menu.js +1 -1
- package/dist/components/kritzel-control-brush-config.js +1 -1
- package/dist/components/kritzel-control-text-config.js +1 -1
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-cursor-trail.js +1 -1
- package/dist/components/kritzel-dropdown.js +1 -1
- package/dist/components/kritzel-editor.js +21 -21
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/kritzel-font-family.js +1 -1
- package/dist/components/kritzel-font-size.js +1 -1
- package/dist/components/kritzel-font.js +1 -1
- package/dist/components/kritzel-icon.js +1 -1
- package/dist/components/kritzel-menu-item.js +1 -1
- package/dist/components/kritzel-menu.js +1 -1
- package/dist/components/kritzel-portal.js +1 -1
- package/dist/components/kritzel-split-button.js +1 -1
- package/dist/components/kritzel-stroke-size.js +1 -1
- package/dist/components/kritzel-tooltip.js +1 -1
- package/dist/components/kritzel-utility-panel.js +1 -1
- package/dist/components/kritzel-workspace-manager.js +1 -1
- package/dist/components/{p-CK6no3mi.js → p-58y59Acb.js} +6 -6
- package/dist/components/{p-CK6no3mi.js.map → p-58y59Acb.js.map} +1 -1
- package/dist/components/{p-CTP479Lf.js → p-9Fzdviju.js} +6 -6
- package/dist/components/{p-CTP479Lf.js.map → p-9Fzdviju.js.map} +1 -1
- package/dist/components/{p-DDmSxM5f.js → p-B6r22FSC.js} +5 -5
- package/dist/components/p-B6r22FSC.js.map +1 -0
- package/dist/components/{p-CLt3HMl6.js → p-B_3OZeom.js} +3 -3
- package/dist/components/{p-CLt3HMl6.js.map → p-B_3OZeom.js.map} +1 -1
- package/dist/components/{p-TdCTkEu0.js → p-BdZKPKnx.js} +7 -7
- package/dist/components/p-BdZKPKnx.js.map +1 -0
- package/dist/components/{p-CIXPLjCu.js → p-BdwB-S9G.js} +3 -3
- package/dist/components/p-BdwB-S9G.js.map +1 -0
- package/dist/components/{p-1lIHoOlH.js → p-BpXgwgnV.js} +18 -18
- package/dist/components/p-BpXgwgnV.js.map +1 -0
- package/dist/components/{p-D1uj4A4F.js → p-Brd9SxWS.js} +5 -5
- package/dist/components/p-Brd9SxWS.js.map +1 -0
- package/dist/components/{p-CsA9M6me.js → p-CC8KFHSe.js} +8 -8
- package/dist/components/p-CC8KFHSe.js.map +1 -0
- package/dist/components/{p-BgznZoBH.js → p-CFH6XRL5.js} +5 -5
- package/dist/components/p-CFH6XRL5.js.map +1 -0
- package/dist/components/{p-B4kxkVe-.js → p-CRGwaUcp.js} +5 -5
- package/dist/components/p-CRGwaUcp.js.map +1 -0
- package/dist/components/{p-uuRJU2R1.js → p-Ck4lGnmt.js} +3 -3
- package/dist/components/{p-uuRJU2R1.js.map → p-Ck4lGnmt.js.map} +1 -1
- package/dist/components/{p-DTHqEUDc.js → p-D7BLVRXX.js} +186 -61
- package/dist/components/p-D7BLVRXX.js.map +1 -0
- package/dist/components/{p-C2sWlNsJ.js → p-D_ygcWSz.js} +5 -5
- package/dist/components/p-D_ygcWSz.js.map +1 -0
- package/dist/components/p-DbKKCHKd.js +103 -0
- package/dist/components/p-DbKKCHKd.js.map +1 -0
- package/dist/components/{p-Ddh40W3x.js → p-Doixm8-N.js} +9 -9
- package/dist/components/p-Doixm8-N.js.map +1 -0
- package/dist/components/{p-BQg4YML7.js → p-DxNbcUzt.js} +12 -12
- package/dist/components/p-DxNbcUzt.js.map +1 -0
- package/dist/components/{p-D4yvhd1d.js → p-LAsVgL2e.js} +4 -4
- package/dist/components/{p-D4yvhd1d.js.map → p-LAsVgL2e.js.map} +1 -1
- package/dist/components/{p-D5Wq4x4r.js → p-OFrACpZf.js} +3 -3
- package/dist/components/{p-D5Wq4x4r.js.map → p-OFrACpZf.js.map} +1 -1
- package/dist/components/{p-DAfkuR8U.js → p-i0IlGLv2.js} +5 -5
- package/dist/components/p-i0IlGLv2.js.map +1 -0
- package/dist/esm/{default-text-tool.config-DzqpOikl.js → default-text-tool.config-BvCgOiKA.js} +166 -45
- package/dist/esm/default-text-tool.config-BvCgOiKA.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/kritzel-brush-style.entry.js +1 -1
- package/dist/esm/kritzel-brush-style.entry.js.map +1 -1
- package/dist/esm/kritzel-color_22.entry.js +106 -99
- package/dist/esm/loader.js +1 -1
- package/dist/esm/stencil.js +1 -1
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/kritzel-brush-style.entry.esm.js.map +1 -1
- package/dist/stencil/p-385bab97.entry.js +2 -0
- package/dist/stencil/{p-d702c5af.entry.js.map → p-385bab97.entry.js.map} +1 -1
- package/dist/stencil/p-6d9756d9.entry.js +10 -0
- package/dist/stencil/p-6d9756d9.entry.js.map +1 -0
- package/dist/stencil/{p-DzqpOikl.js → p-BvCgOiKA.js} +2 -2
- package/dist/stencil/p-BvCgOiKA.js.map +1 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/core/store.class.d.ts +1 -0
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +4 -0
- package/dist/types/components.d.ts +2 -0
- package/dist/types/helpers/cursor.helper.d.ts +22 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/interfaces/engine-state.interface.d.ts +7 -0
- package/package.json +1 -1
- package/dist/cjs/default-text-tool.config-D10FksvZ.js.map +0 -1
- package/dist/components/p-1lIHoOlH.js.map +0 -1
- package/dist/components/p-B4kxkVe-.js.map +0 -1
- package/dist/components/p-BQg4YML7.js.map +0 -1
- package/dist/components/p-BgznZoBH.js.map +0 -1
- package/dist/components/p-Bhtn9qay.js +0 -98
- package/dist/components/p-Bhtn9qay.js.map +0 -1
- package/dist/components/p-C2sWlNsJ.js.map +0 -1
- package/dist/components/p-CIXPLjCu.js.map +0 -1
- package/dist/components/p-CsA9M6me.js.map +0 -1
- package/dist/components/p-D1uj4A4F.js.map +0 -1
- package/dist/components/p-DAfkuR8U.js.map +0 -1
- package/dist/components/p-DDmSxM5f.js.map +0 -1
- package/dist/components/p-DTHqEUDc.js.map +0 -1
- package/dist/components/p-Ddh40W3x.js.map +0 -1
- package/dist/components/p-TdCTkEu0.js.map +0 -1
- package/dist/esm/default-text-tool.config-DzqpOikl.js.map +0 -1
- package/dist/stencil/p-5475442e.entry.js +0 -10
- package/dist/stencil/p-5475442e.entry.js.map +0 -1
- package/dist/stencil/p-DzqpOikl.js.map +0 -1
- package/dist/stencil/p-d702c5af.entry.js +0 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-CwkUrTy1.js';
|
|
2
2
|
import { K as KritzelMouseButton } from './p-D8W6LE-c.js';
|
|
3
3
|
import { e as KritzelBaseObject, f as KritzelBaseTool, g as KritzelEventHelper, h as KritzelToolRegistry, c as KritzelTextTool, b as KritzelBrushTool, K as KritzelText, a as KritzelPath, d as KritzelKeyboardHelper } from './p-CBYBurdY.js';
|
|
4
|
-
import { K as KritzelContextMenu, d as defineCustomElement$3 } from './p-
|
|
4
|
+
import { K as KritzelContextMenu, d as defineCustomElement$3 } from './p-D_ygcWSz.js';
|
|
5
5
|
import { O as ObjectHelper } from './p-B0kd2rUI.js';
|
|
6
|
+
import { K as KritzelIconRegistry, d as defineCustomElement$1 } from './p-DbKKCHKd.js';
|
|
6
7
|
import { K as KritzelWorkspace } from './p-n789Y3S-.js';
|
|
7
8
|
import { K as KritzelDevicesHelper } from './p-l10It7Nm.js';
|
|
8
|
-
import { d as defineCustomElement$2 } from './p-
|
|
9
|
-
import { d as defineCustomElement$1 } from './p-Bhtn9qay.js';
|
|
9
|
+
import { d as defineCustomElement$2 } from './p-B_3OZeom.js';
|
|
10
10
|
|
|
11
11
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
12
12
|
|
|
@@ -236,6 +236,63 @@ class KritzelImageTool extends KritzelBaseTool {
|
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
class KritzelCursorHelper {
|
|
240
|
+
static _pointerCursor = null;
|
|
241
|
+
/**
|
|
242
|
+
* Returns the custom pointer cursor CSS value.
|
|
243
|
+
* This can be used instead of `cursor: pointer` for consistent styling.
|
|
244
|
+
*/
|
|
245
|
+
static getPointerCursor() {
|
|
246
|
+
if (!this._pointerCursor) {
|
|
247
|
+
this._pointerCursor = this.getCursor({ iconName: 'pointer' });
|
|
248
|
+
}
|
|
249
|
+
return this._pointerCursor;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Returns a custom cursor CSS value with support for rotation.
|
|
253
|
+
* The icon is retrieved from the KritzelIconRegistry.
|
|
254
|
+
*/
|
|
255
|
+
static getCursor(options) {
|
|
256
|
+
const iconName = options.iconName === 'default' ? 'mouse-pointer' : options.iconName;
|
|
257
|
+
const iconSvg = KritzelIconRegistry.get(iconName);
|
|
258
|
+
if (!iconSvg) {
|
|
259
|
+
console.warn(`Icon "${iconName}" not found in registry.`);
|
|
260
|
+
return 'auto';
|
|
261
|
+
}
|
|
262
|
+
const size = options.size || 24;
|
|
263
|
+
const rotation = options.rotation || 0;
|
|
264
|
+
const color = options.color || 'black';
|
|
265
|
+
// Default cursor (mouse-pointer) has hotspot at (4, 4), others at center
|
|
266
|
+
const hotspot = options.hotspot || (options.iconName === 'default' ? { x: 4, y: 4 } : { x: size / 2, y: size / 2 });
|
|
267
|
+
// Modify the SVG string to set size and color
|
|
268
|
+
// We replace width and height to match the requested size
|
|
269
|
+
// We replace currentColor with the requested color
|
|
270
|
+
let content = iconSvg
|
|
271
|
+
.replace(/width="\d+"/, `width="${size}"`)
|
|
272
|
+
.replace(/height="\d+"/, `height="${size}"`)
|
|
273
|
+
.replace(/currentColor/g, color);
|
|
274
|
+
// Create the SVG string
|
|
275
|
+
// We rotate around the center of the SVG canvas
|
|
276
|
+
const center = size / 2;
|
|
277
|
+
// We use a group to apply the rotation
|
|
278
|
+
const svg = `
|
|
279
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
|
|
280
|
+
<g transform="rotate(${rotation} ${center} ${center})">
|
|
281
|
+
${content}
|
|
282
|
+
</g>
|
|
283
|
+
</svg>
|
|
284
|
+
`;
|
|
285
|
+
// Encode the SVG for use in a data URI
|
|
286
|
+
// We need to be careful with encoding to ensure it works across browsers
|
|
287
|
+
const encodedSvg = encodeURIComponent(svg.replace(/\s+/g, ' ').trim())
|
|
288
|
+
.replace(/'/g, '%27')
|
|
289
|
+
.replace(/"/g, '%22');
|
|
290
|
+
const dataUri = `data:image/svg+xml;charset=utf-8,${encodedSvg}`;
|
|
291
|
+
// Return the cursor style string
|
|
292
|
+
return `url('${dataUri}') ${hotspot.x} ${hotspot.y}, auto`;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
239
296
|
class KritzelBaseHandler {
|
|
240
297
|
_core;
|
|
241
298
|
constructor(core) {
|
|
@@ -474,39 +531,40 @@ class KritzelResizeHandler extends KritzelBaseHandler {
|
|
|
474
531
|
const rotation = selectionGroup.rotation;
|
|
475
532
|
const sin = Math.sin(rotation);
|
|
476
533
|
const cos = Math.cos(rotation);
|
|
477
|
-
const
|
|
534
|
+
const objectScale = selectionGroup.scale || 1;
|
|
535
|
+
const currentScale = this._core.store.state.scale;
|
|
478
536
|
// Calculate delta in local unrotated space
|
|
479
537
|
// We rotate the screen delta by -rotation to align with the object's axes
|
|
480
|
-
const localDx = dx * cos + dy * sin;
|
|
481
|
-
const localDy = -dx * sin + dy * cos;
|
|
538
|
+
const localDx = (dx * cos + dy * sin) / currentScale;
|
|
539
|
+
const localDy = (-dx * sin + dy * cos) / currentScale;
|
|
482
540
|
// Calculate the center of the selection group before resize
|
|
483
|
-
const initialCenterX = this.initialSize.x + this.initialSize.width /
|
|
484
|
-
const initialCenterY = this.initialSize.y + this.initialSize.height /
|
|
541
|
+
const initialCenterX = this.initialSize.x + this.initialSize.width / objectScale / 2;
|
|
542
|
+
const initialCenterY = this.initialSize.y + this.initialSize.height / objectScale / 2;
|
|
485
543
|
// The center moves by half of the screen delta (scaled)
|
|
486
544
|
// This is true regardless of rotation because the resize happens symmetrically around the center
|
|
487
545
|
// relative to the fixed point logic
|
|
488
|
-
const newCenterX = initialCenterX + dx /
|
|
489
|
-
const newCenterY = initialCenterY + dy /
|
|
546
|
+
const newCenterX = initialCenterX + dx / currentScale / 2;
|
|
547
|
+
const newCenterY = initialCenterY + dy / currentScale / 2;
|
|
490
548
|
switch (this._core.store.state.resizeHandleType) {
|
|
491
549
|
case KritzelHandleType.TopLeft:
|
|
492
|
-
this.newSize.width = this.initialSize.width - localDx;
|
|
493
|
-
this.newSize.height = this.initialSize.height - localDy;
|
|
550
|
+
this.newSize.width = this.initialSize.width - localDx * objectScale;
|
|
551
|
+
this.newSize.height = this.initialSize.height - localDy * objectScale;
|
|
494
552
|
break;
|
|
495
553
|
case KritzelHandleType.TopRight:
|
|
496
|
-
this.newSize.width = this.initialSize.width + localDx;
|
|
497
|
-
this.newSize.height = this.initialSize.height - localDy;
|
|
554
|
+
this.newSize.width = this.initialSize.width + localDx * objectScale;
|
|
555
|
+
this.newSize.height = this.initialSize.height - localDy * objectScale;
|
|
498
556
|
break;
|
|
499
557
|
case KritzelHandleType.BottomLeft:
|
|
500
|
-
this.newSize.width = this.initialSize.width - localDx;
|
|
501
|
-
this.newSize.height = this.initialSize.height + localDy;
|
|
558
|
+
this.newSize.width = this.initialSize.width - localDx * objectScale;
|
|
559
|
+
this.newSize.height = this.initialSize.height + localDy * objectScale;
|
|
502
560
|
break;
|
|
503
561
|
case KritzelHandleType.BottomRight:
|
|
504
|
-
this.newSize.width = this.initialSize.width + localDx;
|
|
505
|
-
this.newSize.height = this.initialSize.height + localDy;
|
|
562
|
+
this.newSize.width = this.initialSize.width + localDx * objectScale;
|
|
563
|
+
this.newSize.height = this.initialSize.height + localDy * objectScale;
|
|
506
564
|
break;
|
|
507
565
|
}
|
|
508
|
-
this.newSize.x = newCenterX - this.newSize.width /
|
|
509
|
-
this.newSize.y = newCenterY - this.newSize.height /
|
|
566
|
+
this.newSize.x = newCenterX - this.newSize.width / objectScale / 2;
|
|
567
|
+
this.newSize.y = newCenterY - this.newSize.height / objectScale / 2;
|
|
510
568
|
selectionGroup.resize(this.newSize.x, this.newSize.y, this.newSize.width, this.newSize.height);
|
|
511
569
|
}
|
|
512
570
|
}
|
|
@@ -535,33 +593,40 @@ class KritzelResizeHandler extends KritzelBaseHandler {
|
|
|
535
593
|
const rotation = selectionGroup.rotation;
|
|
536
594
|
const sin = Math.sin(rotation);
|
|
537
595
|
const cos = Math.cos(rotation);
|
|
538
|
-
const
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
const
|
|
543
|
-
const
|
|
544
|
-
|
|
596
|
+
const objectScale = selectionGroup.scale || 1;
|
|
597
|
+
const currentScale = this._core.store.state.scale;
|
|
598
|
+
// Calculate delta in local unrotated space
|
|
599
|
+
// We rotate the screen delta by -rotation to align with the object's axes
|
|
600
|
+
const localDx = (dx * cos + dy * sin) / currentScale;
|
|
601
|
+
const localDy = (-dx * sin + dy * cos) / currentScale;
|
|
602
|
+
// Calculate the center of the selection group before resize
|
|
603
|
+
const initialCenterX = this.initialSize.x + this.initialSize.width / objectScale / 2;
|
|
604
|
+
const initialCenterY = this.initialSize.y + this.initialSize.height / objectScale / 2;
|
|
605
|
+
// The center moves by half of the screen delta (scaled)
|
|
606
|
+
// This is true regardless of rotation because the resize happens symmetrically around the center
|
|
607
|
+
// relative to the fixed point logic
|
|
608
|
+
const newCenterX = initialCenterX + dx / currentScale / 2;
|
|
609
|
+
const newCenterY = initialCenterY + dy / currentScale / 2;
|
|
545
610
|
switch (this._core.store.state.resizeHandleType) {
|
|
546
611
|
case KritzelHandleType.TopLeft:
|
|
547
|
-
this.newSize.width = this.initialSize.width - localDx;
|
|
548
|
-
this.newSize.height = this.initialSize.height - localDy;
|
|
612
|
+
this.newSize.width = this.initialSize.width - localDx * objectScale;
|
|
613
|
+
this.newSize.height = this.initialSize.height - localDy * objectScale;
|
|
549
614
|
break;
|
|
550
615
|
case KritzelHandleType.TopRight:
|
|
551
|
-
this.newSize.width = this.initialSize.width + localDx;
|
|
552
|
-
this.newSize.height = this.initialSize.height - localDy;
|
|
616
|
+
this.newSize.width = this.initialSize.width + localDx * objectScale;
|
|
617
|
+
this.newSize.height = this.initialSize.height - localDy * objectScale;
|
|
553
618
|
break;
|
|
554
619
|
case KritzelHandleType.BottomLeft:
|
|
555
|
-
this.newSize.width = this.initialSize.width - localDx;
|
|
556
|
-
this.newSize.height = this.initialSize.height + localDy;
|
|
620
|
+
this.newSize.width = this.initialSize.width - localDx * objectScale;
|
|
621
|
+
this.newSize.height = this.initialSize.height + localDy * objectScale;
|
|
557
622
|
break;
|
|
558
623
|
case KritzelHandleType.BottomRight:
|
|
559
|
-
this.newSize.width = this.initialSize.width + localDx;
|
|
560
|
-
this.newSize.height = this.initialSize.height + localDy;
|
|
624
|
+
this.newSize.width = this.initialSize.width + localDx * objectScale;
|
|
625
|
+
this.newSize.height = this.initialSize.height + localDy * objectScale;
|
|
561
626
|
break;
|
|
562
627
|
}
|
|
563
|
-
this.newSize.x = newCenterX - this.newSize.width /
|
|
564
|
-
this.newSize.y = newCenterY - this.newSize.height /
|
|
628
|
+
this.newSize.x = newCenterX - this.newSize.width / objectScale / 2;
|
|
629
|
+
this.newSize.y = newCenterY - this.newSize.height / objectScale / 2;
|
|
565
630
|
selectionGroup.resize(this.newSize.x, this.newSize.y, this.newSize.width, this.newSize.height);
|
|
566
631
|
}
|
|
567
632
|
}
|
|
@@ -614,8 +679,9 @@ class KritzelRotationHandler extends KritzelBaseHandler {
|
|
|
614
679
|
const clientX = event.clientX - this._core.store.offsetX;
|
|
615
680
|
const clientY = event.clientY - this._core.store.offsetY;
|
|
616
681
|
this._core.store.state.isRotating = true;
|
|
617
|
-
const
|
|
618
|
-
const
|
|
682
|
+
const objectScale = selectionGroup.scale || 1;
|
|
683
|
+
const centerX = selectionGroup.translateX + selectionGroup.width / 2 / objectScale;
|
|
684
|
+
const centerY = selectionGroup.translateY + selectionGroup.height / 2 / objectScale;
|
|
619
685
|
const cursorX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;
|
|
620
686
|
const cursorY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;
|
|
621
687
|
this.initialSelectionGroupRotation = selectionGroup.rotation;
|
|
@@ -636,8 +702,9 @@ class KritzelRotationHandler extends KritzelBaseHandler {
|
|
|
636
702
|
const clientX = Math.round(firstTouch.clientX - this._core.store.offsetX);
|
|
637
703
|
const clientY = Math.round(firstTouch.clientY - this._core.store.offsetY);
|
|
638
704
|
this._core.store.state.isRotating = true;
|
|
639
|
-
const
|
|
640
|
-
const
|
|
705
|
+
const objectScale = selectionGroup.scale || 1;
|
|
706
|
+
const centerX = selectionGroup.translateX + selectionGroup.width / 2 / objectScale;
|
|
707
|
+
const centerY = selectionGroup.translateY + selectionGroup.height / 2 / objectScale;
|
|
641
708
|
const cursorX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;
|
|
642
709
|
const cursorY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;
|
|
643
710
|
this.initialSelectionGroupRotation = selectionGroup.rotation;
|
|
@@ -654,8 +721,9 @@ class KritzelRotationHandler extends KritzelBaseHandler {
|
|
|
654
721
|
if (this._core.store.state.isRotating && selectionGroup) {
|
|
655
722
|
const clientX = event.clientX - this._core.store.offsetX;
|
|
656
723
|
const clientY = event.clientY - this._core.store.offsetY;
|
|
657
|
-
const
|
|
658
|
-
const
|
|
724
|
+
const objectScale = selectionGroup.scale || 1;
|
|
725
|
+
const groupCenterX = selectionGroup.translateX + selectionGroup.width / 2 / objectScale;
|
|
726
|
+
const groupCenterY = selectionGroup.translateY + selectionGroup.height / 2 / objectScale;
|
|
659
727
|
const cursorX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;
|
|
660
728
|
const cursorY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;
|
|
661
729
|
const currentRotation = Math.atan2(groupCenterY - cursorY, groupCenterX - cursorX);
|
|
@@ -673,8 +741,9 @@ class KritzelRotationHandler extends KritzelBaseHandler {
|
|
|
673
741
|
if (this._core.store.state.isRotating && selectionGroup) {
|
|
674
742
|
const clientX = Math.round(firstTouch.clientX - this._core.store.offsetX);
|
|
675
743
|
const clientY = Math.round(firstTouch.clientY - this._core.store.offsetY);
|
|
676
|
-
const
|
|
677
|
-
const
|
|
744
|
+
const objectScale = selectionGroup.scale || 1;
|
|
745
|
+
const groupCenterX = selectionGroup.translateX + selectionGroup.width / 2 / objectScale;
|
|
746
|
+
const groupCenterY = selectionGroup.translateY + selectionGroup.height / 2 / objectScale;
|
|
678
747
|
const cursorX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;
|
|
679
748
|
const cursorY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;
|
|
680
749
|
const currentRotation = Math.atan2(groupCenterY - cursorY, groupCenterX - cursorX);
|
|
@@ -33979,8 +34048,10 @@ const DEFAULT_ENGINE_CONFIG = {
|
|
|
33979
34048
|
isPanning: false,
|
|
33980
34049
|
isSelecting: false,
|
|
33981
34050
|
isResizing: false,
|
|
34051
|
+
isResizeHandleHovered: false,
|
|
33982
34052
|
isResizeHandleSelected: false,
|
|
33983
34053
|
isRotating: false,
|
|
34054
|
+
isRotationHandleHovered: false,
|
|
33984
34055
|
isRotationHandleSelected: false,
|
|
33985
34056
|
isDragging: false,
|
|
33986
34057
|
isDrawing: false,
|
|
@@ -34016,6 +34087,10 @@ const DEFAULT_ENGINE_CONFIG = {
|
|
|
34016
34087
|
longTouchDelay: 300,
|
|
34017
34088
|
pointers: new Map(),
|
|
34018
34089
|
workspaces: [],
|
|
34090
|
+
cursor: {
|
|
34091
|
+
icon: 'default',
|
|
34092
|
+
iconActive: 'default'
|
|
34093
|
+
}
|
|
34019
34094
|
};
|
|
34020
34095
|
|
|
34021
34096
|
class KritzelCustomElement extends KritzelBaseObject {
|
|
@@ -34610,6 +34685,9 @@ class KritzelStore {
|
|
|
34610
34685
|
get isDisabled() {
|
|
34611
34686
|
return this._state.isEnabled === false || this._state.isReady === false || this._state.activeWorkspace === null;
|
|
34612
34687
|
}
|
|
34688
|
+
get isPointerDown() {
|
|
34689
|
+
return this._state.pointers.size > 0;
|
|
34690
|
+
}
|
|
34613
34691
|
constructor(state) {
|
|
34614
34692
|
this._state = state;
|
|
34615
34693
|
this._state.objects = new KritzelObjectMap();
|
|
@@ -35094,7 +35172,7 @@ class KritzelCore {
|
|
|
35094
35172
|
}
|
|
35095
35173
|
}
|
|
35096
35174
|
|
|
35097
|
-
const kritzelEngineCss = ":host{display:block;position:relative;height:100%;width:100%;overflow:hidden;background-color:var(--kritzel-engine-background-color, #ffffff)}:host,:host *{touch-action:none;user-select:none}.ProseMirror{outline:none}p,h1,h2,h3,h4,h5,h6,blockquote,pre{margin:0;padding:0}.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}.
|
|
35175
|
+
const kritzelEngineCss = ":host{display:block;position:relative;height:100%;width:100%;overflow:hidden;background-color:var(--kritzel-engine-background-color, #ffffff)}:host,:host *{touch-action:none;user-select:none}.ProseMirror{outline:none}p,h1,h2,h3,h4,h5,h6,blockquote,pre{margin:0;padding:0}.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}.PlaygroundEditorTheme__quote{margin:0;margin-left:20px;margin-bottom:10px;font-size:15px;color:rgb(101, 103, 107);border-left-color:rgb(206, 208, 212);border-left-width:4px;border-left-style:solid;padding-left:16px}";
|
|
35098
35176
|
|
|
35099
35177
|
const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine extends H {
|
|
35100
35178
|
get host() { return this; }
|
|
@@ -35133,6 +35211,15 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
|
|
|
35133
35211
|
this.core.store.state.scaleMin = newValue;
|
|
35134
35212
|
}
|
|
35135
35213
|
}
|
|
35214
|
+
cursorTarget;
|
|
35215
|
+
onCursorTargetChange(newValue) {
|
|
35216
|
+
// Reset cursor on old target
|
|
35217
|
+
if (this.cursorTargetElement) {
|
|
35218
|
+
this.cursorTargetElement.style.cursor = '';
|
|
35219
|
+
}
|
|
35220
|
+
// Set new target (defaults to document.body)
|
|
35221
|
+
this.cursorTargetElement = newValue || document.body;
|
|
35222
|
+
}
|
|
35136
35223
|
isEngineReady;
|
|
35137
35224
|
activeToolChange;
|
|
35138
35225
|
workspacesChange;
|
|
@@ -35173,7 +35260,9 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
|
|
|
35173
35260
|
if (this.core.store.isDisabled) {
|
|
35174
35261
|
return;
|
|
35175
35262
|
}
|
|
35176
|
-
this.core.store.state.pointers.
|
|
35263
|
+
if (this.core.store.state.pointers.has(ev.pointerId)) {
|
|
35264
|
+
this.core.store.state.pointers.set(ev.pointerId, ev);
|
|
35265
|
+
}
|
|
35177
35266
|
if (this.core.store.state.pointers.size > 1) {
|
|
35178
35267
|
this.throttledPointerMoveMulti(ev);
|
|
35179
35268
|
}
|
|
@@ -35186,6 +35275,10 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
|
|
|
35186
35275
|
}
|
|
35187
35276
|
this.core.store.state.pointers.delete(ev.pointerId);
|
|
35188
35277
|
this.host.releasePointerCapture(ev.pointerId);
|
|
35278
|
+
// Reset cursor to default when all pointers are released
|
|
35279
|
+
if (this.core.store.state.pointers.size === 0) {
|
|
35280
|
+
this.core.store.state.cursor = { icon: 'default', iconActive: 'default' };
|
|
35281
|
+
}
|
|
35189
35282
|
this.viewport.handlePointerUp(ev);
|
|
35190
35283
|
this.core.store.state?.activeTool?.handlePointerUp(ev);
|
|
35191
35284
|
}
|
|
@@ -35195,6 +35288,10 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
|
|
|
35195
35288
|
}
|
|
35196
35289
|
this.host.releasePointerCapture(ev.pointerId);
|
|
35197
35290
|
this.core.store.state.pointers.delete(ev.pointerId);
|
|
35291
|
+
// Reset cursor to default when all pointers are released
|
|
35292
|
+
if (this.core.store.state.pointers.size === 0) {
|
|
35293
|
+
this.core.store.state.cursor = { icon: 'default', iconActive: 'default' };
|
|
35294
|
+
}
|
|
35198
35295
|
this.viewport.handlePointerUp(ev);
|
|
35199
35296
|
this.core.store.state?.activeTool?.handlePointerUp(ev);
|
|
35200
35297
|
}
|
|
@@ -35369,6 +35466,7 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
|
|
|
35369
35466
|
contextMenuHandler;
|
|
35370
35467
|
keyHandler;
|
|
35371
35468
|
contextMenuElement = null;
|
|
35469
|
+
cursorTargetElement = null;
|
|
35372
35470
|
get isSelecting() {
|
|
35373
35471
|
return this.core.store.state.activeTool instanceof KritzelSelectionTool && this.core.store.state.isSelecting;
|
|
35374
35472
|
}
|
|
@@ -35392,6 +35490,12 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
|
|
|
35392
35490
|
disconnectedCallback() {
|
|
35393
35491
|
this.throttledWheel.cancel();
|
|
35394
35492
|
this.throttledPointerMoveMulti.cancel();
|
|
35493
|
+
// Reset cursor on target element
|
|
35494
|
+
if (this.cursorTargetElement) {
|
|
35495
|
+
this.cursorTargetElement.style.cursor = '';
|
|
35496
|
+
this.cursorTargetElement.style.removeProperty('--kritzel-pointer-cursor');
|
|
35497
|
+
this.cursorTargetElement = null;
|
|
35498
|
+
}
|
|
35395
35499
|
}
|
|
35396
35500
|
componentWillLoad() {
|
|
35397
35501
|
this.validateScaleMax(this.scaleMax);
|
|
@@ -35401,6 +35505,10 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
|
|
|
35401
35505
|
this.contextMenuHandler = new KritzelContextMenuHandler(this.core, this.globalContextMenuItems, this.objectContextMenuItems);
|
|
35402
35506
|
this.keyHandler = new KritzelKeyHandler(this.core);
|
|
35403
35507
|
this.viewport = new KritzelViewport(this.core, this.host);
|
|
35508
|
+
// Set cursor target element (use prop value or default to document.body)
|
|
35509
|
+
this.cursorTargetElement = this.cursorTarget || document.body;
|
|
35510
|
+
// Set the pointer cursor CSS variable for child components to use
|
|
35511
|
+
this.cursorTargetElement.style.setProperty('--kritzel-pointer-cursor', KritzelCursorHelper.getPointerCursor());
|
|
35404
35512
|
// Set sync configuration if provided
|
|
35405
35513
|
if (this.syncConfig) {
|
|
35406
35514
|
this.core.setSyncConfig(this.syncConfig);
|
|
@@ -35442,6 +35550,20 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
|
|
|
35442
35550
|
KritzelKeyboardHelper.forceHideKeyboard();
|
|
35443
35551
|
this.core.rerender();
|
|
35444
35552
|
}
|
|
35553
|
+
updateCursor() {
|
|
35554
|
+
const state = this.core.store.state;
|
|
35555
|
+
const isPointerDown = this.core.store.isPointerDown;
|
|
35556
|
+
const icon = state.cursor?.icon;
|
|
35557
|
+
const iconActive = state.cursor?.iconActive ?? icon;
|
|
35558
|
+
const rotation = state.cursor?.rotation;
|
|
35559
|
+
const cursor = KritzelCursorHelper.getCursor({
|
|
35560
|
+
iconName: isPointerDown ? iconActive : icon,
|
|
35561
|
+
rotation: rotation,
|
|
35562
|
+
});
|
|
35563
|
+
if (this.cursorTargetElement) {
|
|
35564
|
+
this.cursorTargetElement.style.cursor = cursor;
|
|
35565
|
+
}
|
|
35566
|
+
}
|
|
35445
35567
|
render() {
|
|
35446
35568
|
const computedStyle = window.getComputedStyle(this.host);
|
|
35447
35569
|
const baseHandleSizePx = computedStyle.getPropertyValue('--kritzel-selection-handle-size').trim() || '6px';
|
|
@@ -35458,7 +35580,8 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
|
|
|
35458
35580
|
depth: 100,
|
|
35459
35581
|
};
|
|
35460
35582
|
const visibleObjects = this.core.store.state.objects.query(viewportBounds);
|
|
35461
|
-
|
|
35583
|
+
this.updateCursor();
|
|
35584
|
+
return (h(Host, { key: '192c356c5476b2b3cf370b05efd5742776423200' }, this.core.store.state.debugInfo.showViewportInfo && (h("div", { key: 'fae1b053c1eda01726f6b583a8dd167bb1c34aa1', class: "debug-panel" }, h("div", { key: '0e0fab7c39c1c8116831cf7b228914b0c40fb338' }, "ActiveWorkspaceId: ", this.core.store.state?.activeWorkspace?.id), h("div", { key: '770d284f5104919c5c6a36e653971d3662e9428b' }, "ActiveWorkspaceName: ", this.core.store.state?.activeWorkspace?.name), h("div", { key: '4937256ccf074a0a2fffb9c8c32a8c6ba41d3fb4' }, "TranslateX: ", this.core.store.state?.translateX), h("div", { key: '447d95aed0dda6e212e7c67ff4bc0a2e574131fd' }, "TranslateY: ", this.core.store.state?.translateY), h("div", { key: '548a04b16f68873e5fc0a2767146b52e83b9f0f8' }, "ViewportWidth: ", this.core.store.state?.viewportWidth), h("div", { key: '16a92abf89f1b438f14f311dd248ae82e1ac1982' }, "ViewportHeight: ", this.core.store.state?.viewportHeight), h("div", { key: '92a2abc5a757c64d764f3e1ee525556eb6a88852' }, "PointerCount: ", this.core.store.state.pointers.size), h("div", { key: '7677d4fd149ef2507626e50502d7c2b74fb294af' }, "Scale: ", this.core.store.state?.scale), h("div", { key: '3120c7ff85fd9f8ef14fb313b9aae6f2fc817f75' }, "ActiveTool: ", this.core.store.state?.activeTool?.name), h("div", { key: '100cd8a8c221d66046d9ff869b23809ca2568d12' }, "HasViewportChanged: ", this.core.store.state?.hasViewportChanged ? 'true' : 'false'), h("div", { key: '2efec039f635eec81d172113d55284eb9002f339' }, "IsEnabled: ", this.core.store.state?.isEnabled ? 'true' : 'false'), h("div", { key: 'f1df2fbf86a1944831c26a23e8c0baadd5ba1c56' }, "IsScaling: ", this.core.store.state?.isScaling ? 'true' : 'false'), h("div", { key: '10098cd2ffd07200fc8a12941ffd91fc1fac4de8' }, "IsPanning: ", this.core.store.state?.isPanning ? 'true' : 'false'), h("div", { key: '75043ccdac3ef3b02dae17b758813132174c2034' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), h("div", { key: '59217b67d572cc60fc8381bcc930a952fea2faaa' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), h("div", { key: 'c4a7d64031d3b430673adb6adcb7f525f7a47ddc' }, "IsResizeHandleSelected: ", this.core.store.state.isResizeHandleSelected ? 'true' : 'false'), h("div", { key: 'd62bef9cab424e77781a3d5639552b8122e92238' }, "IsRotationHandleSelected: ", this.core.store.state.isRotationHandleSelected ? 'true' : 'false'), h("div", { key: 'ab5dbbc947b335a1396a945328a5939d690d8cd0' }, "IsRotationHandleHovered: ", this.core.store.state.isRotationHandleHovered ? 'true' : 'false'), h("div", { key: 'fb2c19a0cdc070ecbf28e51b08112a73ffcf2817' }, "IsDrawing: ", this.core.store.state.isDrawing ? 'true' : 'false'), h("div", { key: '2d5519541aeb9a6423524463a03d1626f5eaf6ca' }, "IsWriting: ", this.core.store.state.isWriting ? 'true' : 'false'), h("div", { key: 'f86b578263c68ac194d6b3d606a1cb31717b1792' }, "IsPointerDown: ", this.core.store.isPointerDown ? 'true' : 'false'), h("div", { key: '52ed5379ef3e9a18cbabe14be8106055a8f71ede' }, "PointerX: ", this.core.store.state?.pointerX), h("div", { key: '6b97e5f6c90666283fb5cfed0cf0e3b7bc0fffe3' }, "PointerY: ", this.core.store.state?.pointerY), h("div", { key: '5f80b9d4121974ee1e8afe89925b6b38b840e90f' }, "SelectedObjects: ", this.core.store.selectionGroup?.objects.length || 0), h("div", { key: '8a280b4454677f5dc29e4a2a39fd4f7cfc8c26df' }, "ViewportCenter: (", viewportCenterX.toFixed(2), ", ", viewportCenterY.toFixed(2), ")"))), h("div", { key: '660dd95852906f5c049b9527b26ea0af3fa04274', id: "origin", class: "origin", style: {
|
|
35462
35585
|
transform: `matrix(${this.core.store.state?.scale}, 0, 0, ${this.core.store.state?.scale}, ${this.core.store.state?.translateX}, ${this.core.store.state?.translateY})`,
|
|
35463
35586
|
} }, visibleObjects?.map(object => {
|
|
35464
35587
|
return (h("div", { key: object.id, style: {
|
|
@@ -35556,25 +35679,25 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
|
|
|
35556
35679
|
} }), h("circle", { class: "resize-handle-overlay top-left", cx: "0", cy: "0", r: `${(baseHandleTouchSize * object.scale) / this.core.store.state?.scale}`, style: {
|
|
35557
35680
|
fill: 'transparent',
|
|
35558
35681
|
paintOrder: 'fill',
|
|
35559
|
-
} }), h("circle", { class: "resize-handle top-right", cx: object.totalWidth, cy: "0", r: `${(baseHandleSize * object.scale) / this.core.store.state?.scale}`, style: {
|
|
35682
|
+
}, onPointerEnter: () => !this.core.store.isPointerDown && (this.core.store.state.cursor = { icon: 'move-vertical', rotation: object.rotationDegrees - 45 }), onPointerLeave: () => !this.core.store.isPointerDown && (this.core.store.state.cursor = { icon: 'default', iconActive: 'default' }) }), h("circle", { class: "resize-handle top-right", cx: object.totalWidth, cy: "0", r: `${(baseHandleSize * object.scale) / this.core.store.state?.scale}`, style: {
|
|
35560
35683
|
fill: 'var(--kritzel-selection-handle-color, #000000)',
|
|
35561
35684
|
paintOrder: 'fill',
|
|
35562
35685
|
} }), h("circle", { class: "resize-handle-overlay top-right", cx: object.totalWidth, cy: "0", r: `${(baseHandleTouchSize * object.scale) / this.core.store.state?.scale}`, style: {
|
|
35563
35686
|
fill: 'transparent',
|
|
35564
35687
|
paintOrder: 'fill',
|
|
35565
|
-
} }), h("circle", { class: "resize-handle bottom-left", cx: "0", cy: object.totalHeight, r: `${(baseHandleSize * object.scale) / this.core.store.state?.scale}`, style: {
|
|
35688
|
+
}, onPointerEnter: () => !this.core.store.isPointerDown && (this.core.store.state.cursor = { icon: 'move-vertical', rotation: object.rotationDegrees + 45 }), onPointerLeave: () => !this.core.store.isPointerDown && (this.core.store.state.cursor = { icon: 'default', iconActive: 'default' }) }), h("circle", { class: "resize-handle bottom-left", cx: "0", cy: object.totalHeight, r: `${(baseHandleSize * object.scale) / this.core.store.state?.scale}`, style: {
|
|
35566
35689
|
fill: 'var(--kritzel-selection-handle-color, #000000)',
|
|
35567
35690
|
paintOrder: 'fill',
|
|
35568
35691
|
} }), h("circle", { class: "resize-handle-overlay bottom-left", cx: "0", cy: object.totalHeight, r: `${(baseHandleTouchSize * object.scale) / this.core.store.state?.scale}`, style: {
|
|
35569
35692
|
fill: 'transparent',
|
|
35570
35693
|
paintOrder: 'fill',
|
|
35571
|
-
} }), h("circle", { class: "resize-handle bottom-right", cx: object.totalWidth, cy: object.totalHeight, r: `${(baseHandleSize * object.scale) / this.core.store.state?.scale}`, style: {
|
|
35694
|
+
}, onPointerEnter: () => !this.core.store.isPointerDown && (this.core.store.state.cursor = { icon: 'move-vertical', rotation: object.rotationDegrees + 45 }), onPointerLeave: () => !this.core.store.isPointerDown && (this.core.store.state.cursor = { icon: 'default', iconActive: 'default' }) }), h("circle", { class: "resize-handle bottom-right", cx: object.totalWidth, cy: object.totalHeight, r: `${(baseHandleSize * object.scale) / this.core.store.state?.scale}`, style: {
|
|
35572
35695
|
fill: 'var(--kritzel-selection-handle-color, #000000)',
|
|
35573
35696
|
paintOrder: 'fill',
|
|
35574
35697
|
} }), h("circle", { class: "resize-handle-overlay bottom-right", cx: object.totalWidth, cy: object.totalHeight, r: `${(baseHandleTouchSize * object.scale) / this.core.store.state?.scale}`, style: {
|
|
35575
35698
|
fill: 'transparent',
|
|
35576
35699
|
paintOrder: 'fill',
|
|
35577
|
-
} }), h("line", { x1: object.totalWidth / 2, y1: "0", x2: object.totalWidth / 2, y2: -((15 * object.scale) / this.core.store.state?.scale), style: {
|
|
35700
|
+
}, onPointerEnter: () => !this.core.store.isPointerDown && (this.core.store.state.cursor = { icon: 'move-vertical', rotation: object.rotationDegrees - 45 }), onPointerLeave: () => !this.core.store.isPointerDown && (this.core.store.state.cursor = { icon: 'default', iconActive: 'default' }) }), h("line", { x1: object.totalWidth / 2, y1: "0", x2: object.totalWidth / 2, y2: -((15 * object.scale) / this.core.store.state?.scale), style: {
|
|
35578
35701
|
stroke: 'var(--kritzel-selection-border-color, #007AFF)',
|
|
35579
35702
|
strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${this.core.store.state?.scale})`,
|
|
35580
35703
|
} }), h("circle", { class: "rotation-handle", cx: object.totalWidth / 2, cy: -((15 * object.scale) / this.core.store.state?.scale), r: `${(baseHandleSize * object.scale) / this.core.store.state?.scale}`, style: {
|
|
@@ -35582,10 +35705,9 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
|
|
|
35582
35705
|
paintOrder: 'fill',
|
|
35583
35706
|
} }), h("circle", { class: "rotation-handle-overlay", cx: object.totalWidth / 2, cy: -((15 * object.scale) / this.core.store.state?.scale), r: `${(baseHandleTouchSize * object.scale) / this.core.store.state?.scale}`, style: {
|
|
35584
35707
|
fill: 'transparent',
|
|
35585
|
-
cursor: 'grab',
|
|
35586
35708
|
paintOrder: 'fill',
|
|
35587
|
-
} }))))));
|
|
35588
|
-
})), this.core.store.state.isContextMenuVisible && (h("kritzel-context-menu", { key: '
|
|
35709
|
+
}, onPointerEnter: () => !this.core.store.isPointerDown && (this.core.store.state.cursor = { icon: 'hand', iconActive: 'hand-grab' }), onPointerLeave: () => !this.core.store.isPointerDown && (this.core.store.state.cursor = { icon: 'default', iconActive: 'default' }) }))))));
|
|
35710
|
+
})), this.core.store.state.isContextMenuVisible && (h("kritzel-context-menu", { key: '0da13416f8f2cf2f0eb6fcbb8eacb942dda0efb5', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.core.store.state.contextMenuItems, objects: this.core.store.selectionGroup?.objects || [], style: {
|
|
35589
35711
|
position: 'fixed',
|
|
35590
35712
|
left: `${this.core.store.state.contextMenuX}px`,
|
|
35591
35713
|
top: `${this.core.store.state.contextMenuY}px`,
|
|
@@ -35596,12 +35718,13 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
|
|
|
35596
35718
|
y: (-this.core.store.state.translateY + this.core.store.state.contextMenuY) / this.core.store.state.scale,
|
|
35597
35719
|
}, this.core.store.selectionGroup?.objects);
|
|
35598
35720
|
this.hideContextMenu();
|
|
35599
|
-
}, onClose: () => this.hideContextMenu() })), this.core.store.state?.activeTool instanceof KritzelEraserTool && !this.core.store.state.isScaling && h("kritzel-cursor-trail", { key: '
|
|
35721
|
+
}, onClose: () => this.hideContextMenu() })), this.core.store.state?.activeTool instanceof KritzelEraserTool && !this.core.store.state.isScaling && h("kritzel-cursor-trail", { key: '609dd8438a2678eaa3ce0a73858d9236c9371f96', core: this.core })));
|
|
35600
35722
|
}
|
|
35601
35723
|
static get watchers() { return {
|
|
35602
35724
|
"workspace": ["onWorkspaceChange"],
|
|
35603
35725
|
"scaleMax": ["validateScaleMax"],
|
|
35604
|
-
"scaleMin": ["validateScaleMin"]
|
|
35726
|
+
"scaleMin": ["validateScaleMin"],
|
|
35727
|
+
"cursorTarget": ["onCursorTargetChange"]
|
|
35605
35728
|
}; }
|
|
35606
35729
|
static get style() { return kritzelEngineCss; }
|
|
35607
35730
|
}, [769, "kritzel-engine", {
|
|
@@ -35612,6 +35735,7 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
|
|
|
35612
35735
|
"objectContextMenuItems": [16],
|
|
35613
35736
|
"scaleMax": [1026, "scale-max"],
|
|
35614
35737
|
"scaleMin": [1026, "scale-min"],
|
|
35738
|
+
"cursorTarget": [16],
|
|
35615
35739
|
"forceUpdate": [32],
|
|
35616
35740
|
"registerTool": [64],
|
|
35617
35741
|
"changeActiveTool": [64],
|
|
@@ -35645,7 +35769,8 @@ const KritzelEngine = /*@__PURE__*/ proxyCustomElement(class KritzelEngine exten
|
|
|
35645
35769
|
}, [[0, "wheel", "handleWheel"], [0, "pointerdown", "handlePointerDown"], [0, "pointermove", "handlePointerMove"], [0, "pointerup", "handlePointerUp"], [0, "pointercancel", "handlePointerCancel"], [0, "longpress", "handleLongPress"], [0, "contextmenu", "handleContextMenu"], [9, "resize", "handleResize"], [8, "keydown", "handleKeyDown"], [8, "keyup", "handleKeyUp"], [4, "dblclick", "preventDoubleTapZoomOnTouchDevices"]], {
|
|
35646
35770
|
"workspace": ["onWorkspaceChange"],
|
|
35647
35771
|
"scaleMax": ["validateScaleMax"],
|
|
35648
|
-
"scaleMin": ["validateScaleMin"]
|
|
35772
|
+
"scaleMin": ["validateScaleMin"],
|
|
35773
|
+
"cursorTarget": ["onCursorTargetChange"]
|
|
35649
35774
|
}]);
|
|
35650
35775
|
function defineCustomElement() {
|
|
35651
35776
|
if (typeof customElements === "undefined") {
|
|
@@ -35676,7 +35801,7 @@ function defineCustomElement() {
|
|
|
35676
35801
|
} });
|
|
35677
35802
|
}
|
|
35678
35803
|
|
|
35679
|
-
export { isNode as A, min$2 as B, pow as C, HocuspocusProviderWebsocket as D, KritzelEraserTool as E, KritzelImageTool as F,
|
|
35680
|
-
//# sourceMappingURL=p-
|
|
35804
|
+
export { isNode as A, min$2 as B, pow as C, HocuspocusProviderWebsocket as D, KritzelEraserTool as E, KritzelImageTool as F, KritzelCursorHelper as G, HocuspocusProvider as H, KritzelSelectionTool as I, IndexedDBSyncProvider as J, KritzelImage as K, KritzelAppStateMap as L, ABSOLUTE_SCALE_MAX as M, ABSOLUTE_SCALE_MIN as N, Observable$1 as O, defineCustomElement as P, KritzelEngine as Q, 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 };
|
|
35805
|
+
//# sourceMappingURL=p-D7BLVRXX.js.map
|
|
35681
35806
|
|
|
35682
|
-
//# sourceMappingURL=p-
|
|
35807
|
+
//# sourceMappingURL=p-D7BLVRXX.js.map
|