kritzel-stencil 0.0.160 → 0.0.162
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-line-tool.config-D1Ns0NmM.js} +3156 -929
- package/dist/cjs/default-line-tool.config-D1Ns0NmM.js.map +1 -0
- package/dist/cjs/index.cjs.js +131 -126
- 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 +538 -198
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stencil.cjs.js +1 -1
- package/dist/collection/classes/core/core.class.js +140 -3
- package/dist/collection/classes/core/core.class.js.map +1 -1
- package/dist/collection/classes/core/reviver.class.js +8 -0
- package/dist/collection/classes/core/reviver.class.js.map +1 -1
- package/dist/collection/classes/core/store.class.js +8 -0
- package/dist/collection/classes/core/store.class.js.map +1 -1
- package/dist/collection/classes/handlers/line-handle.handler.js +383 -0
- package/dist/collection/classes/handlers/line-handle.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/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/managers/anchor.manager.js +874 -0
- package/dist/collection/classes/managers/anchor.manager.js.map +1 -0
- package/dist/collection/classes/managers/cursor.manager.js +117 -0
- package/dist/collection/classes/managers/cursor.manager.js.map +1 -0
- package/dist/collection/classes/objects/base-object.class.js +4 -2
- package/dist/collection/classes/objects/base-object.class.js.map +1 -1
- package/dist/collection/classes/objects/line.class.js +564 -0
- package/dist/collection/classes/objects/line.class.js.map +1 -0
- package/dist/collection/classes/objects/selection-group.class.js +4 -0
- package/dist/collection/classes/objects/selection-group.class.js.map +1 -1
- package/dist/collection/classes/registries/icon-registry.class.js +7 -1
- package/dist/collection/classes/registries/icon-registry.class.js.map +1 -1
- package/dist/collection/classes/tools/line-tool.class.js +172 -0
- package/dist/collection/classes/tools/line-tool.class.js.map +1 -0
- package/dist/collection/classes/tools/selection-tool.class.js +41 -8
- package/dist/collection/classes/tools/selection-tool.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 +11 -2
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +1 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.css +0 -14
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +163 -21
- 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 +10 -0
- package/dist/collection/configs/default-engine-config.js.map +1 -1
- package/dist/collection/configs/default-line-tool.config.js +34 -0
- package/dist/collection/configs/default-line-tool.config.js.map +1 -0
- package/dist/collection/helpers/cursor.helper.js +58 -0
- package/dist/collection/helpers/cursor.helper.js.map +1 -0
- package/dist/collection/helpers/geometry.helper.js +42 -0
- package/dist/collection/helpers/geometry.helper.js.map +1 -1
- package/dist/collection/index.js +6 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/interfaces/anchor.interface.js +2 -0
- package/dist/collection/interfaces/anchor.interface.js.map +1 -0
- package/dist/collection/interfaces/arrow-head.interface.js +2 -0
- package/dist/collection/interfaces/arrow-head.interface.js.map +1 -0
- package/dist/collection/interfaces/engine-state.interface.js.map +1 -1
- package/dist/collection/interfaces/line-options.interface.js +2 -0
- package/dist/collection/interfaces/line-options.interface.js.map +1 -0
- package/dist/collection/interfaces/toolbar-control.interface.js.map +1 -1
- package/dist/components/index.js +4 -4
- 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 +64 -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-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-TdCTkEu0.js → p-7_lwv0zQ.js} +7 -7
- package/dist/components/p-7_lwv0zQ.js.map +1 -0
- 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-CIXPLjCu.js → p-BdwB-S9G.js} +3 -3
- package/dist/components/p-BdwB-S9G.js.map +1 -0
- package/dist/components/p-BixlbUD7.js +104 -0
- package/dist/components/p-BixlbUD7.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-Ddh40W3x.js → p-CDteBYm9.js} +9 -9
- package/dist/components/p-CDteBYm9.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-CK6no3mi.js → p-CkD1PQQX.js} +6 -6
- package/dist/components/{p-CK6no3mi.js.map → p-CkD1PQQX.js.map} +1 -1
- package/dist/components/{p-BQg4YML7.js → p-Cqr0Bah5.js} +12 -12
- package/dist/components/p-Cqr0Bah5.js.map +1 -0
- package/dist/components/{p-DTHqEUDc.js → p-CuhOrcET.js} +2861 -390
- package/dist/components/p-CuhOrcET.js.map +1 -0
- package/dist/components/{p-DAfkuR8U.js → p-CvLFRlQU.js} +5 -5
- package/dist/components/p-CvLFRlQU.js.map +1 -0
- package/dist/components/{p-1lIHoOlH.js → p-DKwJJuFb.js} +19 -19
- package/dist/components/p-DKwJJuFb.js.map +1 -0
- package/dist/components/{p-CsA9M6me.js → p-DZ7kxJUx.js} +8 -8
- package/dist/components/p-DZ7kxJUx.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-C2sWlNsJ.js → p-dMCB4tJA.js} +5 -5
- package/dist/components/p-dMCB4tJA.js.map +1 -0
- package/dist/components/{p-CBYBurdY.js → p-sokRZ7Vn.js} +49 -5
- package/dist/components/p-sokRZ7Vn.js.map +1 -0
- package/dist/esm/{default-text-tool.config-DzqpOikl.js → default-line-tool.config-C35m-d1Y.js} +3150 -930
- package/dist/esm/default-line-tool.config-C35m-d1Y.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 +457 -117
- 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-C35m-d1Y.js +2 -0
- package/dist/stencil/p-C35m-d1Y.js.map +1 -0
- package/dist/stencil/p-d142ef46.entry.js +10 -0
- package/dist/stencil/p-d142ef46.entry.js.map +1 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/core/core.class.d.ts +18 -0
- package/dist/types/classes/core/store.class.d.ts +3 -0
- package/dist/types/classes/handlers/line-handle.handler.d.ts +34 -0
- package/dist/types/classes/managers/anchor.manager.d.ts +160 -0
- package/dist/types/classes/managers/cursor.manager.d.ts +43 -0
- package/dist/types/classes/objects/line.class.d.ts +98 -0
- package/dist/types/classes/tools/line-tool.class.d.ts +17 -0
- package/dist/types/classes/tools/selection-tool.class.d.ts +4 -0
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +4 -2
- package/dist/types/components.d.ts +7 -5
- package/dist/types/configs/default-line-tool.config.d.ts +2 -0
- package/dist/types/helpers/cursor.helper.d.ts +22 -0
- package/dist/types/helpers/geometry.helper.d.ts +10 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/interfaces/anchor.interface.d.ts +137 -0
- package/dist/types/interfaces/arrow-head.interface.d.ts +26 -0
- package/dist/types/interfaces/engine-state.interface.d.ts +15 -0
- package/dist/types/interfaces/line-options.interface.d.ts +21 -0
- package/dist/types/interfaces/toolbar-control.interface.d.ts +17 -1
- 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-CBYBurdY.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 +0 -2
- package/dist/stencil/p-DzqpOikl.js.map +0 -1
- package/dist/stencil/p-d702c5af.entry.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-SGde3HXB.js";export{s as setNonce}from"./p-SGde3HXB.js";import{g as o}from"./p-DQuL1Twl.js";var n=()=>{const t=import.meta.url;const o={};if(t!==""){o.resourcesUrl=new URL(".",t).href}return e(o)};n().then((async e=>{await o();return t([["p-
|
|
1
|
+
import{p as e,b as t}from"./p-SGde3HXB.js";export{s as setNonce}from"./p-SGde3HXB.js";import{g as o}from"./p-DQuL1Twl.js";var n=()=>{const t=import.meta.url;const o={};if(t!==""){o.resourcesUrl=new URL(".",t).href}return e(o)};n().then((async e=>{await o();return t([["p-d142ef46",[[768,"kritzel-editor",{scaleMax:[2,"scale-max"],scaleMin:[2,"scale-min"],controls:[16],globalContextMenuItems:[16],objectContextMenuItems:[16],customSvgIcons:[16],isControlsVisible:[4,"is-controls-visible"],isUtilityPanelVisible:[4,"is-utility-panel-visible"],syncConfig:[16],isEngineReady:[32],isControlsReady:[32],isWorkspaceManagerReady:[32],workspaces:[32],activeWorkspace:[32],isVirtualKeyboardOpen:[32],undoState:[32],getObjectById:[64],addObject:[64],updateObject:[64],removeObject:[64],getSelectedObjects:[64],selectObjects:[64],selectAllObjectsInViewport:[64],clearSelection:[64],centerObjectInViewport:[64],createWorkspace:[64],updateWorkspace:[64],deleteWorkspace:[64],getWorkspaces:[64],getActiveWorkspace:[64]},[[0,"dblclick","onTouchStart"]],{isEngineReady:["onIsEngineReady"],isControlsReady:["onIsControlsReady"],workspaces:["onWorkspacesChange"]}],[769,"kritzel-controls",{controls:[16],activeControl:[1040],isUtilityPanelVisible:[4,"is-utility-panel-visible"],undoState:[16],firstConfig:[32],isTooltipVisible:[32],isTouchDevice:[32],closeTooltip:[64]},[[4,"click","handleDocumentClick"],[8,"keydown","handleKeyDown"],[4,"activeToolChange","handleActiveToolChange"]]],[769,"kritzel-workspace-manager",{activeWorkspace:[1040],workspaces:[16],childMenuAnchor:[32],openChildMenuItem:[32],newWorkspace:[32],editingItemId:[32]},[[8,"wheel","handleWheel"]]],[769,"kritzel-engine",{workspace:[16],syncConfig:[16],activeTool:[16],globalContextMenuItems:[16],objectContextMenuItems:[16],scaleMax:[1026,"scale-max"],scaleMin:[1026,"scale-min"],cursorTarget:[16],forceUpdate:[32],registerTool:[64],changeActiveTool:[64],disable:[64],enable:[64],delete:[64],copy:[64],paste:[64],bringForward:[64],sendBackward:[64],bringToFront:[64],sendToBack:[64],undo:[64],redo:[64],hideContextMenu:[64],getObjectById:[64],addObject:[64],updateObject:[64],removeObject:[64],getSelectedObjects:[64],selectObjects:[64],selectAllObjectsInViewport:[64],clearSelection:[64],centerObjectInViewport:[64],getCopiedObjects:[64],createWorkspace:[64],updateWorkspace:[64],deleteWorkspace:[64],getWorkspaces:[64],getActiveWorkspace:[64]},[[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"]],{workspace:["onWorkspaceChange"],scaleMax:["validateScaleMax"],scaleMin:["validateScaleMin"],cursorTarget:["onCursorTargetChange"]}],[769,"kritzel-control-text-config",{tool:[1040],isExpanded:[1028,"is-expanded"]}],[769,"kritzel-control-brush-config",{tool:[1040],isExpanded:[1028,"is-expanded"],palette:[32]},null,{tool:["handleToolChange"]}],[769,"kritzel-split-button",{buttonIcon:[1,"button-icon"],dropdownIcon:[1,"dropdown-icon"],items:[16],mainButtonDisabled:[4,"main-button-disabled"],menuButtonDisabled:[4,"menu-button-disabled"],isMenuOpen:[32],isTouchDevice:[32],anchorElement:[32],menuScrollTop:[32],open:[64],focusMenu:[64]}],[769,"kritzel-context-menu",{items:[16],objects:[16],processedItems:[32]},[[9,"pointerdown","handleOutsideClick"]],{items:["onItemsChanged"]}],[769,"kritzel-utility-panel",{undoState:[16]}],[769,"kritzel-cursor-trail",{core:[16],cursorTrailPoints:[32],isLeftButtonDown:[32]},[[9,"pointerdown","handleMouseDown"],[9,"pointermove","handlePointerMove"],[9,"pointerup","handlePointerUp"]]],[769,"kritzel-tooltip",{isVisible:[4,"is-visible"],anchorElement:[16],arrowSize:[2,"arrow-size"],offsetY:[2,"offset-y"],positionX:[32],arrowOffset:[32],isMobileView:[32],focusContent:[64]},[[4,"click","handleOutsideClick"],[9,"resize","handleWindowResize"]]],[769,"kritzel-font-family",{fontOptions:[16],selectedFontFamily:[1025,"selected-font-family"]}],[769,"kritzel-font-size",{sizes:[16],selectedSize:[1026,"selected-size"],fontFamily:[1,"font-family"]}],[769,"kritzel-stroke-size",{sizes:[16],selectedSize:[1026,"selected-size"]}],[769,"kritzel-color-palette",{colors:[16],selectedColor:[1025,"selected-color"],isExpanded:[4,"is-expanded"],isOpaque:[4,"is-opaque"]}],[769,"kritzel-font",{fontFamily:[1,"font-family"],size:[2],color:[1]}],[769,"kritzel-menu",{items:[16],parent:[16],selectedIndex:[32],setScrollTop:[64],setFocus:[64]}],[769,"kritzel-menu-item",{item:[16],parent:[16],isDirty:[32]},null,{item:["onItemChange"]}],[769,"kritzel-dropdown",{options:[16],value:[1],width:[1],selectStyles:[8,"select-styles"],internalValue:[32],hasSuffixContent:[32],hasPrefixContent:[32]},null,{options:["optionsChanged"],value:["externalValueChanged"]}],[769,"kritzel-portal",{anchor:[16],offsetX:[2,"offset-x"],offsetY:[2,"offset-y"],autoFocus:[4,"auto-focus"]},[[8,"click","handleOutsideClick"],[8,"keydown","handleKeyDown"],[11,"resize","handleResize"],[11,"scroll","handleWindowScroll"]],{anchor:["anchorChanged"]}],[769,"kritzel-color",{value:[1],size:[2]}],[769,"kritzel-icon",{name:[1],label:[1],size:[2]}]]],["p-385bab97",[[769,"kritzel-brush-style",{type:[1],brushOptions:[16]}]]]],e)}));
|
|
2
2
|
//# sourceMappingURL=stencil.esm.js.map
|
|
@@ -5,14 +5,20 @@ import { KritzelStore } from './store.class';
|
|
|
5
5
|
import { KritzelWorkspace } from './workspace.class';
|
|
6
6
|
import { KritzelSyncConfig } from '../../interfaces/sync-config.interface';
|
|
7
7
|
import { KritzelAppStateMap } from '../structures/app-state-map.structure';
|
|
8
|
+
import { KritzelAnchorManager } from '../managers/anchor.manager';
|
|
9
|
+
import { KritzelCursorManager } from '../managers/cursor.manager';
|
|
8
10
|
export declare class KritzelCore {
|
|
9
11
|
private readonly _kritzelEngine;
|
|
10
12
|
private readonly _store;
|
|
11
13
|
private _syncConfig?;
|
|
12
14
|
private readonly _appStateMap;
|
|
15
|
+
private readonly _anchorManager;
|
|
16
|
+
private readonly _cursorManager;
|
|
13
17
|
get engine(): KritzelEngine;
|
|
14
18
|
get store(): KritzelStore;
|
|
15
19
|
get appStateMap(): KritzelAppStateMap;
|
|
20
|
+
get anchorManager(): KritzelAnchorManager;
|
|
21
|
+
get cursorManager(): KritzelCursorManager;
|
|
16
22
|
constructor(kritzelEngine: KritzelEngine);
|
|
17
23
|
setSyncConfig(config?: KritzelSyncConfig): void;
|
|
18
24
|
initializeYjs(): Promise<void>;
|
|
@@ -59,9 +65,21 @@ export declare class KritzelCore {
|
|
|
59
65
|
resetActiveText(): void;
|
|
60
66
|
getObjectFromPointerEvent(event: PointerEvent, selector?: string): KritzelBaseObject<any> | null;
|
|
61
67
|
getObjectsFromPointerEvent(event: PointerEvent, selector?: string): KritzelBaseObject<any>[];
|
|
68
|
+
/**
|
|
69
|
+
* Get all elements at a pointer position that match a given selector.
|
|
70
|
+
* Uses elementsFromPoint to find overlapped elements.
|
|
71
|
+
*/
|
|
72
|
+
getElementsAtPoint(event: PointerEvent, selector: string): Element[];
|
|
73
|
+
/**
|
|
74
|
+
* Check if any element at the pointer position matches the given selector.
|
|
75
|
+
* Useful for detecting hover states on overlapped elements.
|
|
76
|
+
*/
|
|
77
|
+
isPointerOverElement(event: PointerEvent, selector: string): boolean;
|
|
62
78
|
getCanvasPoint(event: PointerEvent): {
|
|
63
79
|
x: number;
|
|
64
80
|
y: number;
|
|
65
81
|
};
|
|
66
82
|
beforeWorkspaceChange(): void;
|
|
83
|
+
displaySelectionGroupUI(object: KritzelBaseObject<any>): boolean;
|
|
84
|
+
displaySelectionLineUI(object: KritzelBaseObject<any>): boolean;
|
|
67
85
|
}
|
|
@@ -3,6 +3,7 @@ import { KritzelEngineState } from '../../interfaces/engine-state.interface';
|
|
|
3
3
|
import { KritzelSelectionBox } from '../objects/selection-box.class';
|
|
4
4
|
import { KritzelText } from '../objects/text.class';
|
|
5
5
|
import { KritzelPath } from '../objects/path.class';
|
|
6
|
+
import { KritzelLine } from '../objects/line.class';
|
|
6
7
|
import { StateChangeListener, StatePropertyKey } from '../../types/state.types';
|
|
7
8
|
import { KritzelBaseObject } from '../..';
|
|
8
9
|
export declare class KritzelStore {
|
|
@@ -17,9 +18,11 @@ export declare class KritzelStore {
|
|
|
17
18
|
get selectionGroup(): KritzelSelectionGroup | null;
|
|
18
19
|
get activeText(): KritzelText | null;
|
|
19
20
|
get currentPath(): KritzelPath | null;
|
|
21
|
+
get currentLine(): KritzelLine | null;
|
|
20
22
|
get offsetX(): number;
|
|
21
23
|
get offsetY(): number;
|
|
22
24
|
get isDisabled(): boolean;
|
|
25
|
+
get isPointerDown(): boolean;
|
|
23
26
|
constructor(state: KritzelEngineState);
|
|
24
27
|
onStateChange<K extends StatePropertyKey>(property: K, listener: StateChangeListener<KritzelEngineState[K]>): void;
|
|
25
28
|
getState<K extends StatePropertyKey>(property: K): Readonly<KritzelEngineState[K]>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { KritzelCore } from '../core/core.class';
|
|
2
|
+
import { KritzelBaseHandler } from './base.handler';
|
|
3
|
+
export type LineHandleType = 'start' | 'end' | 'center';
|
|
4
|
+
export declare class KritzelLineHandleHandler extends KritzelBaseHandler {
|
|
5
|
+
initialMouseX: number;
|
|
6
|
+
initialMouseY: number;
|
|
7
|
+
initialStartX: number;
|
|
8
|
+
initialStartY: number;
|
|
9
|
+
initialEndX: number;
|
|
10
|
+
initialEndY: number;
|
|
11
|
+
initialControlX: number | undefined;
|
|
12
|
+
initialControlY: number | undefined;
|
|
13
|
+
initialTranslateX: number;
|
|
14
|
+
initialTranslateY: number;
|
|
15
|
+
hasMoved: boolean;
|
|
16
|
+
/** Current snap target during drag, if any */
|
|
17
|
+
private currentSnapTarget;
|
|
18
|
+
constructor(core: KritzelCore);
|
|
19
|
+
private reset;
|
|
20
|
+
handlePointerDown(event: PointerEvent): void;
|
|
21
|
+
private startHandleDrag;
|
|
22
|
+
handlePointerMove(event: PointerEvent): void;
|
|
23
|
+
/**
|
|
24
|
+
* Converts world coordinates to a line's local coordinate system.
|
|
25
|
+
*/
|
|
26
|
+
private worldToLineLocal;
|
|
27
|
+
/**
|
|
28
|
+
* Converts a line's local coordinate system to world coordinates.
|
|
29
|
+
*/
|
|
30
|
+
private lineLocalToWorld;
|
|
31
|
+
private updateLineEndpoint;
|
|
32
|
+
handlePointerUp(_event: PointerEvent): void;
|
|
33
|
+
private getSelectedLine;
|
|
34
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { AnchorIndexEntry, AnchorLinesRenderData, AnchorVisualization, LineAnchor, SnapCandidate, SnapIndicatorRenderData, SnapTarget } from '../../interfaces/anchor.interface';
|
|
2
|
+
import { KritzelCore } from '../core/core.class';
|
|
3
|
+
import { KritzelLine } from '../objects/line.class';
|
|
4
|
+
import { KritzelBaseObject } from '../objects/base-object.class';
|
|
5
|
+
type AnchorClipInfo = {
|
|
6
|
+
localX: number;
|
|
7
|
+
localY: number;
|
|
8
|
+
worldX: number;
|
|
9
|
+
worldY: number;
|
|
10
|
+
t?: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Manages anchor connections between line endpoints and other objects.
|
|
14
|
+
* Maintains a runtime index for efficient reverse lookups and handles
|
|
15
|
+
* snap detection during line endpoint dragging.
|
|
16
|
+
*/
|
|
17
|
+
export declare class KritzelAnchorManager {
|
|
18
|
+
private readonly _core;
|
|
19
|
+
/**
|
|
20
|
+
* Runtime index mapping objectId to the lines anchored to it.
|
|
21
|
+
* This is derived from the anchor properties on lines and rebuilt as needed.
|
|
22
|
+
*/
|
|
23
|
+
private readonly _anchorIndex;
|
|
24
|
+
constructor(core: KritzelCore);
|
|
25
|
+
/**
|
|
26
|
+
* Sets an anchor from a line endpoint to a target object's center.
|
|
27
|
+
* Updates both the line's anchor property and the internal index.
|
|
28
|
+
*/
|
|
29
|
+
setAnchor(lineId: string, endpoint: 'start' | 'end', targetObjectId: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Removes an anchor from a line endpoint.
|
|
32
|
+
* Updates both the line's anchor property and the internal index.
|
|
33
|
+
*/
|
|
34
|
+
removeAnchor(lineId: string, endpoint: 'start' | 'end'): void;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the anchor for a specific line endpoint.
|
|
37
|
+
*/
|
|
38
|
+
getAnchor(lineId: string, endpoint: 'start' | 'end'): LineAnchor | null;
|
|
39
|
+
/**
|
|
40
|
+
* Gets all lines that have an endpoint anchored to the specified object.
|
|
41
|
+
*/
|
|
42
|
+
getLinesAnchoredTo(objectId: string): AnchorIndexEntry[];
|
|
43
|
+
/**
|
|
44
|
+
* Updates all line endpoints that are anchored to the specified object.
|
|
45
|
+
* Should be called when an object moves.
|
|
46
|
+
*/
|
|
47
|
+
updateAnchorsForObject(objectId: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* Snaps a line endpoint to an object's center.
|
|
50
|
+
*/
|
|
51
|
+
private snapEndpointToObject;
|
|
52
|
+
/**
|
|
53
|
+
* Converts world coordinates to a line's local coordinate system.
|
|
54
|
+
*/
|
|
55
|
+
private worldToLineLocal;
|
|
56
|
+
/**
|
|
57
|
+
* Finds the nearest object that can be snapped to within the snap threshold.
|
|
58
|
+
* Returns null if no suitable snap target is found.
|
|
59
|
+
*
|
|
60
|
+
* @param worldX - X coordinate in world space
|
|
61
|
+
* @param worldY - Y coordinate in world space
|
|
62
|
+
* @param excludeLineId - ID of the line being edited (to exclude from snap targets)
|
|
63
|
+
* @param otherEndpointAnchorId - ID of object anchored to the other endpoint (to prevent same-object anchoring)
|
|
64
|
+
*/
|
|
65
|
+
findSnapTarget(worldX: number, worldY: number, excludeLineId: string, otherEndpointAnchorId?: string): SnapTarget | null;
|
|
66
|
+
/**
|
|
67
|
+
* Sets the current snap candidate for visual feedback.
|
|
68
|
+
*/
|
|
69
|
+
setSnapCandidate(candidate: SnapCandidate | null): void;
|
|
70
|
+
/**
|
|
71
|
+
* Gets the current snap candidate.
|
|
72
|
+
*/
|
|
73
|
+
getSnapCandidate(): SnapCandidate | null;
|
|
74
|
+
/**
|
|
75
|
+
* Clears the snap candidate.
|
|
76
|
+
*/
|
|
77
|
+
clearSnapCandidate(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Gets render data for anchor lines visualization.
|
|
80
|
+
* Returns null if there's no selected line with anchors or if snap is in progress.
|
|
81
|
+
*/
|
|
82
|
+
getAnchorLinesRenderData(): AnchorLinesRenderData | null;
|
|
83
|
+
/**
|
|
84
|
+
* Gets render data for snap indicator visualization.
|
|
85
|
+
* Returns null if there's no snap candidate.
|
|
86
|
+
*/
|
|
87
|
+
getSnapIndicatorRenderData(): SnapIndicatorRenderData | null;
|
|
88
|
+
/**
|
|
89
|
+
* Handles cleanup when an object is deleted.
|
|
90
|
+
* Detaches all lines that were anchored to the deleted object.
|
|
91
|
+
*/
|
|
92
|
+
handleObjectDeleted(objectId: string): void;
|
|
93
|
+
/**
|
|
94
|
+
* Handles cleanup when a line is deleted.
|
|
95
|
+
* Removes all anchor index entries for the line.
|
|
96
|
+
*/
|
|
97
|
+
handleLineDeleted(lineId: string): void;
|
|
98
|
+
/**
|
|
99
|
+
* Rebuilds the anchor index from all lines in the object map.
|
|
100
|
+
* Should be called after loading/deserializing objects.
|
|
101
|
+
*/
|
|
102
|
+
rebuildIndex(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Adds an entry to the anchor index.
|
|
105
|
+
*/
|
|
106
|
+
private addToIndex;
|
|
107
|
+
/**
|
|
108
|
+
* Removes an entry from the anchor index.
|
|
109
|
+
*/
|
|
110
|
+
private removeFromIndex;
|
|
111
|
+
/**
|
|
112
|
+
* Gets a line by its ID.
|
|
113
|
+
*/
|
|
114
|
+
private getLineById;
|
|
115
|
+
/**
|
|
116
|
+
* Gets an object by its ID.
|
|
117
|
+
*/
|
|
118
|
+
private getObjectById;
|
|
119
|
+
private findAnchorTarget;
|
|
120
|
+
/**
|
|
121
|
+
* Computes anchor visualization data for a line with anchors.
|
|
122
|
+
* Returns edge intersection points for rendering dashed lines from edge to center.
|
|
123
|
+
*/
|
|
124
|
+
computeAnchorVisualization(line: KritzelLine, endpoint: 'start' | 'end'): AnchorVisualization | null;
|
|
125
|
+
/**
|
|
126
|
+
* Computes a clipped line path that stops at anchor edges instead of going to anchor centers.
|
|
127
|
+
* When arrows are present on anchored ends, the line is shortened so the arrow tip appears at the edge.
|
|
128
|
+
* Returns the SVG path 'd' attribute string, or the original path if no clipping is needed.
|
|
129
|
+
* @param line The line object
|
|
130
|
+
* @param offsetByViewBox If true, subtracts line.x and line.y from coordinates (for selection UI)
|
|
131
|
+
*/
|
|
132
|
+
computeClippedLinePath(line: KritzelLine, offsetByViewBox?: boolean): string;
|
|
133
|
+
computeAnchorClipInfo(line: KritzelLine, endpoint: 'start' | 'end', targetObject: KritzelBaseObject<Element>): AnchorClipInfo | null;
|
|
134
|
+
private computeStraightClipInfo;
|
|
135
|
+
private computeCurvedClipInfo;
|
|
136
|
+
private findCurveExitPoint;
|
|
137
|
+
private refineCurveExitParameter;
|
|
138
|
+
private approximateParameterForWorldPoint;
|
|
139
|
+
private evaluateLineAtT;
|
|
140
|
+
private evaluateDerivativeSpeedAtT;
|
|
141
|
+
private extractQuadraticSegment;
|
|
142
|
+
private splitQuadraticSegment;
|
|
143
|
+
private lerpPoint;
|
|
144
|
+
private buildAnchorPath;
|
|
145
|
+
private buildWorldQuadraticPath;
|
|
146
|
+
private getPolygonPoints;
|
|
147
|
+
/**
|
|
148
|
+
* Converts local line coordinates to world coordinates.
|
|
149
|
+
*/
|
|
150
|
+
private lineLocalToWorld;
|
|
151
|
+
/**
|
|
152
|
+
* Converts world coordinates to line's local SVG coordinates.
|
|
153
|
+
*/
|
|
154
|
+
private lineWorldToLocal;
|
|
155
|
+
/**
|
|
156
|
+
* Checks if an object can be used as an anchor target.
|
|
157
|
+
*/
|
|
158
|
+
private isAnchorable;
|
|
159
|
+
}
|
|
160
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { KritzelCore } from '../core/core.class';
|
|
2
|
+
/**
|
|
3
|
+
* Manages cursor state and updates across the application.
|
|
4
|
+
* Handles cursor changes based on handle hovers, tool states, and interactions.
|
|
5
|
+
*/
|
|
6
|
+
export declare class KritzelCursorManager {
|
|
7
|
+
private readonly _core;
|
|
8
|
+
private _targetElement;
|
|
9
|
+
private _shadowRoot;
|
|
10
|
+
constructor(core: KritzelCore);
|
|
11
|
+
/**
|
|
12
|
+
* Sets the target element where cursor styles will be applied.
|
|
13
|
+
* Also sets the pointer cursor CSS variable for child components.
|
|
14
|
+
*/
|
|
15
|
+
setTargetElement(element: HTMLElement | null): void;
|
|
16
|
+
/**
|
|
17
|
+
* Gets the current cursor target element.
|
|
18
|
+
*/
|
|
19
|
+
getTargetElement(): HTMLElement | null;
|
|
20
|
+
/**
|
|
21
|
+
* Sets the shadow root for element detection.
|
|
22
|
+
*/
|
|
23
|
+
setShadowRoot(shadowRoot: ShadowRoot): void;
|
|
24
|
+
/**
|
|
25
|
+
* Resets cursor to default state.
|
|
26
|
+
* Should be called when all pointers are released.
|
|
27
|
+
*/
|
|
28
|
+
resetToDefault(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Detects handle hover states using elementsFromPoint() to work with overlapped elements.
|
|
31
|
+
* This approach finds all elements at the pointer position instead of relying on pointerenter/pointerleave.
|
|
32
|
+
*/
|
|
33
|
+
updateHoverState(ev: PointerEvent): void;
|
|
34
|
+
/**
|
|
35
|
+
* Applies the current cursor state to the target element.
|
|
36
|
+
* Should be called in the render loop.
|
|
37
|
+
*/
|
|
38
|
+
applyCursor(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Cleans up cursor state when the component is disconnected.
|
|
41
|
+
*/
|
|
42
|
+
cleanup(): void;
|
|
43
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { KritzelLineOptions } from '../../interfaces/line-options.interface';
|
|
2
|
+
import { KritzelBaseObject } from './base-object.class';
|
|
3
|
+
import { KritzelPolygon } from '../../interfaces/polygon.interface';
|
|
4
|
+
import { KritzelCore } from '../core/core.class';
|
|
5
|
+
import { LineAnchor } from '../../interfaces/anchor.interface';
|
|
6
|
+
import { ArrowHeadStyle, LineArrowConfig } from '../../interfaces/arrow-head.interface';
|
|
7
|
+
export declare class KritzelLine extends KritzelBaseObject<SVGElement> {
|
|
8
|
+
__class__: string;
|
|
9
|
+
startX: number;
|
|
10
|
+
startY: number;
|
|
11
|
+
endX: number;
|
|
12
|
+
endY: number;
|
|
13
|
+
controlX?: number;
|
|
14
|
+
controlY?: number;
|
|
15
|
+
stroke: string;
|
|
16
|
+
strokeWidth: number;
|
|
17
|
+
scale: number;
|
|
18
|
+
options: KritzelLineOptions | undefined;
|
|
19
|
+
/** Anchor connection for the start point of the line */
|
|
20
|
+
startAnchor?: LineAnchor;
|
|
21
|
+
/** Anchor connection for the end point of the line */
|
|
22
|
+
endAnchor?: LineAnchor;
|
|
23
|
+
/** Arrow head configuration for start and end of line */
|
|
24
|
+
arrows?: LineArrowConfig;
|
|
25
|
+
isVisible: boolean;
|
|
26
|
+
isDebugInfoVisible: boolean;
|
|
27
|
+
isCompleted: boolean;
|
|
28
|
+
private _adjustedPoints?;
|
|
29
|
+
get d(): string;
|
|
30
|
+
get viewBox(): string;
|
|
31
|
+
constructor(config?: KritzelLineOptions);
|
|
32
|
+
static create(core: KritzelCore, options?: KritzelLineOptions): KritzelLine;
|
|
33
|
+
resize(x: number | null, y: number | null, width: number, height: number): void;
|
|
34
|
+
rotate(value: number): void;
|
|
35
|
+
move(startX: number, startY: number, endX: number, endY: number): void;
|
|
36
|
+
hitTest(x: number, y: number): boolean;
|
|
37
|
+
hitTestPolygon(polygon: KritzelPolygon): boolean;
|
|
38
|
+
updatePosition(x: number, y: number): void;
|
|
39
|
+
/**
|
|
40
|
+
* Updates a specific endpoint of the line (start or end).
|
|
41
|
+
* The coordinates are in viewBox-local space (relative to x, y origin).
|
|
42
|
+
* This method recalculates the bounding box dimensions.
|
|
43
|
+
*
|
|
44
|
+
* @param handleType - Which endpoint to update: 'start' or 'end'
|
|
45
|
+
* @param newX - New X coordinate in viewBox-local space
|
|
46
|
+
* @param newY - New Y coordinate in viewBox-local space
|
|
47
|
+
*/
|
|
48
|
+
updateEndpoint(handleType: 'start' | 'end', newX: number, newY: number): void;
|
|
49
|
+
updateControlPoint(newX: number | undefined, newY: number | undefined): void;
|
|
50
|
+
private computeAdjustedPoints;
|
|
51
|
+
private pointToLineSegmentDistance;
|
|
52
|
+
/**
|
|
53
|
+
* Calculates the minimum distance from a point to a quadratic Bezier curve.
|
|
54
|
+
* Uses sampling along the curve to find the closest point.
|
|
55
|
+
*/
|
|
56
|
+
private pointToBezierDistance;
|
|
57
|
+
/**
|
|
58
|
+
* Computes the adjusted control point in world coordinates, accounting for rotation and translation.
|
|
59
|
+
*/
|
|
60
|
+
private computeAdjustedControlPoint;
|
|
61
|
+
get rotatedPolygon(): KritzelPolygon;
|
|
62
|
+
/**
|
|
63
|
+
* Calculates the tight bounding box for a quadratic Bezier curve or straight line.
|
|
64
|
+
* For curves, it finds the extrema points where the derivative equals zero.
|
|
65
|
+
*/
|
|
66
|
+
static calculateBoundingBox(startX: number, startY: number, endX: number, endY: number, controlX: number | undefined, controlY: number | undefined, strokeWidth: number): {
|
|
67
|
+
minX: number;
|
|
68
|
+
minY: number;
|
|
69
|
+
maxX: number;
|
|
70
|
+
maxY: number;
|
|
71
|
+
};
|
|
72
|
+
calculateBoundingBox(): {
|
|
73
|
+
minX: number;
|
|
74
|
+
minY: number;
|
|
75
|
+
maxX: number;
|
|
76
|
+
maxY: number;
|
|
77
|
+
};
|
|
78
|
+
private updateDimensions;
|
|
79
|
+
/** Get unique marker ID for SVG defs at the start of the line */
|
|
80
|
+
get startMarkerId(): string;
|
|
81
|
+
/** Get unique marker ID for SVG defs at the end of the line */
|
|
82
|
+
get endMarkerId(): string;
|
|
83
|
+
/** Get the arrow size for start or end, defaulting to strokeWidth * 3 */
|
|
84
|
+
getArrowSize(end: 'start' | 'end'): number;
|
|
85
|
+
/** Get the arrow fill color for start or end, defaulting to stroke color */
|
|
86
|
+
getArrowFill(end: 'start' | 'end'): string;
|
|
87
|
+
/**
|
|
88
|
+
* Generate SVG path data for an arrow head based on the given style.
|
|
89
|
+
* The path is designed to fit in a 10x10 viewBox with the tip at (10, 5).
|
|
90
|
+
* @param style The arrow head style
|
|
91
|
+
* @returns SVG path data string
|
|
92
|
+
*/
|
|
93
|
+
getArrowPath(style?: ArrowHeadStyle): string;
|
|
94
|
+
/** Check if start arrow is enabled */
|
|
95
|
+
get hasStartArrow(): boolean;
|
|
96
|
+
/** Check if end arrow is enabled */
|
|
97
|
+
get hasEndArrow(): boolean;
|
|
98
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { KritzelBaseTool } from './base-tool.class';
|
|
2
|
+
import { KritzelCore } from '../core/core.class';
|
|
3
|
+
import { LineArrowConfig } from '../../interfaces/arrow-head.interface';
|
|
4
|
+
export declare class KritzelLineTool extends KritzelBaseTool {
|
|
5
|
+
color: string;
|
|
6
|
+
size: number;
|
|
7
|
+
palettes: string[];
|
|
8
|
+
/** Arrow head configuration for lines created with this tool */
|
|
9
|
+
arrows?: LineArrowConfig;
|
|
10
|
+
private _startX;
|
|
11
|
+
private _startY;
|
|
12
|
+
constructor(core: KritzelCore);
|
|
13
|
+
handlePointerDown(event: PointerEvent): void;
|
|
14
|
+
handlePointerMove(event: PointerEvent): void;
|
|
15
|
+
handlePointerUp(event: PointerEvent): void;
|
|
16
|
+
private selectLineAndSwitchTool;
|
|
17
|
+
}
|
|
@@ -5,12 +5,14 @@ import { KritzelSelectionHandler } from '../handlers/selection.handler';
|
|
|
5
5
|
import { KritzelBaseTool } from './base-tool.class';
|
|
6
6
|
import { KritzelHoverHandler } from '../handlers/hover.handler';
|
|
7
7
|
import { KritzelCore } from '../core/core.class';
|
|
8
|
+
import { KritzelLineHandleHandler } from '../handlers/line-handle.handler';
|
|
8
9
|
export declare class KritzelSelectionTool extends KritzelBaseTool {
|
|
9
10
|
selectionHandler: KritzelSelectionHandler;
|
|
10
11
|
moveHandler: KritzelMoveHandler;
|
|
11
12
|
hoverHandler: KritzelHoverHandler;
|
|
12
13
|
resizeHandler: KritzelResizeHandler;
|
|
13
14
|
rotationHandler: KritzelRotationHandler;
|
|
15
|
+
lineHandleHandler: KritzelLineHandleHandler;
|
|
14
16
|
constructor(core: KritzelCore);
|
|
15
17
|
handlePointerDown(event: PointerEvent): void;
|
|
16
18
|
handlePointerMove(event: PointerEvent): void;
|
|
@@ -19,4 +21,6 @@ export declare class KritzelSelectionTool extends KritzelBaseTool {
|
|
|
19
21
|
private getHandleType;
|
|
20
22
|
private isHandleSelected;
|
|
21
23
|
private isRotationHandleSelected;
|
|
24
|
+
private isLineHandleSelected;
|
|
25
|
+
private getLineHandleType;
|
|
22
26
|
}
|
|
@@ -4,7 +4,7 @@ import { KritzelViewport } from '../../../classes/core/viewport.class';
|
|
|
4
4
|
import { KritzelKeyHandler } from '../../../classes/handlers/key.handler';
|
|
5
5
|
import { KritzelBaseTool } from '../../../classes/tools/base-tool.class';
|
|
6
6
|
import { ContextMenuItem } from '../../../interfaces/context-menu-item.interface';
|
|
7
|
-
import { KritzelBrushToolConfig, KritzelTextToolConfig } from '../../../interfaces/toolbar-control.interface';
|
|
7
|
+
import { KritzelBrushToolConfig, KritzelLineToolConfig, KritzelTextToolConfig } from '../../../interfaces/toolbar-control.interface';
|
|
8
8
|
import { KritzelContextMenuHandler } from '../../../classes/handlers/context-menu.handler';
|
|
9
9
|
import { KritzelBaseObject } from '../../../classes/objects/base-object.class';
|
|
10
10
|
import { KritzelWorkspace } from '../../../classes/core/workspace.class';
|
|
@@ -24,6 +24,8 @@ export declare class KritzelEngine {
|
|
|
24
24
|
validateScaleMax(newValue: number): void;
|
|
25
25
|
scaleMin: number;
|
|
26
26
|
validateScaleMin(newValue: number): void;
|
|
27
|
+
cursorTarget?: HTMLElement;
|
|
28
|
+
onCursorTargetChange(newValue: HTMLElement | undefined): void;
|
|
27
29
|
isEngineReady: EventEmitter<KritzelEngineState>;
|
|
28
30
|
activeToolChange: EventEmitter<KritzelBaseTool>;
|
|
29
31
|
workspacesChange: EventEmitter<KritzelWorkspace[]>;
|
|
@@ -44,7 +46,7 @@ export declare class KritzelEngine {
|
|
|
44
46
|
handleKeyDown(ev: any): void;
|
|
45
47
|
handleKeyUp(ev: any): void;
|
|
46
48
|
preventDoubleTapZoomOnTouchDevices(ev: MouseEvent): void;
|
|
47
|
-
registerTool(toolName: string, toolClass: any, toolConfig?: KritzelTextToolConfig | KritzelBrushToolConfig): Promise<KritzelBaseTool>;
|
|
49
|
+
registerTool(toolName: string, toolClass: any, toolConfig?: KritzelTextToolConfig | KritzelBrushToolConfig | KritzelLineToolConfig): Promise<KritzelBaseTool>;
|
|
48
50
|
changeActiveTool(tool: KritzelBaseTool): Promise<void>;
|
|
49
51
|
disable(): Promise<void>;
|
|
50
52
|
enable(): Promise<void>;
|
|
@@ -10,7 +10,7 @@ import { ContextMenuItem } from "./interfaces/context-menu-item.interface";
|
|
|
10
10
|
import { KritzelBaseObject } from "./classes/objects/base-object.class";
|
|
11
11
|
import { KritzelBrushTool } from "./classes/tools/brush-tool.class";
|
|
12
12
|
import { KritzelTextTool } from "./classes/tools/text-tool.class";
|
|
13
|
-
import { KritzelBrushToolConfig, KritzelTextToolConfig, KritzelToolbarControl } from "./interfaces/toolbar-control.interface";
|
|
13
|
+
import { KritzelBrushToolConfig, KritzelLineToolConfig, KritzelTextToolConfig, KritzelToolbarControl } from "./interfaces/toolbar-control.interface";
|
|
14
14
|
import { KritzelUndoState } from "./interfaces/undo-state.interface";
|
|
15
15
|
import { KritzelCore } from "./classes/core/core.class";
|
|
16
16
|
import { DropdownOption } from "./components/shared/kritzel-dropdown/kritzel-dropdown";
|
|
@@ -27,7 +27,7 @@ export { ContextMenuItem } from "./interfaces/context-menu-item.interface";
|
|
|
27
27
|
export { KritzelBaseObject } from "./classes/objects/base-object.class";
|
|
28
28
|
export { KritzelBrushTool } from "./classes/tools/brush-tool.class";
|
|
29
29
|
export { KritzelTextTool } from "./classes/tools/text-tool.class";
|
|
30
|
-
export { KritzelBrushToolConfig, KritzelTextToolConfig, KritzelToolbarControl } from "./interfaces/toolbar-control.interface";
|
|
30
|
+
export { KritzelBrushToolConfig, KritzelLineToolConfig, KritzelTextToolConfig, KritzelToolbarControl } from "./interfaces/toolbar-control.interface";
|
|
31
31
|
export { KritzelUndoState } from "./interfaces/undo-state.interface";
|
|
32
32
|
export { KritzelCore } from "./classes/core/core.class";
|
|
33
33
|
export { DropdownOption } from "./components/shared/kritzel-dropdown/kritzel-dropdown";
|
|
@@ -132,7 +132,7 @@ export namespace Components {
|
|
|
132
132
|
"centerObjectInViewport": (object: KritzelBaseObject) => Promise<KritzelBaseObject<HTMLElement | SVGElement>>;
|
|
133
133
|
"clearSelection": () => Promise<void>;
|
|
134
134
|
/**
|
|
135
|
-
* @default [ { name: 'selection', type: 'tool', isDefault: true, tool: KritzelSelectionTool, icon: 'cursor', }, { name: 'brush', type: 'tool', tool: KritzelBrushTool, icon: 'pen', config: DEFAULT_BRUSH_CONFIG, }, { name: 'eraser', type: 'tool', tool: KritzelEraserTool, icon: 'eraser', }, { name: 'text', type: 'tool', tool: KritzelTextTool, icon: 'type', config: DEFAULT_TEXT_CONFIG, }, { name: 'image', type: 'tool', tool: KritzelImageTool, icon: 'image', }, { name: 'divider', type: 'divider', }, { name: 'config', type: 'config', }, ]
|
|
135
|
+
* @default [ { name: 'selection', type: 'tool', isDefault: true, tool: KritzelSelectionTool, icon: 'cursor', }, { name: 'brush', type: 'tool', tool: KritzelBrushTool, icon: 'pen', config: DEFAULT_BRUSH_CONFIG, }, { name: 'line', type: 'tool', tool: KritzelLineTool, icon: 'arrow', config: DEFAULT_LINE_TOOL_CONFIG, }, { name: 'eraser', type: 'tool', tool: KritzelEraserTool, icon: 'eraser', }, { name: 'text', type: 'tool', tool: KritzelTextTool, icon: 'type', config: DEFAULT_TEXT_CONFIG, }, { name: 'image', type: 'tool', tool: KritzelImageTool, icon: 'image', }, { name: 'divider', type: 'divider', }, { name: 'config', type: 'config', }, ]
|
|
136
136
|
*/
|
|
137
137
|
"controls": KritzelToolbarControl[];
|
|
138
138
|
"createWorkspace": (name: string, viewport?: { translateX: number; translateY: number; scale: number; }) => Promise<KritzelWorkspace | null>;
|
|
@@ -186,6 +186,7 @@ export namespace Components {
|
|
|
186
186
|
"clearSelection": () => Promise<void>;
|
|
187
187
|
"copy": () => Promise<void>;
|
|
188
188
|
"createWorkspace": (workspace: KritzelWorkspace) => Promise<KritzelWorkspace | null>;
|
|
189
|
+
"cursorTarget"?: HTMLElement;
|
|
189
190
|
"delete": () => Promise<void>;
|
|
190
191
|
"deleteWorkspace": (workspace: KritzelWorkspace) => Promise<void>;
|
|
191
192
|
"disable": () => Promise<void>;
|
|
@@ -200,7 +201,7 @@ export namespace Components {
|
|
|
200
201
|
"objectContextMenuItems": ContextMenuItem[];
|
|
201
202
|
"paste": (x: number, y: number) => Promise<void>;
|
|
202
203
|
"redo": () => Promise<void>;
|
|
203
|
-
"registerTool": (toolName: string, toolClass: any, toolConfig?: KritzelTextToolConfig | KritzelBrushToolConfig) => Promise<KritzelBaseTool>;
|
|
204
|
+
"registerTool": (toolName: string, toolClass: any, toolConfig?: KritzelTextToolConfig | KritzelBrushToolConfig | KritzelLineToolConfig) => Promise<KritzelBaseTool>;
|
|
204
205
|
"removeObject": <T extends KritzelBaseObject>(object: T) => Promise<T | null>;
|
|
205
206
|
/**
|
|
206
207
|
* @default ABSOLUTE_SCALE_MAX
|
|
@@ -926,7 +927,7 @@ declare namespace LocalJSX {
|
|
|
926
927
|
}
|
|
927
928
|
interface KritzelEditor {
|
|
928
929
|
/**
|
|
929
|
-
* @default [ { name: 'selection', type: 'tool', isDefault: true, tool: KritzelSelectionTool, icon: 'cursor', }, { name: 'brush', type: 'tool', tool: KritzelBrushTool, icon: 'pen', config: DEFAULT_BRUSH_CONFIG, }, { name: 'eraser', type: 'tool', tool: KritzelEraserTool, icon: 'eraser', }, { name: 'text', type: 'tool', tool: KritzelTextTool, icon: 'type', config: DEFAULT_TEXT_CONFIG, }, { name: 'image', type: 'tool', tool: KritzelImageTool, icon: 'image', }, { name: 'divider', type: 'divider', }, { name: 'config', type: 'config', }, ]
|
|
930
|
+
* @default [ { name: 'selection', type: 'tool', isDefault: true, tool: KritzelSelectionTool, icon: 'cursor', }, { name: 'brush', type: 'tool', tool: KritzelBrushTool, icon: 'pen', config: DEFAULT_BRUSH_CONFIG, }, { name: 'line', type: 'tool', tool: KritzelLineTool, icon: 'arrow', config: DEFAULT_LINE_TOOL_CONFIG, }, { name: 'eraser', type: 'tool', tool: KritzelEraserTool, icon: 'eraser', }, { name: 'text', type: 'tool', tool: KritzelTextTool, icon: 'type', config: DEFAULT_TEXT_CONFIG, }, { name: 'image', type: 'tool', tool: KritzelImageTool, icon: 'image', }, { name: 'divider', type: 'divider', }, { name: 'config', type: 'config', }, ]
|
|
930
931
|
*/
|
|
931
932
|
"controls"?: KritzelToolbarControl[];
|
|
932
933
|
/**
|
|
@@ -964,6 +965,7 @@ declare namespace LocalJSX {
|
|
|
964
965
|
}
|
|
965
966
|
interface KritzelEngine {
|
|
966
967
|
"activeTool"?: KritzelTool;
|
|
968
|
+
"cursorTarget"?: HTMLElement;
|
|
967
969
|
"globalContextMenuItems"?: ContextMenuItem[];
|
|
968
970
|
"objectContextMenuItems"?: ContextMenuItem[];
|
|
969
971
|
"onActiveToolChange"?: (event: KritzelEngineCustomEvent<KritzelBaseTool>) => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare class KritzelCursorHelper {
|
|
2
|
+
private static _pointerCursor;
|
|
3
|
+
/**
|
|
4
|
+
* Returns the custom pointer cursor CSS value.
|
|
5
|
+
* This can be used instead of `cursor: pointer` for consistent styling.
|
|
6
|
+
*/
|
|
7
|
+
static getPointerCursor(): string;
|
|
8
|
+
/**
|
|
9
|
+
* Returns a custom cursor CSS value with support for rotation.
|
|
10
|
+
* The icon is retrieved from the KritzelIconRegistry.
|
|
11
|
+
*/
|
|
12
|
+
static getCursor(options: {
|
|
13
|
+
iconName: string;
|
|
14
|
+
rotation?: number;
|
|
15
|
+
color?: string;
|
|
16
|
+
size?: number;
|
|
17
|
+
hotspot?: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
};
|
|
21
|
+
}): string;
|
|
22
|
+
}
|
|
@@ -4,4 +4,14 @@ export declare class KritzelGeometryHelper {
|
|
|
4
4
|
static doPolygonsIntersect(polygon1: KritzelPolygon, polygon2: KritzelPolygon): boolean;
|
|
5
5
|
static isPointInPolygon(point: KritzelPoint, polygon: KritzelPoint[]): boolean;
|
|
6
6
|
static intersectLines(p1a: KritzelPoint, p1b: KritzelPoint, p2a: KritzelPoint, p2b: KritzelPoint): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Finds the intersection point between a line segment and a line segment.
|
|
9
|
+
* Returns the intersection point or null if no intersection.
|
|
10
|
+
*/
|
|
11
|
+
static getLineIntersectionPoint(p1a: KritzelPoint, p1b: KritzelPoint, p2a: KritzelPoint, p2b: KritzelPoint): KritzelPoint | null;
|
|
12
|
+
/**
|
|
13
|
+
* Finds the closest intersection point between a line segment (from lineStart to lineEnd)
|
|
14
|
+
* and a polygon. Returns the intersection point closest to lineStart, or null if no intersection.
|
|
15
|
+
*/
|
|
16
|
+
static getLinePolygonIntersection(lineStart: KritzelPoint, lineEnd: KritzelPoint, polygon: KritzelPolygon): KritzelPoint | null;
|
|
7
17
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,10 +11,13 @@ export type * from './components';
|
|
|
11
11
|
export * from './classes/objects/text.class';
|
|
12
12
|
export * from './classes/objects/path.class';
|
|
13
13
|
export * from './classes/objects/image.class';
|
|
14
|
+
export * from './classes/objects/line.class';
|
|
14
15
|
export * from './classes/tools/brush-tool.class';
|
|
16
|
+
export * from './classes/tools/line-tool.class';
|
|
15
17
|
export * from './classes/tools/eraser-tool.class';
|
|
16
18
|
export * from './classes/tools/image-tool.class';
|
|
17
19
|
export * from './classes/tools/text-tool.class';
|
|
20
|
+
export * from './helpers/cursor.helper';
|
|
18
21
|
export * from './classes/tools/selection-tool.class';
|
|
19
22
|
export * from './classes/providers/broadcast-sync-provider.class';
|
|
20
23
|
export * from './classes/providers/indexeddb-sync-provider.class';
|
|
@@ -22,9 +25,12 @@ export * from './classes/providers/websocket-sync-provider.class';
|
|
|
22
25
|
export * from './classes/providers/hocuspocus-sync-provider.class';
|
|
23
26
|
export * from './classes/structures/app-state-map.structure';
|
|
24
27
|
export * from './classes/core/workspace.class';
|
|
28
|
+
export * from './classes/managers/anchor.manager';
|
|
25
29
|
export * from './interfaces/toolbar-control.interface';
|
|
26
30
|
export * from './interfaces/menu-item.interface';
|
|
27
31
|
export * from './interfaces/sync-provider.interface';
|
|
28
32
|
export * from './interfaces/sync-config.interface';
|
|
33
|
+
export * from './interfaces/anchor.interface';
|
|
29
34
|
export * from './configs/default-brush-tool.config';
|
|
30
35
|
export * from './configs/default-text-tool.config';
|
|
36
|
+
export * from './configs/default-line-tool.config';
|