kritzel-stencil 0.0.121 → 0.0.123
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/{index-BcrLbdO1.js → index-C05uAr89.js} +10 -4
- package/dist/cjs/index-C05uAr89.js.map +1 -0
- package/dist/cjs/{index-BjLSiQIM.js → index-UcX3pzju.js} +348 -141
- package/dist/cjs/index-UcX3pzju.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/kritzel-brush-style_18.cjs.entry.js +137 -81
- package/dist/cjs/kritzel-brush-style_18.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stencil.cjs.js +2 -2
- package/dist/cjs/stencil.cjs.js.map +1 -1
- package/dist/collection/classes/commands/remove-object.command.js +3 -0
- package/dist/collection/classes/commands/remove-object.command.js.map +1 -1
- package/dist/collection/classes/handlers/context-menu.handler.js +1 -1
- package/dist/collection/classes/handlers/context-menu.handler.js.map +1 -1
- package/dist/collection/classes/handlers/hover.handler.js +22 -0
- package/dist/collection/classes/handlers/hover.handler.js.map +1 -0
- package/dist/collection/classes/handlers/move.handler.js +2 -2
- package/dist/collection/classes/handlers/move.handler.js.map +1 -1
- package/dist/collection/classes/handlers/selection.handler.js +16 -20
- package/dist/collection/classes/handlers/selection.handler.js.map +1 -1
- package/dist/collection/classes/history.class.js +16 -13
- package/dist/collection/classes/history.class.js.map +1 -1
- package/dist/collection/classes/objects/base-object.class.js +34 -32
- package/dist/collection/classes/objects/base-object.class.js.map +1 -1
- package/dist/collection/classes/objects/custom-element.class.js +52 -0
- package/dist/collection/classes/objects/custom-element.class.js.map +1 -0
- package/dist/collection/classes/objects/image.class.js +1 -1
- package/dist/collection/classes/objects/image.class.js.map +1 -1
- package/dist/collection/classes/objects/path.class.js +133 -4
- package/dist/collection/classes/objects/path.class.js.map +1 -1
- package/dist/collection/classes/objects/selection-box.class.js +2 -2
- package/dist/collection/classes/objects/selection-box.class.js.map +1 -1
- package/dist/collection/classes/objects/selection-group.class.js +3 -2
- package/dist/collection/classes/objects/selection-group.class.js.map +1 -1
- package/dist/collection/classes/objects/text.class.js +1 -1
- package/dist/collection/classes/objects/text.class.js.map +1 -1
- package/dist/collection/classes/reviver.class.js +4 -0
- package/dist/collection/classes/reviver.class.js.map +1 -1
- package/dist/collection/classes/store.class.js +45 -6
- package/dist/collection/classes/store.class.js.map +1 -1
- package/dist/collection/classes/tools/eraser-tool.class.js +17 -14
- package/dist/collection/classes/tools/eraser-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/image-tool.class.js +1 -1
- package/dist/collection/classes/tools/image-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/selection-tool.class.js +5 -6
- package/dist/collection/classes/tools/selection-tool.class.js.map +1 -1
- package/dist/collection/classes/viewport.class.js +20 -12
- package/dist/collection/classes/viewport.class.js.map +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +6 -6
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +1 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +43 -37
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
- package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.css +1 -1
- package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.css +1 -1
- package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.css +1 -1
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.css +1 -1
- package/dist/collection/configs/default-engine-state.js +2 -2
- package/dist/collection/configs/default-engine-state.js.map +1 -1
- package/dist/collection/helpers/html.helper.js +7 -0
- package/dist/collection/helpers/html.helper.js.map +1 -0
- package/dist/collection/helpers/object.helper.js +6 -2
- package/dist/collection/helpers/object.helper.js.map +1 -1
- package/dist/collection/interfaces/engine-state.interface.js.map +1 -1
- package/dist/collection/interfaces/object.interface.js.map +1 -1
- package/dist/components/index.js +3 -3
- package/dist/components/kritzel-brush-style.js +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 +23 -23
- package/dist/components/kritzel-editor.js.map +1 -1
- 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-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/{p-CqPrOhzi.js → p-BOj_wqdw.js} +4 -4
- package/dist/components/{p-CqPrOhzi.js.map → p-BOj_wqdw.js.map} +1 -1
- package/dist/components/{p-CEYRFk55.js → p-BY8BWGge.js} +4 -4
- package/dist/components/{p-CEYRFk55.js.map → p-BY8BWGge.js.map} +1 -1
- package/dist/components/{p-D-Rf05Ov.js → p-Bn5P7YQn.js} +5 -5
- package/dist/components/{p-D-Rf05Ov.js.map → p-Bn5P7YQn.js.map} +1 -1
- package/dist/components/{p-CIb4IA9u.js → p-C9usqwb5.js} +5 -5
- package/dist/components/{p-CIb4IA9u.js.map → p-C9usqwb5.js.map} +1 -1
- package/dist/components/{p-gDLg_PJJ.js → p-CF8ziFc4.js} +4 -4
- package/dist/components/{p-gDLg_PJJ.js.map → p-CF8ziFc4.js.map} +1 -1
- package/dist/components/{p-CDpq9L_H.js → p-CiT5gBDh.js} +3 -3
- package/dist/components/{p-CDpq9L_H.js.map → p-CiT5gBDh.js.map} +1 -1
- package/dist/components/{p-D1oFXBAp.js → p-Cn_kantt.js} +5 -5
- package/dist/components/{p-D1oFXBAp.js.map → p-Cn_kantt.js.map} +1 -1
- package/dist/components/{p-DC3j4P1n.js → p-Cnc43o9b.js} +227 -41
- package/dist/components/p-Cnc43o9b.js.map +1 -0
- package/dist/components/{p-BAMl2Ww6.js → p-CneTqrgt.js} +18 -18
- package/dist/components/{p-BAMl2Ww6.js.map → p-CneTqrgt.js.map} +1 -1
- package/dist/components/{p-B2wWYPH8.js → p-CtiROna-.js} +3 -3
- package/dist/components/{p-B2wWYPH8.js.map → p-CtiROna-.js.map} +1 -1
- package/dist/components/{p-D0L3GqSK.js → p-Cw2ATHMj.js} +3 -3
- package/dist/components/{p-D0L3GqSK.js.map → p-Cw2ATHMj.js.map} +1 -1
- package/dist/components/{p-CxmkJbeV.js → p-D0sLslUq.js} +3 -3
- package/dist/components/{p-CxmkJbeV.js.map → p-D0sLslUq.js.map} +1 -1
- package/dist/components/{p-dCaxwGmu.js → p-DJN0U8pI.js} +10 -4
- package/dist/components/p-DJN0U8pI.js.map +1 -0
- package/dist/components/{p-q-xqpmae.js → p-DJaVT2yR.js} +255 -178
- package/dist/components/p-DJaVT2yR.js.map +1 -0
- package/dist/components/{p-C3E9PtD3.js → p-DMAzUKo6.js} +10 -10
- package/dist/components/{p-C3E9PtD3.js.map → p-DMAzUKo6.js.map} +1 -1
- package/dist/components/{p-DbPbyRLO.js → p-DSLY0tr5.js} +5 -5
- package/dist/components/{p-DbPbyRLO.js.map → p-DSLY0tr5.js.map} +1 -1
- package/dist/components/{p--2FkikYE.js → p-DpiklJU9.js} +3 -3
- package/dist/components/{p--2FkikYE.js.map → p-DpiklJU9.js.map} +1 -1
- package/dist/components/{p--tElassI.js → p-NZJPrwJV.js} +3 -3
- package/dist/components/{p--tElassI.js.map → p-NZJPrwJV.js.map} +1 -1
- package/dist/components/{p-BSS4UREq.js → p-ubNAWsY_.js} +9 -9
- package/dist/components/{p-BSS4UREq.js.map → p-ubNAWsY_.js.map} +1 -1
- package/dist/esm/{index-BPFXWTBp.js → index-BGl8znzE.js} +10 -4
- package/dist/esm/index-BGl8znzE.js.map +1 -0
- package/dist/esm/{index-DsUDklEm.js → index-DO2IiM_o.js} +348 -141
- package/dist/esm/index-DO2IiM_o.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/kritzel-brush-style_18.entry.js +137 -81
- package/dist/esm/kritzel-brush-style_18.entry.js.map +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/stencil.js +3 -3
- package/dist/esm/stencil.js.map +1 -1
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/p-BGl8znzE.js +3 -0
- package/dist/stencil/p-BGl8znzE.js.map +1 -0
- package/dist/stencil/p-DO2IiM_o.js +2 -0
- package/dist/stencil/p-DO2IiM_o.js.map +1 -0
- package/dist/stencil/p-c64f6589.entry.js +2 -0
- package/dist/stencil/p-c64f6589.entry.js.map +1 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/stencil/stencil.esm.js.map +1 -1
- package/dist/types/classes/handlers/hover.handler.d.ts +6 -0
- package/dist/types/classes/handlers/selection.handler.d.ts +1 -1
- package/dist/types/classes/history.class.d.ts +1 -0
- package/dist/types/classes/objects/base-object.class.d.ts +12 -6
- package/dist/types/classes/objects/custom-element.class.d.ts +26 -0
- package/dist/types/classes/objects/image.class.d.ts +1 -1
- package/dist/types/classes/objects/path.class.d.ts +9 -2
- package/dist/types/classes/objects/text.class.d.ts +1 -1
- package/dist/types/classes/store.class.d.ts +5 -0
- package/dist/types/classes/tools/selection-tool.class.d.ts +2 -0
- package/dist/types/components.d.ts +4 -4
- package/dist/types/helpers/html.helper.d.ts +3 -0
- package/dist/types/interfaces/engine-state.interface.d.ts +2 -2
- package/dist/types/interfaces/object.interface.d.ts +12 -4
- package/package.json +5 -5
- package/dist/cjs/index-BcrLbdO1.js.map +0 -1
- package/dist/cjs/index-BjLSiQIM.js.map +0 -1
- package/dist/components/p-DC3j4P1n.js.map +0 -1
- package/dist/components/p-dCaxwGmu.js.map +0 -1
- package/dist/components/p-q-xqpmae.js.map +0 -1
- package/dist/esm/index-BPFXWTBp.js.map +0 -1
- package/dist/esm/index-DsUDklEm.js.map +0 -1
- package/dist/stencil/p-3797c300.entry.js +0 -2
- package/dist/stencil/p-3797c300.entry.js.map +0 -1
- package/dist/stencil/p-BPFXWTBp.js +0 -3
- package/dist/stencil/p-BPFXWTBp.js.map +0 -1
- package/dist/stencil/p-DsUDklEm.js +0 -2
- package/dist/stencil/p-DsUDklEm.js.map +0 -1
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var index$1 = require('./index-
|
|
3
|
+
var index = require('./index-C05uAr89.js');
|
|
4
|
+
var index$1 = require('./index-UcX3pzju.js');
|
|
5
5
|
|
|
6
6
|
const kritzelBrushStyleCss = ":host{display:flex;align-items:flex-start;gap:8px;padding:8px;box-sizing:border-box;width:100%}.brush-style-button{display:flex;justify-content:center;align-items:center;width:42px;height:32px;padding:0;border:none;outline:none;background:none;cursor:default;border-radius:0;color:var(--control-text-color);font-weight:bold;-webkit-tap-highlight-color:transparent}.font-style-button:not(:last-child){border-right:1px solid #333333}.font-style-button:hover{background-color:var(--control-hover-bg)}.font-style-button:active{background-color:var(--control-active-bg)}.font-style-button.selected,.font-style-button.selected:hover,.font-style-button.selected:active{background-color:var(--control-selected-bg);color:var(--control-selected-color)}";
|
|
7
7
|
|
|
@@ -84,7 +84,7 @@ const KritzelColor = class {
|
|
|
84
84
|
};
|
|
85
85
|
KritzelColor.style = kritzelColorCss;
|
|
86
86
|
|
|
87
|
-
const kritzelColorPaletteCss = ":host{display:flex;align-items:flex-start;gap:8px;padding:8px;width:100%;box-sizing:border-box}.color-grid{width:100%;display:grid;grid-template-columns:repeat(6, 32px);gap:8px;justify-items:center;overflow:hidden;height:40px;transition:height 0.1s ease-in-out}.color-grid.expanded{height:500px}.color-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:pointer;border:2px solid transparent;box-sizing:border-box}.color-container:hover{background-color:var(--kritzel-color-palette-hover-background-color, #f0f0f0)}.color-container.selected{border-color:var(--kritzel-selection-border-color, #
|
|
87
|
+
const kritzelColorPaletteCss = ":host{display:flex;align-items:flex-start;gap:8px;padding:8px;width:100%;box-sizing:border-box}.color-grid{width:100%;display:grid;grid-template-columns:repeat(6, 32px);gap:8px;justify-items:center;overflow:hidden;height:40px;transition:height 0.1s ease-in-out}.color-grid.expanded{height:500px}.color-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:pointer;border:2px solid transparent;box-sizing:border-box}.color-container:hover{background-color:var(--kritzel-color-palette-hover-background-color, #f0f0f0)}.color-container.selected{border-color:var(--kritzel-selection-border-color, #007AFF);background-color:var(--kritzel-color-palette-selected-background-color)}";
|
|
88
88
|
|
|
89
89
|
const KritzelColorPalette = class {
|
|
90
90
|
constructor(hostRef) {
|
|
@@ -297,7 +297,7 @@ class KritzelDevicesHelper {
|
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
-
const kritzelControlsCss = ":host{display:flex;flex-direction:column;user-select:none}.kritzel-controls{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:var(--kritzel-controls-gap, 8px);height:100%;padding:var(--kritzel-controls-padding, 8px);background-color:var(--kritzel-controls-background-color, #ffffff);border-radius:var(--kritzel-controls-border-radius, 16px);box-shadow:var(--kritzel-controls-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));border:var(--kritzel-controls-border, 1px solid #f0f0f0);z-index:10000;position:relative}.kritzel-control{display:flex;justify-content:center;align-items:center;color:var(--kritzel-controls-control-color, #000000);border-radius:var(--kritzel-controls-control-border-radius, 12px);padding:var(--kritzel-controls-control-padding, 8px);border:none;outline:none;background:none;cursor:pointer;-webkit-tap-highlight-color:transparent;font-weight:bold}.kritzel-control:hover{background-color:var(--kritzel-controls-control-hover-background-color, hsl(0, 0%, 0%, 4.3%))}:host(.mobile) .kritzel-control:hover{background-color:unset}.kritzel-control:active{background-color:var(--kritzel-controls-control-active-background-color, hsl(0, 0%, 0%, 8.6%))}:host(.mobile) .kritzel-control:active{background-color:unset}.kritzel-control.selected,.kritzel-control.selected:hover,.kritzel-control.selected:active{background-color:var(--kritzel-controls-control-selected-background-color, #
|
|
300
|
+
const kritzelControlsCss = ":host{display:flex;flex-direction:column;user-select:none}.kritzel-controls{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:var(--kritzel-controls-gap, 8px);height:100%;padding:var(--kritzel-controls-padding, 8px);background-color:var(--kritzel-controls-background-color, #ffffff);border-radius:var(--kritzel-controls-border-radius, 16px);box-shadow:var(--kritzel-controls-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));border:var(--kritzel-controls-border, 1px solid #f0f0f0);z-index:10000;position:relative}.kritzel-control{display:flex;justify-content:center;align-items:center;color:var(--kritzel-controls-control-color, #000000);border-radius:var(--kritzel-controls-control-border-radius, 12px);padding:var(--kritzel-controls-control-padding, 8px);border:none;outline:none;background:none;cursor:pointer;-webkit-tap-highlight-color:transparent;font-weight:bold}.kritzel-control:hover{background-color:var(--kritzel-controls-control-hover-background-color, hsl(0, 0%, 0%, 4.3%))}:host(.mobile) .kritzel-control:hover{background-color:unset}.kritzel-control:active{background-color:var(--kritzel-controls-control-active-background-color, hsl(0, 0%, 0%, 8.6%))}:host(.mobile) .kritzel-control:active{background-color:unset}.kritzel-control.selected,.kritzel-control.selected:hover,.kritzel-control.selected:active{background-color:var(--kritzel-controls-control-selected-background-color, #007AFF) !important;color:var(--kritzel-controls-control-selected-color, #ffffff) !important}.kritzel-divider{width:var(--kritzel-controls-divider-width, 1px);height:var(--kritzel-controls-divider-height, 24px);background-color:var(--kritzel-controls-divider-background-color, hsl(0, 0%, 0%, 4.3%))}.kritzel-config-container{position:relative;display:flex;justify-content:center;align-items:center;width:40px;height:40px;box-sizing:border-box;-webkit-tap-highlight-color:transparent}.kritzel-config{display:flex;justify-content:center;align-items:center;cursor:pointer}.color-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:pointer;border:2px solid transparent;box-sizing:border-box;background-color:var(--kritzel-color-palette-hover-background-color, #f0f0f0)}.font-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:pointer;border:2px solid transparent;box-sizing:border-box;background-color:var(--kritzel-color-palette-hover-background-color, #f0f0f0)}.no-config{height:24px;width:24px;border-radius:50%;border:1px dashed gray}kritzel-tooltip{position:fixed;bottom:66px;left:50%;transform:translateX(-50%);z-index:10001}";
|
|
301
301
|
|
|
302
302
|
const KritzelControls = class {
|
|
303
303
|
constructor(hostRef) {
|
|
@@ -663,8 +663,8 @@ const KritzelEditor = class {
|
|
|
663
663
|
name: 'brush',
|
|
664
664
|
type: 'tool',
|
|
665
665
|
tool: index$1.KritzelBrushTool,
|
|
666
|
-
isDefault: true,
|
|
667
666
|
icon: 'pen',
|
|
667
|
+
isDefault: true,
|
|
668
668
|
config: index$1.DEFAULT_BRUSH_CONFIG,
|
|
669
669
|
},
|
|
670
670
|
{
|
|
@@ -716,14 +716,14 @@ const KritzelEditor = class {
|
|
|
716
716
|
object.edit();
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
|
-
}
|
|
719
|
+
},
|
|
720
720
|
},
|
|
721
721
|
{ label: 'Copy', icon: 'copy', action: () => this.engineRef.copy() },
|
|
722
722
|
{
|
|
723
723
|
label: 'Paste',
|
|
724
724
|
icon: 'paste',
|
|
725
725
|
disabled: async () => (await this.engineRef.getCopiedObjects()).length === 0,
|
|
726
|
-
action: (menu, _) => this.engineRef.paste(menu.x, menu.y)
|
|
726
|
+
action: (menu, _) => this.engineRef.paste(menu.x, menu.y),
|
|
727
727
|
},
|
|
728
728
|
{ label: 'Delete', icon: 'delete', action: () => this.engineRef.delete() },
|
|
729
729
|
{ label: 'Bring to Front', icon: 'bring-to-front', action: () => this.engineRef.moveToTop() },
|
|
@@ -802,7 +802,7 @@ const KritzelEditor = class {
|
|
|
802
802
|
}
|
|
803
803
|
}
|
|
804
804
|
render() {
|
|
805
|
-
return (index.h(index.Host, { key: '
|
|
805
|
+
return (index.h(index.Host, { key: 'f2fa7efff5baf4df8a9b2100b96e1546731b006b' }, index.h("kritzel-engine", { key: 'd4fc5d1b0827656119b14c9e2971818904f41c3f', ref: el => (this.engineRef = el), onIsEngineReady: () => (this.isEngineReady = true), scaleMax: this.scaleMax, scaleMin: this.scaleMin, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems }), index.h("kritzel-controls", { key: 'd5f3a9b3d23090bbc8f36b8f974226697868988d', ref: el => (this.controlsRef = el), controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, style: this.isControlsVisible ? { display: 'flex' } : { display: 'none' }, onIsControlsReady: () => (this.isControlsReady = true) })));
|
|
806
806
|
}
|
|
807
807
|
get host() { return index.getElement(this); }
|
|
808
808
|
static get watchers() { return {
|
|
@@ -860,21 +860,27 @@ class KritzelViewport {
|
|
|
860
860
|
}
|
|
861
861
|
handlePointerMove(event) {
|
|
862
862
|
if (event.pointerType === 'mouse') {
|
|
863
|
-
const
|
|
864
|
-
const
|
|
865
|
-
|
|
866
|
-
this._store.state.
|
|
863
|
+
const hostRect = this._store.state.host.getBoundingClientRect();
|
|
864
|
+
const xRelativeToHost = event.clientX - hostRect.left;
|
|
865
|
+
const yRelativeToHost = event.clientY - hostRect.top;
|
|
866
|
+
this._store.state.pointerX = (xRelativeToHost - this._store.state.translateX) / this._store.state.scale;
|
|
867
|
+
this._store.state.pointerY = (yRelativeToHost - this._store.state.translateY) / this._store.state.scale;
|
|
867
868
|
if (this._store.state.isPanning) {
|
|
868
|
-
this._store.state.translateX -= this._store.state.startX -
|
|
869
|
-
this._store.state.translateY -= this._store.state.startY -
|
|
870
|
-
this._store.state.startX =
|
|
871
|
-
this._store.state.startY =
|
|
869
|
+
this._store.state.translateX -= this._store.state.startX - xRelativeToHost;
|
|
870
|
+
this._store.state.translateY -= this._store.state.startY - yRelativeToHost;
|
|
871
|
+
this._store.state.startX = xRelativeToHost;
|
|
872
|
+
this._store.state.startY = yRelativeToHost;
|
|
872
873
|
this._store.state.hasViewportChanged = true;
|
|
873
874
|
this._store.state.skipContextMenu = true;
|
|
874
875
|
this._store.rerender();
|
|
875
876
|
}
|
|
876
877
|
}
|
|
877
878
|
if (event.pointerType === 'touch') {
|
|
879
|
+
const hostRect = this._store.state.host.getBoundingClientRect();
|
|
880
|
+
const xRelativeToHost = event.clientX - hostRect.left;
|
|
881
|
+
const yRelativeToHost = event.clientY - hostRect.top;
|
|
882
|
+
this._store.state.pointerX = (xRelativeToHost - this._store.state.translateX) / this._store.state.scale;
|
|
883
|
+
this._store.state.pointerY = (yRelativeToHost - this._store.state.translateY) / this._store.state.scale;
|
|
878
884
|
const activePointers = Array.from(this._store.state.pointers.values());
|
|
879
885
|
if (activePointers.length === 2) {
|
|
880
886
|
const firstTouchX = activePointers[0].clientX - this._store.offsetX;
|
|
@@ -928,13 +934,15 @@ class KritzelViewport {
|
|
|
928
934
|
}
|
|
929
935
|
handleZoom(event) {
|
|
930
936
|
const rect = this._store.state.host.getBoundingClientRect();
|
|
931
|
-
|
|
932
|
-
|
|
937
|
+
const xRelativeToHost = event.clientX - rect.left;
|
|
938
|
+
const yRelativeToHost = event.clientY - rect.top;
|
|
939
|
+
this._store.state.pointerX = (xRelativeToHost - this._store.state.translateX) / this._store.state.scale;
|
|
940
|
+
this._store.state.pointerY = (yRelativeToHost - this._store.state.translateY) / this._store.state.scale;
|
|
933
941
|
const delta = event.deltaY > 0 ? -this._store.state.scaleStep * this._store.state.scale : this._store.state.scaleStep * this._store.state.scale;
|
|
934
942
|
const newScale = Math.min(this._store.state.scaleMax, Math.max(this._store.state.scaleMin, this._store.state.scale + delta));
|
|
935
943
|
const scaleRatio = newScale / this._store.state.scale;
|
|
936
|
-
const translateXAdjustment = (
|
|
937
|
-
const translateYAdjustment = (
|
|
944
|
+
const translateXAdjustment = (xRelativeToHost - this._store.state.translateX) * (scaleRatio - 1);
|
|
945
|
+
const translateYAdjustment = (yRelativeToHost - this._store.state.translateY) * (scaleRatio - 1);
|
|
938
946
|
this._store.state.scale = newScale;
|
|
939
947
|
this._store.state.translateX -= translateXAdjustment;
|
|
940
948
|
this._store.state.translateY -= translateYAdjustment;
|
|
@@ -1032,19 +1040,7 @@ class KritzelHistory {
|
|
|
1032
1040
|
}
|
|
1033
1041
|
executeCommand(command) {
|
|
1034
1042
|
if (this._store.state.hasViewportChanged) {
|
|
1035
|
-
|
|
1036
|
-
command.execute();
|
|
1037
|
-
this.undoStack.add(command);
|
|
1038
|
-
if (this.redoStack.isEmpty() === false) {
|
|
1039
|
-
this.redoStack.clear();
|
|
1040
|
-
}
|
|
1041
|
-
this._store.state.hasViewportChanged = false;
|
|
1042
|
-
this.previousViewport = {
|
|
1043
|
-
scale: this._store.state.scale,
|
|
1044
|
-
scaleStep: this._store.state.scaleStep,
|
|
1045
|
-
translateX: this._store.state.translateX,
|
|
1046
|
-
translateY: this._store.state.translateY,
|
|
1047
|
-
};
|
|
1043
|
+
this.addUpdateViewportCommand();
|
|
1048
1044
|
}
|
|
1049
1045
|
command.execute();
|
|
1050
1046
|
if (this._store.state.debugInfo.logCommands)
|
|
@@ -1082,6 +1078,21 @@ class KritzelHistory {
|
|
|
1082
1078
|
}
|
|
1083
1079
|
this._store.rerender();
|
|
1084
1080
|
}
|
|
1081
|
+
addUpdateViewportCommand() {
|
|
1082
|
+
const command = new UpdateViewportCommand(this._store, this, this.previousViewport);
|
|
1083
|
+
command.execute();
|
|
1084
|
+
this.undoStack.add(command);
|
|
1085
|
+
if (this.redoStack.isEmpty() === false) {
|
|
1086
|
+
this.redoStack.clear();
|
|
1087
|
+
}
|
|
1088
|
+
this._store.state.hasViewportChanged = false;
|
|
1089
|
+
this.previousViewport = {
|
|
1090
|
+
scale: this._store.state.scale,
|
|
1091
|
+
scaleStep: this._store.state.scaleStep,
|
|
1092
|
+
translateX: this._store.state.translateX,
|
|
1093
|
+
translateY: this._store.state.translateY,
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1085
1096
|
}
|
|
1086
1097
|
|
|
1087
1098
|
class KritzelOctree {
|
|
@@ -1259,8 +1270,8 @@ const DEFAULT_ENGINE_STATE = {
|
|
|
1259
1270
|
logCommands: false,
|
|
1260
1271
|
},
|
|
1261
1272
|
host: null,
|
|
1262
|
-
|
|
1263
|
-
|
|
1273
|
+
pointerX: 0,
|
|
1274
|
+
pointerY: 0,
|
|
1264
1275
|
scale: 1,
|
|
1265
1276
|
scaleMax: 1,
|
|
1266
1277
|
scaleMin: 1,
|
|
@@ -1295,7 +1306,7 @@ class KritzelStore {
|
|
|
1295
1306
|
return this._state.objectsOctree.allObjects();
|
|
1296
1307
|
}
|
|
1297
1308
|
get selectedObjects() {
|
|
1298
|
-
return this.allObjects.filter(o => !(o instanceof index$1.KritzelSelectionGroup)).filter(o => o.
|
|
1309
|
+
return this.allObjects.filter(o => !(o instanceof index$1.KritzelSelectionGroup)).filter(o => o.isSelected);
|
|
1299
1310
|
}
|
|
1300
1311
|
get offsetX() {
|
|
1301
1312
|
return this._state.host.getBoundingClientRect().left;
|
|
@@ -1386,7 +1397,7 @@ class KritzelStore {
|
|
|
1386
1397
|
this.state.copiedObjects = this.state.selectionGroup.copy();
|
|
1387
1398
|
}
|
|
1388
1399
|
paste(x, y) {
|
|
1389
|
-
this.state.copiedObjects.
|
|
1400
|
+
this.state.copiedObjects.isSelected = true;
|
|
1390
1401
|
const adjustedX = x !== undefined ? x : this.state.copiedObjects.translateX + 25;
|
|
1391
1402
|
const adjustedY = y !== undefined ? y : this.state.copiedObjects.translateY + 25;
|
|
1392
1403
|
this.state.copiedObjects.updatePosition(adjustedX, adjustedY);
|
|
@@ -1446,10 +1457,10 @@ class KritzelStore {
|
|
|
1446
1457
|
}
|
|
1447
1458
|
const selectionGroup = index$1.KritzelSelectionGroup.create(this);
|
|
1448
1459
|
objects.forEach(obj => {
|
|
1449
|
-
obj.
|
|
1460
|
+
obj.isSelected = false;
|
|
1450
1461
|
selectionGroup.addOrRemove(obj);
|
|
1451
1462
|
});
|
|
1452
|
-
selectionGroup.
|
|
1463
|
+
selectionGroup.isSelected = true;
|
|
1453
1464
|
this.state.selectionGroup = selectionGroup;
|
|
1454
1465
|
if (objects.length === 1) {
|
|
1455
1466
|
selectionGroup.rotation = selectionGroup.objects[0].rotation;
|
|
@@ -1470,10 +1481,10 @@ class KritzelStore {
|
|
|
1470
1481
|
if (objectsInViewport.length > 0) {
|
|
1471
1482
|
const selectionGroup = index$1.KritzelSelectionGroup.create(this);
|
|
1472
1483
|
objectsInViewport.forEach(obj => {
|
|
1473
|
-
obj.
|
|
1484
|
+
obj.isSelected = false;
|
|
1474
1485
|
selectionGroup.addOrRemove(obj);
|
|
1475
1486
|
});
|
|
1476
|
-
selectionGroup.
|
|
1487
|
+
selectionGroup.isSelected = true;
|
|
1477
1488
|
this.state.isSelecting = false;
|
|
1478
1489
|
if (objectsInViewport.length === 1) {
|
|
1479
1490
|
selectionGroup.rotation = selectionGroup.objects[0].rotation;
|
|
@@ -1514,6 +1525,45 @@ class KritzelStore {
|
|
|
1514
1525
|
}
|
|
1515
1526
|
return null;
|
|
1516
1527
|
}
|
|
1528
|
+
getObjectsFromPointerEvent(event, selector = '.object') {
|
|
1529
|
+
var _a;
|
|
1530
|
+
const shadowRoot = (_a = this.state.host) === null || _a === void 0 ? void 0 : _a.shadowRoot;
|
|
1531
|
+
if (!shadowRoot)
|
|
1532
|
+
return [];
|
|
1533
|
+
const clientX = event.clientX;
|
|
1534
|
+
const clientY = event.clientY;
|
|
1535
|
+
const elementsAtPoint = shadowRoot.elementsFromPoint(clientX, clientY);
|
|
1536
|
+
if (!elementsAtPoint || elementsAtPoint.length === 0)
|
|
1537
|
+
return [];
|
|
1538
|
+
const objectIds = new Set();
|
|
1539
|
+
elementsAtPoint.forEach(element => {
|
|
1540
|
+
const selectedObject = element.closest(selector);
|
|
1541
|
+
if (selectedObject && selectedObject.id) {
|
|
1542
|
+
objectIds.add(selectedObject.id);
|
|
1543
|
+
}
|
|
1544
|
+
});
|
|
1545
|
+
if (objectIds.size > 0) {
|
|
1546
|
+
return this.allObjects.filter(object => objectIds.has(object.id)).sort((a, b) => b.zIndex - a.zIndex);
|
|
1547
|
+
}
|
|
1548
|
+
return [];
|
|
1549
|
+
}
|
|
1550
|
+
getCanvasPoint(event) {
|
|
1551
|
+
if (!this.state.host) {
|
|
1552
|
+
return { x: 0, y: 0 };
|
|
1553
|
+
}
|
|
1554
|
+
// Get the position of the kritzel-engine host element relative to the viewport
|
|
1555
|
+
const hostRect = this.state.host.getBoundingClientRect();
|
|
1556
|
+
// 1. Make the pointer coordinates relative to the host element
|
|
1557
|
+
const xRelativeToHost = event.clientX - hostRect.left;
|
|
1558
|
+
const yRelativeToHost = event.clientY - hostRect.top;
|
|
1559
|
+
// 2. Reverse the translation applied to the #origin div
|
|
1560
|
+
const xWithoutTranslate = xRelativeToHost - this.state.translateX;
|
|
1561
|
+
const yWithoutTranslate = yRelativeToHost - this.state.translateY;
|
|
1562
|
+
// 3. Reverse the scaling to get the final world coordinates
|
|
1563
|
+
const worldX = xWithoutTranslate / this.state.scale;
|
|
1564
|
+
const worldY = yWithoutTranslate / this.state.scale;
|
|
1565
|
+
return { x: worldX, y: worldY };
|
|
1566
|
+
}
|
|
1517
1567
|
}
|
|
1518
1568
|
|
|
1519
1569
|
class KritzelKeyHandler extends index$1.KritzelBaseHandler {
|
|
@@ -1612,7 +1662,7 @@ class KritzelContextMenuHandler extends index$1.KritzelBaseHandler {
|
|
|
1612
1662
|
if (selectedObject && !(selectedObject instanceof index$1.KritzelSelectionGroup)) {
|
|
1613
1663
|
this._store.state.selectionGroup = index$1.KritzelSelectionGroup.create(this._store);
|
|
1614
1664
|
this._store.state.selectionGroup.addOrRemove(selectedObject);
|
|
1615
|
-
this._store.state.selectionGroup.
|
|
1665
|
+
this._store.state.selectionGroup.isSelected = true;
|
|
1616
1666
|
this._store.state.selectionGroup.rotation = selectedObject.rotation;
|
|
1617
1667
|
this._store.state.isSelecting = false;
|
|
1618
1668
|
this._store.history.executeCommand(new index$1.AddSelectionGroupCommand(this._store, this, this._store.state.selectionGroup));
|
|
@@ -1927,15 +1977,15 @@ const KritzelEngine = class {
|
|
|
1927
1977
|
const baseHandleSizePx = computedStyle.getPropertyValue('--kritzel-selection-handle-size').trim() || '6px';
|
|
1928
1978
|
const baseHandleSize = parseFloat(baseHandleSizePx);
|
|
1929
1979
|
const baseHandleTouchSize = baseHandleSize * 2 < 14 ? 14 : baseHandleSize;
|
|
1930
|
-
return (index.h(index.Host, { key: '
|
|
1931
|
-
_a.translateX), index.h("div", { key: '
|
|
1932
|
-
_b.translateY), index.h("div", { key: '
|
|
1933
|
-
_c.viewportWidth), index.h("div", { key: '
|
|
1934
|
-
_d.viewportHeight), index.h("div", { key: '
|
|
1935
|
-
_e.scale), index.h("div", { key: '
|
|
1936
|
-
_g.name), index.h("div", { key: '
|
|
1937
|
-
_m.
|
|
1938
|
-
_o.
|
|
1980
|
+
return (index.h(index.Host, { key: 'a8e6c284c98509ddd158686887d656d3907d40a2' }, index.h("div", { key: '3935b658e8859f746a5faef0bb91a527b68fcd3e', class: "debug-panel", style: { display: this.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, index.h("div", { key: '12c190c7ea99ac69310b27e719e7df8392b2b46e' }, "TranslateX: ", (_a = this.store.state) === null || _a === void 0 ? void 0 :
|
|
1981
|
+
_a.translateX), index.h("div", { key: '4c98deccc2a029dab06ed76e5af426f4a05c7b66' }, "TranslateY: ", (_b = this.store.state) === null || _b === void 0 ? void 0 :
|
|
1982
|
+
_b.translateY), index.h("div", { key: '1330191a39c7795f17a6adcc4fbd05e2d6a24d43' }, "ViewportWidth: ", (_c = this.store.state) === null || _c === void 0 ? void 0 :
|
|
1983
|
+
_c.viewportWidth), index.h("div", { key: '1ee59427037357ee6bf746a094285426eb0e6a58' }, "ViewportHeight: ", (_d = this.store.state) === null || _d === void 0 ? void 0 :
|
|
1984
|
+
_d.viewportHeight), index.h("div", { key: '1e68312e8516f25dcff34e9f9f70b90f426b8711' }, "ObjectsInViewport. ", this.store.objects.length), index.h("div", { key: '1d7cea9e21d9b744d8eaac29286528829143b4fa' }, "Scale: ", (_e = this.store.state) === null || _e === void 0 ? void 0 :
|
|
1985
|
+
_e.scale), index.h("div", { key: '0b60168fbd55aefa3714067bace80f167b8bcac0' }, "ActiveTool: ", (_g = (_f = this.store.state) === null || _f === void 0 ? void 0 : _f.activeTool) === null || _g === void 0 ? void 0 :
|
|
1986
|
+
_g.name), index.h("div", { key: '109752df6a77633d89929f325d296f96d27d7aa9' }, "HasViewportChanged: ", ((_h = this.store.state) === null || _h === void 0 ? void 0 : _h.hasViewportChanged) ? 'true' : 'false'), index.h("div", { key: 'b35466caf465b490c5d448d694353186ff902f09' }, "IsEnabled: ", ((_j = this.store.state) === null || _j === void 0 ? void 0 : _j.isEnabled) ? 'true' : 'false'), index.h("div", { key: '5df20e47f3bf234f04eea001b0a0abaf57946498' }, "IsScaling: ", ((_k = this.store.state) === null || _k === void 0 ? void 0 : _k.isScaling) ? 'true' : 'false'), index.h("div", { key: '9d1ec8b8268488821a968e109fa279393977fdf8' }, "IsPanning: ", ((_l = this.store.state) === null || _l === void 0 ? void 0 : _l.isPanning) ? 'true' : 'false'), index.h("div", { key: '92fa98b7fa3bf877c4fffaca70683d2d908f5177' }, "IsFocused: ", this.store.state.isFocused ? 'true' : 'false'), index.h("div", { key: '708d02459c1e3907dd88a2f2fd8916c1ee684cf1' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), index.h("div", { key: '27f45c1b6ee0b6bd0b3301a9c09b9198de722ac4' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), index.h("div", { key: '50d4476aecfc00d12bae7d8a3880ccb8de82fe68' }, "IsResizeHandleSelected: ", this.store.state.isResizeHandleSelected ? 'true' : 'false'), index.h("div", { key: '0c582e97ee1535b4a14b75b7ef15373c43f21c4b' }, "IsRotationHandleSelected: ", this.store.state.isRotationHandleSelected ? 'true' : 'false'), index.h("div", { key: '7a8378ac991d17d0eaaba5fbd519875197903a39' }, "IsDrawing: ", this.store.state.isDrawing ? 'true' : 'false'), index.h("div", { key: '00b56f11ffd16f7b9049d2857f5f7effceba1294' }, "IsWriting: ", this.store.state.isWriting ? 'true' : 'false'), index.h("div", { key: '3b7773194bd6bc8b8b2d024afc768f4e9fbb54c6' }, "PointerX: ", (_m = this.store.state) === null || _m === void 0 ? void 0 :
|
|
1987
|
+
_m.pointerX), index.h("div", { key: 'a2b2c96f6180591082a5aee20cc3e82236dac520' }, "PointerY: ", (_o = this.store.state) === null || _o === void 0 ? void 0 :
|
|
1988
|
+
_o.pointerY)), index.h("div", { key: '309eb61fff5182b5076cb3886bbd79006efc30b1', id: "origin", class: "origin", style: {
|
|
1939
1989
|
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})`,
|
|
1940
1990
|
} }, (_t = this.store.objects) === null || _t === void 0 ? void 0 :
|
|
1941
1991
|
_t.map(object => {
|
|
@@ -1959,17 +2009,17 @@ const KritzelEngine = class {
|
|
|
1959
2009
|
borderStyle: 'solid',
|
|
1960
2010
|
padding: object.padding + 'px',
|
|
1961
2011
|
overflow: 'visible',
|
|
1962
|
-
} }, KritzelClassHelper.isInstanceOf(object, 'KritzelPath') && (index.h("svg", { ref: el => object.mount(el), xmlns: "http://www.w3.org/2000/svg", style: {
|
|
2012
|
+
} }, KritzelClassHelper.isInstanceOf(object, 'KritzelPath') && (index.h("svg", { ref: el => el ? object.mount(el) : object.unmount(), xmlns: "http://www.w3.org/2000/svg", style: {
|
|
1963
2013
|
height: object === null || object === void 0 ? void 0 : object.height.toString(),
|
|
1964
2014
|
width: object === null || object === void 0 ? void 0 : object.width.toString(),
|
|
1965
2015
|
position: 'absolute',
|
|
1966
2016
|
overflow: 'visible',
|
|
1967
|
-
}, viewBox: object === null || object === void 0 ? void 0 : object.viewBox }, index.h("path", { d: object === null || object === void 0 ? void 0 : object.d, fill: object.fill, stroke: object === null || object === void 0 ? void 0 : object.stroke }))), KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && (index.h("img", { ref: el => object.mount(el), src: object.src, style: {
|
|
2017
|
+
}, viewBox: object === null || object === void 0 ? void 0 : object.viewBox }, index.h("path", { d: object === null || object === void 0 ? void 0 : object.d, fill: object.fill, stroke: object === null || object === void 0 ? void 0 : object.stroke }))), KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && (index.h("img", { ref: el => el ? object.mount(el) : object.unmount(), src: object.src, style: {
|
|
1968
2018
|
width: '100%',
|
|
1969
2019
|
height: '100%',
|
|
1970
2020
|
userSelect: 'none',
|
|
1971
2021
|
pointerEvents: 'none',
|
|
1972
|
-
}, draggable: false, onDragStart: e => e.preventDefault() })), KritzelClassHelper.isInstanceOf(object, '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: {
|
|
2022
|
+
}, draggable: false, onDragStart: e => e.preventDefault() })), KritzelClassHelper.isInstanceOf(object, 'KritzelText') && (index.h("textarea", { ref: el => el ? object.mount(el) : object.unmount(), value: object.value, onKeyDown: event => object.handleKeyDown(event), onInput: event => object.handleInput(event), rows: object.rows, style: {
|
|
1973
2023
|
width: '100%',
|
|
1974
2024
|
height: '100%',
|
|
1975
2025
|
color: object.fontColor,
|
|
@@ -1985,54 +2035,60 @@ const KritzelEngine = class {
|
|
|
1985
2035
|
pointerEvents: object.isReadonly ? 'none' : 'auto',
|
|
1986
2036
|
cursor: object.isReadonly ? 'default' : 'text',
|
|
1987
2037
|
caretColor: object.isReadonly ? 'transparent' : 'auto',
|
|
1988
|
-
} })), KritzelClassHelper.isInstanceOf(object, '
|
|
2038
|
+
} })), KritzelClassHelper.isInstanceOf(object, 'KritzelCustomElement') && (index.h("div", { ref: el => el ? object.mount(el) : object.unmount(), style: {
|
|
2039
|
+
width: '100%',
|
|
2040
|
+
height: '100%',
|
|
2041
|
+
pointerEvents: 'auto',
|
|
2042
|
+
overflow: 'hidden',
|
|
2043
|
+
display: 'block',
|
|
2044
|
+
} })), KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionGroup') && (index.h("div", { ref: el => el ? object.mount(el) : object.unmount(), style: {
|
|
1989
2045
|
width: '100%',
|
|
1990
2046
|
height: '100%',
|
|
1991
|
-
} })), KritzelClassHelper.isInstanceOf(object, 'KrtizelSelectionBox') && (index.h("div", { ref: el => object.mount(el), style: {
|
|
2047
|
+
} })), KritzelClassHelper.isInstanceOf(object, 'KrtizelSelectionBox') && (index.h("div", { ref: el => el ? object.mount(el) : object.unmount(), style: {
|
|
1992
2048
|
width: '100%',
|
|
1993
2049
|
height: '100%',
|
|
1994
2050
|
} }))), index.h("line", { x1: "0", y1: "0", x2: object.totalWidth, y2: "0", style: {
|
|
1995
|
-
stroke: 'var(--kritzel-selection-border-color, #
|
|
2051
|
+
stroke: 'var(--kritzel-selection-border-color, #007AFF)',
|
|
1996
2052
|
strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_b = this.store.state) === null || _b === void 0 ? void 0 : _b.scale})`,
|
|
1997
2053
|
strokeLinecap: 'square',
|
|
1998
|
-
}, visibility: object.
|
|
1999
|
-
stroke: 'var(--kritzel-selection-border-color, #
|
|
2054
|
+
}, visibility: object.isSelected ? 'visible' : 'hidden' }), index.h("line", { x1: "0", y1: "0", x2: "0", y2: object.totalHeight, style: {
|
|
2055
|
+
stroke: 'var(--kritzel-selection-border-color, #007AFF)',
|
|
2000
2056
|
strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_c = this.store.state) === null || _c === void 0 ? void 0 : _c.scale})`,
|
|
2001
2057
|
strokeLinecap: 'square',
|
|
2002
|
-
}, visibility: object.
|
|
2003
|
-
stroke: 'var(--kritzel-selection-border-color, #
|
|
2058
|
+
}, visibility: object.isSelected ? 'visible' : 'hidden' }), index.h("line", { x1: "0", y1: object.totalHeight, x2: object.totalWidth, y2: object.totalHeight, style: {
|
|
2059
|
+
stroke: 'var(--kritzel-selection-border-color, #007AFF)',
|
|
2004
2060
|
strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_d = this.store.state) === null || _d === void 0 ? void 0 : _d.scale})`,
|
|
2005
2061
|
strokeLinecap: 'square',
|
|
2006
|
-
}, visibility: object.
|
|
2007
|
-
stroke: 'var(--kritzel-selection-border-color, #
|
|
2062
|
+
}, visibility: object.isSelected ? 'visible' : 'hidden' }), index.h("line", { x1: object.totalWidth, y1: "0", x2: object.totalWidth, y2: object.totalHeight, style: {
|
|
2063
|
+
stroke: 'var(--kritzel-selection-border-color, #007AFF)',
|
|
2008
2064
|
strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_e = this.store.state) === null || _e === void 0 ? void 0 : _e.scale})`,
|
|
2009
2065
|
strokeLinecap: 'square',
|
|
2010
|
-
}, visibility: object.
|
|
2066
|
+
}, visibility: object.isSelected ? '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: {
|
|
2011
2067
|
fill: 'var(--kritzel-selection-handle-color, #000000)',
|
|
2012
|
-
}, visibility: object.
|
|
2068
|
+
}, visibility: object.isSelected && !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: {
|
|
2013
2069
|
fill: 'transparent',
|
|
2014
|
-
}, visibility: object.
|
|
2070
|
+
}, visibility: object.isSelected && !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: {
|
|
2015
2071
|
fill: 'var(--kritzel-selection-handle-color, #000000)',
|
|
2016
|
-
}, visibility: object.
|
|
2072
|
+
}, visibility: object.isSelected && !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: {
|
|
2017
2073
|
fill: 'transparent',
|
|
2018
|
-
}, visibility: object.
|
|
2074
|
+
}, visibility: object.isSelected && !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: {
|
|
2019
2075
|
fill: 'var(--kritzel-selection-handle-color, #000000)',
|
|
2020
|
-
}, visibility: object.
|
|
2076
|
+
}, visibility: object.isSelected && !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: {
|
|
2021
2077
|
fill: 'transparent',
|
|
2022
|
-
}, visibility: object.
|
|
2078
|
+
}, visibility: object.isSelected && !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: {
|
|
2023
2079
|
fill: 'var(--kritzel-selection-handle-color, #000000)',
|
|
2024
|
-
}, visibility: object.
|
|
2080
|
+
}, visibility: object.isSelected && !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: {
|
|
2025
2081
|
fill: 'transparent',
|
|
2026
|
-
}, visibility: object.
|
|
2027
|
-
stroke: 'var(--kritzel-selection-border-color, #
|
|
2082
|
+
}, visibility: object.isSelected && !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: {
|
|
2083
|
+
stroke: 'var(--kritzel-selection-border-color, #007AFF)',
|
|
2028
2084
|
strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_q = this.store.state) === null || _q === void 0 ? void 0 : _q.scale})`,
|
|
2029
|
-
}, visibility: object.
|
|
2085
|
+
}, visibility: object.isSelected && !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: {
|
|
2030
2086
|
fill: 'var(--kritzel-selection-handle-color, #000000)',
|
|
2031
|
-
}, visibility: object.
|
|
2087
|
+
}, visibility: object.isSelected && !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: {
|
|
2032
2088
|
fill: 'transparent',
|
|
2033
2089
|
cursor: 'grab',
|
|
2034
|
-
}, visibility: object.
|
|
2035
|
-
}), index.h("svg", { key: '
|
|
2090
|
+
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("g", { style: { display: this.store.state.debugInfo.showObjectInfo ? 'block' : 'none', pointerEvents: 'none' } }, index.h("foreignObject", { x: object.totalWidth.toString(), y: "0", width: "400px", height: "160px", style: { minHeight: '0', minWidth: '0', display: object.isDebugInfoVisible ? '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), index.h("div", { style: { whiteSpace: 'nowrap' } }, "x: ", object.x), index.h("div", { style: { whiteSpace: 'nowrap' } }, "y: ", object.y)))))));
|
|
2091
|
+
}), index.h("svg", { key: 'c40c470ce1a341a6d238ea6c313bd3a78465dbd9', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
|
|
2036
2092
|
height: (_u = this.store.state.currentPath) === null || _u === void 0 ? void 0 : _u.height.toString(),
|
|
2037
2093
|
width: (_v = this.store.state.currentPath) === null || _v === void 0 ? void 0 : _v.width.toString(),
|
|
2038
2094
|
left: '0',
|
|
@@ -2042,7 +2098,7 @@ const KritzelEngine = class {
|
|
|
2042
2098
|
transform: (_x = this.store.state.currentPath) === null || _x === void 0 ? void 0 : _x.transformationMatrix,
|
|
2043
2099
|
transformOrigin: 'top left',
|
|
2044
2100
|
overflow: 'visible',
|
|
2045
|
-
}, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, index.h("path", { key: '
|
|
2101
|
+
}, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, index.h("path", { key: 'f2d62173bc61abf639e356520419b50c0493f34b', 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: 'ad36d2e5eb72e2cbca73c48ef8a4db6d3b6f7a64', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, objects: ((_2 = this.store.state.selectionGroup) === null || _2 === void 0 ? void 0 : _2.objects) || [], style: {
|
|
2046
2102
|
position: 'fixed',
|
|
2047
2103
|
left: `${this.store.state.contextMenuX}px`,
|
|
2048
2104
|
top: `${this.store.state.contextMenuY}px`,
|
|
@@ -2054,7 +2110,7 @@ const KritzelEngine = class {
|
|
|
2054
2110
|
y: (-this.store.state.translateY + this.store.state.contextMenuY) / this.store.state.scale,
|
|
2055
2111
|
}, (_a = this.store.state.selectionGroup) === null || _a === void 0 ? void 0 : _a.objects);
|
|
2056
2112
|
this.hideContextMenu();
|
|
2057
|
-
} })), ((_3 = this.store.state) === null || _3 === void 0 ? void 0 : _3.activeTool) instanceof index$1.KritzelEraserTool && !this.store.state.isScaling && index.h("kritzel-cursor-trail", { key: '
|
|
2113
|
+
} })), ((_3 = this.store.state) === null || _3 === void 0 ? void 0 : _3.activeTool) instanceof index$1.KritzelEraserTool && !this.store.state.isScaling && index.h("kritzel-cursor-trail", { key: '6917e2621b4de0b0985e58a6043898d79e367ccc', store: this.store })));
|
|
2058
2114
|
}
|
|
2059
2115
|
get host() { return index.getElement(this); }
|
|
2060
2116
|
static get watchers() { return {
|
|
@@ -2124,7 +2180,7 @@ const KritzelFontFamily = class {
|
|
|
2124
2180
|
};
|
|
2125
2181
|
KritzelFontFamily.style = kritzelFontFamilyCss;
|
|
2126
2182
|
|
|
2127
|
-
const kritzelFontSizeCss = ":host{display:flex;align-items:flex-start;gap:8px;padding:8px;box-sizing:border-box}.size-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:4px;cursor:pointer;border:2px solid transparent;box-sizing:border-box;border-radius:50%}.size-container:hover{background-color:var(--kritzel-font-size-hover-background-color, #f0f0f0)}.size-container.selected{border-color:var(--kritzel-selection-border-color, #
|
|
2183
|
+
const kritzelFontSizeCss = ":host{display:flex;align-items:flex-start;gap:8px;padding:8px;box-sizing:border-box}.size-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:4px;cursor:pointer;border:2px solid transparent;box-sizing:border-box;border-radius:50%}.size-container:hover{background-color:var(--kritzel-font-size-hover-background-color, #f0f0f0)}.size-container.selected{border-color:var(--kritzel-selection-border-color, #007AFF);background-color:var(--kritzel-font-size-selected-background-color, #e0e0e0)}";
|
|
2128
2184
|
|
|
2129
2185
|
const KritzelFontSize = class {
|
|
2130
2186
|
constructor(hostRef) {
|
|
@@ -2169,7 +2225,7 @@ const KritzelIcon = class {
|
|
|
2169
2225
|
};
|
|
2170
2226
|
KritzelIcon.style = kritzelIconCss;
|
|
2171
2227
|
|
|
2172
|
-
const kritzelStrokeSizeCss = ":host{display:flex;align-items:flex-start;gap:8px;padding:8px;box-sizing:border-box}.size-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:pointer;border:2px solid transparent;box-sizing:border-box}.size-container:hover{background-color:var(--kritzel-stroke-size-hover-background-color, #f0f0f0)}.size-container.selected{border-color:var(--kritzel-selection-border-color, #
|
|
2228
|
+
const kritzelStrokeSizeCss = ":host{display:flex;align-items:flex-start;gap:8px;padding:8px;box-sizing:border-box}.size-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:pointer;border:2px solid transparent;box-sizing:border-box}.size-container:hover{background-color:var(--kritzel-stroke-size-hover-background-color, #f0f0f0)}.size-container.selected{border-color:var(--kritzel-selection-border-color, #007AFF);background-color:var(--kritzel-stroke-size-selected-background-color, #f0f0f0)}";
|
|
2173
2229
|
|
|
2174
2230
|
const KritzelStrokeSize = class {
|
|
2175
2231
|
constructor(hostRef) {
|