kritzel-stencil 0.0.162 → 0.0.163
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-line-tool.config-D1Ns0NmM.js → default-line-tool.config-DJMYrkSu.js} +340 -9
- package/dist/cjs/default-line-tool.config-DJMYrkSu.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/kritzel-color_22.cjs.entry.js +761 -28
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stencil.cjs.js +1 -1
- package/dist/collection/classes/core/core.class.js +19 -3
- package/dist/collection/classes/core/core.class.js.map +1 -1
- package/dist/collection/classes/core/reviver.class.js +16 -0
- package/dist/collection/classes/core/reviver.class.js.map +1 -1
- package/dist/collection/classes/core/store.class.js +5 -0
- package/dist/collection/classes/core/store.class.js.map +1 -1
- package/dist/collection/classes/core/viewport.class.js +8 -0
- package/dist/collection/classes/core/viewport.class.js.map +1 -1
- package/dist/collection/classes/managers/anchor.manager.js +181 -3
- package/dist/collection/classes/managers/anchor.manager.js.map +1 -1
- package/dist/collection/classes/objects/path.class.js +85 -0
- package/dist/collection/classes/objects/path.class.js.map +1 -1
- package/dist/collection/classes/objects/shape.class.js +372 -0
- package/dist/collection/classes/objects/shape.class.js.map +1 -0
- package/dist/collection/classes/registries/icon-registry.class.js +4 -0
- package/dist/collection/classes/registries/icon-registry.class.js.map +1 -1
- package/dist/collection/classes/tools/brush-tool.class.js +2 -2
- package/dist/collection/classes/tools/brush-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/line-tool.class.js +2 -2
- package/dist/collection/classes/tools/line-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/shape-tool.class.js +204 -0
- package/dist/collection/classes/tools/shape-tool.class.js.map +1 -0
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +17 -6
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +1 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +44 -8
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.css +143 -5
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +76 -12
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js.map +1 -1
- package/dist/collection/configs/default-engine-config.js +1 -1
- package/dist/collection/configs/default-engine-config.js.map +1 -1
- package/dist/collection/configs/default-shape-tool.config.js +26 -0
- package/dist/collection/configs/default-shape-tool.config.js.map +1 -0
- package/dist/collection/enums/shape-type.enum.js +7 -0
- package/dist/collection/enums/shape-type.enum.js.map +1 -0
- package/dist/collection/helpers/geometry.helper.js +55 -0
- package/dist/collection/helpers/geometry.helper.js.map +1 -1
- package/dist/collection/interfaces/toolbar-control.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-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-editor.js +49 -16
- package/dist/components/kritzel-editor.js.map +1 -1
- package/dist/components/kritzel-engine.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-split-button.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-Cqr0Bah5.js → p-5OECjGHq.js} +3 -3
- package/dist/components/{p-Cqr0Bah5.js.map → p-5OECjGHq.js.map} +1 -1
- package/dist/components/{p-CvLFRlQU.js → p-BSBMBjhq.js} +3 -3
- package/dist/components/{p-CvLFRlQU.js.map → p-BSBMBjhq.js.map} +1 -1
- package/dist/components/{p-7_lwv0zQ.js → p-BuS7MM1j.js} +4 -4
- package/dist/components/{p-7_lwv0zQ.js.map → p-BuS7MM1j.js.map} +1 -1
- package/dist/components/{p-CuhOrcET.js → p-CnRfQsIC.js} +838 -22
- package/dist/components/p-CnRfQsIC.js.map +1 -0
- package/dist/components/{p-BixlbUD7.js → p-Cv4BGNPb.js} +6 -2
- package/dist/components/p-Cv4BGNPb.js.map +1 -0
- package/dist/components/{p-dMCB4tJA.js → p-D1YAsWrL.js} +3 -3
- package/dist/components/{p-dMCB4tJA.js.map → p-D1YAsWrL.js.map} +1 -1
- package/dist/components/{p-CDteBYm9.js → p-D8L0t-Ro.js} +3 -3
- package/dist/components/{p-CDteBYm9.js.map → p-D8L0t-Ro.js.map} +1 -1
- package/dist/components/{p-DZ7kxJUx.js → p-DguzZn_x.js} +3 -3
- package/dist/components/{p-DZ7kxJUx.js.map → p-DguzZn_x.js.map} +1 -1
- package/dist/components/{p-sokRZ7Vn.js → p-Dz2XHHqa.js} +145 -5
- package/dist/components/p-Dz2XHHqa.js.map +1 -0
- package/dist/components/{p-CkD1PQQX.js → p-I3iPEDpx.js} +5 -5
- package/dist/components/{p-CkD1PQQX.js.map → p-I3iPEDpx.js.map} +1 -1
- package/dist/components/{p-DKwJJuFb.js → p-tp96UZ0l.js} +83 -19
- package/dist/components/p-tp96UZ0l.js.map +1 -0
- package/dist/esm/{default-line-tool.config-C35m-d1Y.js → default-line-tool.config-C35P3XfD.js} +332 -10
- package/dist/esm/default-line-tool.config-C35P3XfD.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/kritzel-color_22.entry.js +761 -28
- 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/p-9d43b708.entry.js +10 -0
- package/dist/stencil/p-9d43b708.entry.js.map +1 -0
- package/dist/stencil/p-C35P3XfD.js +2 -0
- package/dist/stencil/p-C35P3XfD.js.map +1 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/core/core.class.d.ts +1 -0
- package/dist/types/classes/core/store.class.d.ts +2 -0
- package/dist/types/classes/core/viewport.class.d.ts +6 -0
- package/dist/types/classes/managers/anchor.manager.d.ts +20 -0
- package/dist/types/classes/objects/path.class.d.ts +7 -0
- package/dist/types/classes/objects/shape.class.d.ts +116 -0
- package/dist/types/classes/tools/shape-tool.class.d.ts +37 -0
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +2 -2
- package/dist/types/components/ui/kritzel-controls/kritzel-controls.d.ts +16 -1
- package/dist/types/components.d.ts +5 -5
- package/dist/types/configs/default-shape-tool.config.d.ts +2 -0
- package/dist/types/enums/shape-type.enum.d.ts +5 -0
- package/dist/types/helpers/geometry.helper.d.ts +21 -0
- package/dist/types/interfaces/toolbar-control.interface.d.ts +21 -3
- package/package.json +1 -1
- package/dist/cjs/default-line-tool.config-D1Ns0NmM.js.map +0 -1
- package/dist/components/p-BixlbUD7.js.map +0 -1
- package/dist/components/p-CuhOrcET.js.map +0 -1
- package/dist/components/p-DKwJJuFb.js.map +0 -1
- package/dist/components/p-sokRZ7Vn.js.map +0 -1
- package/dist/esm/default-line-tool.config-C35m-d1Y.js.map +0 -1
- package/dist/stencil/p-C35m-d1Y.js +0 -2
- package/dist/stencil/p-C35m-d1Y.js.map +0 -1
- package/dist/stencil/p-d142ef46.entry.js +0 -10
- package/dist/stencil/p-d142ef46.entry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport.class.js","sourceRoot":"","sources":["../../../src/classes/core/viewport.class.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,MAAM,OAAO,eAAe;IACT,KAAK,CAAc;IACnB,eAAe,CAAa;IAC5B,mBAAmB,CAAa;IAEjD,oBAAoB,GAAW,CAAC,CAAC;IACjC,MAAM,GAAW,CAAC,CAAC;IACnB,MAAM,GAAW,CAAC,CAAC;IAEnB,YAAY,IAAiB,E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7B,CAAC;IAEO,SAAS,CAAC,KAAiB;QACjC,MAAM,QAAQ,GAAG,GAAG,CAAC;QAErB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC;QAChG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC;QAEhG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAEjD,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACtB,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["import { KritzelBaseObject } from '../..';\r\nimport { KritzelMouseButton } from '../../enums/event-button.enum';\r\nimport { KritzelCore } from './core.class';\r\nimport { debounce } from 'lodash';\r\n\r\nexport class KritzelViewport {\r\n private readonly _core: KritzelCore;\r\n private readonly _debounceUpdate: () => void;\r\n private readonly _debounceEndScaling: () => void;\r\n\r\n initialTouchDistance: number = 0;\r\n startX: number = 0;\r\n startY: number = 0;\r\n\r\n constructor(core: KritzelCore, host: HTMLElement) {\r\n this._core = core;\r\n this._core.store.state.host = host;\r\n this._core.store.state.viewportWidth = host.clientWidth;\r\n this._core.store.state.viewportHeight = host.clientHeight;\r\n this._core.store.state.startX = 0;\r\n this._core.store.state.startY = 0;\r\n this._core.store.state.translateX = 0;\r\n this._core.store.state.translateY = 0;\r\n\r\n this._debounceUpdate = debounce(() => {\r\n this._core.updateWorkspaceViewport(\r\n this._core.store.state.translateX, \r\n this._core.store.state.translateY, \r\n this._core.store.state.scale\r\n );\r\n }, 300);\r\n\r\n this._debounceEndScaling = debounce(() => {\r\n this._core.store.state.isScaling = false;\r\n this._core.rerender();\r\n }, 100);\r\n }\r\n\r\n handleResize(): void {\r\n this._core.store.state.viewportWidth = this._core.store.state.host.clientWidth;\r\n this._core.store.state.viewportHeight = this._core.store.state.host.clientHeight;\r\n this._core.store.state.hasViewportChanged = true;\r\n this._core.rerender();\r\n }\r\n\r\n handlePointerDown(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n const adjustedClientX = event.clientX - this._core.store.offsetX;\r\n const adjustedClientY = event.clientY - this._core.store.offsetY;\r\n\r\n if (event.button === KritzelMouseButton.Right) {\r\n this._core.store.state.isPanning = true;\r\n this._core.store.state.startX = adjustedClientX;\r\n this._core.store.state.startY = adjustedClientY;\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n const activePointers = Array.from(this._core.store.state.pointers.values());\r\n\r\n if (activePointers.length === 2) {\r\n const currentPath = this._core.store.currentPath;\r\n if (currentPath) {\r\n this._core.store.state.objects.remove(obj => obj.id === currentPath.id);\r\n }\r\n this._core.store.state.isScaling = true;\r\n\r\n const firstTouchX = activePointers[0].clientX - this._core.store.offsetX;\r\n const firstTouchY = activePointers[0].clientY - this._core.store.offsetY;\r\n\r\n const secondTouchX = activePointers[1].clientX - this._core.store.offsetX;\r\n const secondTouchY = activePointers[1].clientY - this._core.store.offsetY;\r\n\r\n this.initialTouchDistance = Math.sqrt(Math.pow(firstTouchX - secondTouchX, 2) + Math.pow(firstTouchY - secondTouchY, 2));\r\n\r\n this.startX = (firstTouchX + secondTouchX) / 2;\r\n this.startY = (firstTouchY + secondTouchY) / 2;\r\n this._core.rerender();\r\n }\r\n }\r\n }\r\n\r\n handlePointerMove(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n const hostRect = this._core.store.state.host.getBoundingClientRect();\r\n const xRelativeToHost = event.clientX - hostRect.left;\r\n const yRelativeToHost = event.clientY - hostRect.top;\r\n\r\n this._core.store.state.pointerX = (xRelativeToHost - this._core.store.state.translateX) / this._core.store.state.scale;\r\n this._core.store.state.pointerY = (yRelativeToHost - this._core.store.state.translateY) / this._core.store.state.scale;\r\n\r\n if (this._core.store.state.isPanning) {\r\n const dx = xRelativeToHost - this._core.store.state.startX;\r\n const dy = yRelativeToHost - this._core.store.state.startY;\r\n\r\n this._core.store.state.translateX += dx;\r\n this._core.store.state.translateY += dy;\r\n this._core.store.state.startX = xRelativeToHost;\r\n this._core.store.state.startY = yRelativeToHost;\r\n this._core.store.state.hasViewportChanged = true;\r\n this._core.store.state.skipContextMenu = true;\r\n\r\n this._core.rerender();\r\n this._debounceUpdate();\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n const hostRect = this._core.store.state.host.getBoundingClientRect();\r\n const xRelativeToHost = event.clientX - hostRect.left;\r\n const yRelativeToHost = event.clientY - hostRect.top;\r\n\r\n this._core.store.state.pointerX = (xRelativeToHost - this._core.store.state.translateX) / this._core.store.state.scale;\r\n this._core.store.state.pointerY = (yRelativeToHost - this._core.store.state.translateY) / this._core.store.state.scale;\r\n\r\n const activePointers = Array.from(this._core.store.state.pointers.values());\r\n\r\n if (activePointers.length === 2) {\r\n const firstTouchX = activePointers[0].clientX - this._core.store.offsetX;\r\n const firstTouchY = activePointers[0].clientY - this._core.store.offsetY;\r\n\r\n const secondTouchX = activePointers[1].clientX - this._core.store.offsetX;\r\n const secondTouchY = activePointers[1].clientY - this._core.store.offsetY;\r\n\r\n const currentTouchDistance = Math.sqrt(Math.pow(firstTouchX - secondTouchX, 2) + Math.pow(firstTouchY - secondTouchY, 2));\r\n\r\n const midpointX = (firstTouchX + secondTouchX) / 2;\r\n const midpointY = (firstTouchY + secondTouchY) / 2;\r\n\r\n const scaleRatio = currentTouchDistance / this.initialTouchDistance!;\r\n const newScale = this._core.store.state.scale * scaleRatio;\r\n\r\n if (newScale > this._core.store.state.scaleMax || newScale < this._core.store.state.scaleMin) {\r\n this._core.store.state.translateX = this._core.store.state.translateX + midpointX - this.startX;\r\n this._core.store.state.translateY = this._core.store.state.translateY + midpointY - this.startY;\r\n } else {\r\n const translateXAdjustment = (midpointX - this._core.store.state.translateX) * (scaleRatio - 1);\r\n const translateYAdjustment = (midpointY - this._core.store.state.translateY) * (scaleRatio - 1);\r\n\r\n this._core.store.state.translateX = this._core.store.state.translateX + midpointX - this.startX - translateXAdjustment;\r\n this._core.store.state.translateY = this._core.store.state.translateY + midpointY - this.startY - translateYAdjustment;\r\n this._core.store.state.scale = newScale;\r\n\r\n this.initialTouchDistance = currentTouchDistance;\r\n }\r\n\r\n this.startX = midpointX;\r\n this.startY = midpointY;\r\n\r\n this._core.store.state.hasViewportChanged = true;\r\n\r\n this._core.rerender();\r\n this._debounceUpdate();\r\n }\r\n }\r\n }\r\n\r\n handlePointerUp(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (this._core.store.state.isPanning) {\r\n this._core.store.state.isPanning = false;\r\n this._core.rerender();\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n \r\n if (this._core.store.state.pointers.size === 0) {\r\n this._debounceEndScaling();\r\n }\r\n }\r\n }\r\n\r\n handleWheel(event: WheelEvent): void {\r\n event.preventDefault();\r\n\r\n if (event.ctrlKey === true && Math.abs(event.deltaY) > 0 && Math.abs(event.deltaX) === 0) {\r\n this.handleZoom(event);\r\n }\r\n\r\n if (!event.ctrlKey) {\r\n this.handlePan(event);\r\n }\r\n }\r\n\r\n centerInViewport(object: KritzelBaseObject): void {\r\n const { scale, viewportWidth, viewportHeight } = this._core.store.state;\r\n const { x, y, width, height } = object.rotatedBoundingBox;\r\n\r\n const objectCenterX = x + width / 2;\r\n const objectCenterY = y + height / 2;\r\n\r\n this._core.store.state.translateX = viewportWidth / 2 - objectCenterX * scale;\r\n this._core.store.state.translateY = viewportHeight / 2 - objectCenterY * scale;\r\n this._core.store.state.hasViewportChanged = true;\r\n\r\n this._core.rerender();\r\n this._debounceUpdate();\r\n }\r\n\r\n centerFitInViewport(object: KritzelBaseObject): void {\r\n const scaleX = this._core.store.state.viewportWidth / (object.rotatedBoundingBox.width * 1.1);\r\n const scaleY = this._core.store.state.viewportHeight / (object.rotatedBoundingBox.height * 1.1);\r\n const newScale = Math.min(scaleX, scaleY, this._core.store.state.scaleMax);\r\n const clampedScale = Math.max(newScale, this._core.store.state.scaleMin);\r\n\r\n this._core.store.state.scale = clampedScale;\r\n this.centerInViewport(object);\r\n }\r\n\r\n private handleZoom(event: WheelEvent): void {\r\n this._core.store.state.isScaling = true;\r\n const rect = this._core.store.state.host.getBoundingClientRect();\r\n const xRelativeToHost = event.clientX - rect.left;\r\n const yRelativeToHost = event.clientY - rect.top;\r\n\r\n this._core.store.state.pointerX = (xRelativeToHost - this._core.store.state.translateX) / this._core.store.state.scale;\r\n this._core.store.state.pointerY = (yRelativeToHost - this._core.store.state.translateY) / this._core.store.state.scale;\r\n\r\n const rawScaleFactor = 1 + (event.deltaY * -0.012);\r\n const scaleFactor = Math.max(0.8, Math.min(1.2, rawScaleFactor));\r\n const newScale = Math.min(this._core.store.state.scaleMax, Math.max(this._core.store.state.scaleMin, this._core.store.state.scale * scaleFactor));\r\n\r\n const scaleRatio = newScale / this._core.store.state.scale;\r\n const translateXAdjustment = (xRelativeToHost - this._core.store.state.translateX) * (scaleRatio - 1);\r\n const translateYAdjustment = (yRelativeToHost - this._core.store.state.translateY) * (scaleRatio - 1);\r\n\r\n this._core.store.state.scale = newScale;\r\n\r\n this._core.store.state.translateX = this._core.store.state.translateX - translateXAdjustment;\r\n this._core.store.state.translateY = this._core.store.state.translateY - translateYAdjustment;\r\n\r\n this._core.store.state.hasViewportChanged = true;\r\n\r\n this._core.rerender();\r\n this._debounceUpdate();\r\n this._debounceEndScaling();\r\n }\r\n\r\n private handlePan(event: WheelEvent): void {\r\n const panSpeed = 0.8;\r\n\r\n this._core.store.state.translateX = this._core.store.state.translateX - event.deltaX * panSpeed;\r\n this._core.store.state.translateY = this._core.store.state.translateY - event.deltaY * panSpeed;\r\n\r\n this._core.store.state.hasViewportChanged = true;\r\n\r\n this._core.rerender();\r\n this._debounceUpdate();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"viewport.class.js","sourceRoot":"","sources":["../../../src/classes/core/viewport.class.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAiB,MAAM,QAAQ,CAAC;AAEjD,MAAM,OAAO,eAAe;IACT,KAAK,CAAc;IACnB,eAAe,CAA4B;IAC3C,mBAAmB,CAA4B;IAEhE,oBAAoB,GAAW,CAAC,CAAC;IACjC,MAAM,GAAW,CAAC,CAAC;IACnB,MAAM,GAAW,CAAC,CAAC;IAEnB,YAAY,IAAiB,EAAE,IAAiB;QAC9C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QACnC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC;QACxD,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,YAAY,CAAC;QAC1D,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC;QAEtC,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC,GAAG,EAAE;YACnC,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAChC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU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,CAAC,KAAK,CAAC,KAAK,GAAG,QAAQ,CAAC;QAExC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,oBAAoB,CAAC;QAC7F,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,oBAAoB,CAAC;QAE7F,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAEjD,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACtB,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IAEO,SAAS,CAAC,KAAiB;QACjC,MAAM,QAAQ,GAAG,GAAG,CAAC;QAErB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC;QAChG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC;QAEhG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAEjD,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACtB,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["import { KritzelBaseObject } from '../..';\r\nimport { KritzelMouseButton } from '../../enums/event-button.enum';\r\nimport { KritzelCore } from './core.class';\r\nimport { debounce, DebouncedFunc } from 'lodash';\r\n\r\nexport class KritzelViewport {\r\n private readonly _core: KritzelCore;\r\n private readonly _debounceUpdate: DebouncedFunc<() => void>;\r\n private readonly _debounceEndScaling: DebouncedFunc<() => void>;\r\n\r\n initialTouchDistance: number = 0;\r\n startX: number = 0;\r\n startY: number = 0;\r\n\r\n constructor(core: KritzelCore, host: HTMLElement) {\r\n this._core = core;\r\n this._core.store.state.host = host;\r\n this._core.store.state.viewportWidth = host.clientWidth;\r\n this._core.store.state.viewportHeight = host.clientHeight;\r\n this._core.store.state.startX = 0;\r\n this._core.store.state.startY = 0;\r\n this._core.store.state.translateX = 0;\r\n this._core.store.state.translateY = 0;\r\n\r\n this._debounceUpdate = debounce(() => {\r\n this._core.updateWorkspaceViewport(\r\n this._core.store.state.translateX,\r\n this._core.store.state.translateY,\r\n this._core.store.state.scale\r\n );\r\n }, 300);\r\n\r\n this._debounceEndScaling = debounce(() => {\r\n this._core.store.state.isScaling = false;\r\n this._core.rerender();\r\n }, 100);\r\n }\r\n\r\n /**\r\n * Cancels any pending debounced viewport updates.\r\n * Should be called before switching workspaces to prevent the old workspace's\r\n * viewport state from being saved to the new workspace.\r\n */\r\n cancelPendingUpdates(): void {\r\n this._debounceUpdate.cancel();\r\n }\r\n\r\n handleResize(): void {\r\n this._core.store.state.viewportWidth = this._core.store.state.host.clientWidth;\r\n this._core.store.state.viewportHeight = this._core.store.state.host.clientHeight;\r\n this._core.store.state.hasViewportChanged = true;\r\n this._core.rerender();\r\n }\r\n\r\n handlePointerDown(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n const adjustedClientX = event.clientX - this._core.store.offsetX;\r\n const adjustedClientY = event.clientY - this._core.store.offsetY;\r\n\r\n if (event.button === KritzelMouseButton.Right) {\r\n this._core.store.state.isPanning = true;\r\n this._core.store.state.startX = adjustedClientX;\r\n this._core.store.state.startY = adjustedClientY;\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n const activePointers = Array.from(this._core.store.state.pointers.values());\r\n\r\n if (activePointers.length === 2) {\r\n const currentPath = this._core.store.currentPath;\r\n if (currentPath) {\r\n this._core.store.state.objects.remove(obj => obj.id === currentPath.id);\r\n }\r\n this._core.store.state.isScaling = true;\r\n\r\n const firstTouchX = activePointers[0].clientX - this._core.store.offsetX;\r\n const firstTouchY = activePointers[0].clientY - this._core.store.offsetY;\r\n\r\n const secondTouchX = activePointers[1].clientX - this._core.store.offsetX;\r\n const secondTouchY = activePointers[1].clientY - this._core.store.offsetY;\r\n\r\n this.initialTouchDistance = Math.sqrt(Math.pow(firstTouchX - secondTouchX, 2) + Math.pow(firstTouchY - secondTouchY, 2));\r\n\r\n this.startX = (firstTouchX + secondTouchX) / 2;\r\n this.startY = (firstTouchY + secondTouchY) / 2;\r\n this._core.rerender();\r\n }\r\n }\r\n }\r\n\r\n handlePointerMove(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n const hostRect = this._core.store.state.host.getBoundingClientRect();\r\n const xRelativeToHost = event.clientX - hostRect.left;\r\n const yRelativeToHost = event.clientY - hostRect.top;\r\n\r\n this._core.store.state.pointerX = (xRelativeToHost - this._core.store.state.translateX) / this._core.store.state.scale;\r\n this._core.store.state.pointerY = (yRelativeToHost - this._core.store.state.translateY) / this._core.store.state.scale;\r\n\r\n if (this._core.store.state.isPanning) {\r\n const dx = xRelativeToHost - this._core.store.state.startX;\r\n const dy = yRelativeToHost - this._core.store.state.startY;\r\n\r\n this._core.store.state.translateX += dx;\r\n this._core.store.state.translateY += dy;\r\n this._core.store.state.startX = xRelativeToHost;\r\n this._core.store.state.startY = yRelativeToHost;\r\n this._core.store.state.hasViewportChanged = true;\r\n this._core.store.state.skipContextMenu = true;\r\n\r\n this._core.rerender();\r\n this._debounceUpdate();\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n const hostRect = this._core.store.state.host.getBoundingClientRect();\r\n const xRelativeToHost = event.clientX - hostRect.left;\r\n const yRelativeToHost = event.clientY - hostRect.top;\r\n\r\n this._core.store.state.pointerX = (xRelativeToHost - this._core.store.state.translateX) / this._core.store.state.scale;\r\n this._core.store.state.pointerY = (yRelativeToHost - this._core.store.state.translateY) / this._core.store.state.scale;\r\n\r\n const activePointers = Array.from(this._core.store.state.pointers.values());\r\n\r\n if (activePointers.length === 2) {\r\n const firstTouchX = activePointers[0].clientX - this._core.store.offsetX;\r\n const firstTouchY = activePointers[0].clientY - this._core.store.offsetY;\r\n\r\n const secondTouchX = activePointers[1].clientX - this._core.store.offsetX;\r\n const secondTouchY = activePointers[1].clientY - this._core.store.offsetY;\r\n\r\n const currentTouchDistance = Math.sqrt(Math.pow(firstTouchX - secondTouchX, 2) + Math.pow(firstTouchY - secondTouchY, 2));\r\n\r\n const midpointX = (firstTouchX + secondTouchX) / 2;\r\n const midpointY = (firstTouchY + secondTouchY) / 2;\r\n\r\n const scaleRatio = currentTouchDistance / this.initialTouchDistance!;\r\n const newScale = this._core.store.state.scale * scaleRatio;\r\n\r\n if (newScale > this._core.store.state.scaleMax || newScale < this._core.store.state.scaleMin) {\r\n this._core.store.state.translateX = this._core.store.state.translateX + midpointX - this.startX;\r\n this._core.store.state.translateY = this._core.store.state.translateY + midpointY - this.startY;\r\n } else {\r\n const translateXAdjustment = (midpointX - this._core.store.state.translateX) * (scaleRatio - 1);\r\n const translateYAdjustment = (midpointY - this._core.store.state.translateY) * (scaleRatio - 1);\r\n\r\n this._core.store.state.translateX = this._core.store.state.translateX + midpointX - this.startX - translateXAdjustment;\r\n this._core.store.state.translateY = this._core.store.state.translateY + midpointY - this.startY - translateYAdjustment;\r\n this._core.store.state.scale = newScale;\r\n\r\n this.initialTouchDistance = currentTouchDistance;\r\n }\r\n\r\n this.startX = midpointX;\r\n this.startY = midpointY;\r\n\r\n this._core.store.state.hasViewportChanged = true;\r\n\r\n this._core.rerender();\r\n this._debounceUpdate();\r\n }\r\n }\r\n }\r\n\r\n handlePointerUp(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (this._core.store.state.isPanning) {\r\n this._core.store.state.isPanning = false;\r\n this._core.rerender();\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n\r\n if (this._core.store.state.pointers.size === 0) {\r\n this._debounceEndScaling();\r\n }\r\n }\r\n }\r\n\r\n handleWheel(event: WheelEvent): void {\r\n event.preventDefault();\r\n\r\n if (event.ctrlKey === true && Math.abs(event.deltaY) > 0 && Math.abs(event.deltaX) === 0) {\r\n this.handleZoom(event);\r\n }\r\n\r\n if (!event.ctrlKey) {\r\n this.handlePan(event);\r\n }\r\n }\r\n\r\n centerInViewport(object: KritzelBaseObject): void {\r\n const { scale, viewportWidth, viewportHeight } = this._core.store.state;\r\n const { x, y, width, height } = object.rotatedBoundingBox;\r\n\r\n const objectCenterX = x + width / 2;\r\n const objectCenterY = y + height / 2;\r\n\r\n this._core.store.state.translateX = viewportWidth / 2 - objectCenterX * scale;\r\n this._core.store.state.translateY = viewportHeight / 2 - objectCenterY * scale;\r\n this._core.store.state.hasViewportChanged = true;\r\n\r\n this._core.rerender();\r\n this._debounceUpdate();\r\n }\r\n\r\n centerFitInViewport(object: KritzelBaseObject): void {\r\n const scaleX = this._core.store.state.viewportWidth / (object.rotatedBoundingBox.width * 1.1);\r\n const scaleY = this._core.store.state.viewportHeight / (object.rotatedBoundingBox.height * 1.1);\r\n const newScale = Math.min(scaleX, scaleY, this._core.store.state.scaleMax);\r\n const clampedScale = Math.max(newScale, this._core.store.state.scaleMin);\r\n\r\n this._core.store.state.scale = clampedScale;\r\n this.centerInViewport(object);\r\n }\r\n\r\n private handleZoom(event: WheelEvent): void {\r\n this._core.store.state.isScaling = true;\r\n const rect = this._core.store.state.host.getBoundingClientRect();\r\n const xRelativeToHost = event.clientX - rect.left;\r\n const yRelativeToHost = event.clientY - rect.top;\r\n\r\n this._core.store.state.pointerX = (xRelativeToHost - this._core.store.state.translateX) / this._core.store.state.scale;\r\n this._core.store.state.pointerY = (yRelativeToHost - this._core.store.state.translateY) / this._core.store.state.scale;\r\n\r\n const rawScaleFactor = 1 + (event.deltaY * -0.012);\r\n const scaleFactor = Math.max(0.8, Math.min(1.2, rawScaleFactor));\r\n const newScale = Math.min(this._core.store.state.scaleMax, Math.max(this._core.store.state.scaleMin, this._core.store.state.scale * scaleFactor));\r\n\r\n const scaleRatio = newScale / this._core.store.state.scale;\r\n const translateXAdjustment = (xRelativeToHost - this._core.store.state.translateX) * (scaleRatio - 1);\r\n const translateYAdjustment = (yRelativeToHost - this._core.store.state.translateY) * (scaleRatio - 1);\r\n\r\n this._core.store.state.scale = newScale;\r\n\r\n this._core.store.state.translateX = this._core.store.state.translateX - translateXAdjustment;\r\n this._core.store.state.translateY = this._core.store.state.translateY - translateYAdjustment;\r\n\r\n this._core.store.state.hasViewportChanged = true;\r\n\r\n this._core.rerender();\r\n this._debounceUpdate();\r\n this._debounceEndScaling();\r\n }\r\n\r\n private handlePan(event: WheelEvent): void {\r\n const panSpeed = 0.8;\r\n\r\n this._core.store.state.translateX = this._core.store.state.translateX - event.deltaX * panSpeed;\r\n this._core.store.state.translateY = this._core.store.state.translateY - event.deltaY * panSpeed;\r\n\r\n this._core.store.state.hasViewportChanged = true;\r\n\r\n this._core.rerender();\r\n this._debounceUpdate();\r\n }\r\n}\r\n"]}
|
|
@@ -621,7 +621,34 @@ export class KritzelAnchorManager {
|
|
|
621
621
|
const reference = endpoint === 'start'
|
|
622
622
|
? this.lineLocalToWorld(line, line.endX, line.endY)
|
|
623
623
|
: this.lineLocalToWorld(line, line.startX, line.startY);
|
|
624
|
-
|
|
624
|
+
// Check for path object (uses stroke edge detection)
|
|
625
|
+
const pathClipPoint = this.getPathClipPoint(targetObject, reference);
|
|
626
|
+
if (pathClipPoint) {
|
|
627
|
+
const localEdge = this.lineWorldToLocal(line, pathClipPoint.x, pathClipPoint.y);
|
|
628
|
+
const totalLength = Math.sqrt(Math.pow(line.endX - line.startX, 2) +
|
|
629
|
+
Math.pow(line.endY - line.startY, 2));
|
|
630
|
+
const distanceFromStart = Math.sqrt(Math.pow(localEdge.x - line.startX, 2) +
|
|
631
|
+
Math.pow(localEdge.y - line.startY, 2));
|
|
632
|
+
const t = totalLength > 0 ? distanceFromStart / totalLength : endpoint === 'start' ? 0 : 1;
|
|
633
|
+
return {
|
|
634
|
+
localX: localEdge.x,
|
|
635
|
+
localY: localEdge.y,
|
|
636
|
+
worldX: pathClipPoint.x,
|
|
637
|
+
worldY: pathClipPoint.y,
|
|
638
|
+
t,
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
// Check for custom clip polygon (ellipse, triangle shapes)
|
|
642
|
+
const customClipPolygon = this.getClipPolygonForObject(targetObject);
|
|
643
|
+
let edgeIntersection;
|
|
644
|
+
if (customClipPolygon) {
|
|
645
|
+
// Use custom polygon for non-rectangular shapes
|
|
646
|
+
edgeIntersection = KritzelGeometryHelper.getLinePointsArrayIntersection(reference, { x: targetObject.centerX, y: targetObject.centerY }, customClipPolygon);
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
// Fall back to bounding box for rectangles and other objects
|
|
650
|
+
edgeIntersection = KritzelGeometryHelper.getLinePolygonIntersection(reference, { x: targetObject.centerX, y: targetObject.centerY }, targetObject.rotatedPolygon);
|
|
651
|
+
}
|
|
625
652
|
if (!edgeIntersection) {
|
|
626
653
|
return null;
|
|
627
654
|
}
|
|
@@ -640,7 +667,15 @@ export class KritzelAnchorManager {
|
|
|
640
667
|
};
|
|
641
668
|
}
|
|
642
669
|
computeCurvedClipInfo(line, endpoint, targetObject) {
|
|
643
|
-
|
|
670
|
+
// Check for path object (uses stroke edge detection via sampling)
|
|
671
|
+
if (KritzelClassHelper.isInstanceOf(targetObject, 'KritzelPath')) {
|
|
672
|
+
// For curved lines to paths, sample along the curve to find stroke edge
|
|
673
|
+
const path = targetObject;
|
|
674
|
+
return this.findCurveExitPointForPath(line, endpoint, path);
|
|
675
|
+
}
|
|
676
|
+
// Check for custom clip polygon (ellipse, triangle shapes)
|
|
677
|
+
const customClipPolygon = this.getClipPolygonForObject(targetObject);
|
|
678
|
+
const polygonPoints = customClipPolygon ?? this.getPolygonPoints(targetObject.rotatedPolygon);
|
|
644
679
|
const exitPoint = this.findCurveExitPoint(line, endpoint, polygonPoints);
|
|
645
680
|
if (exitPoint) {
|
|
646
681
|
return exitPoint;
|
|
@@ -648,7 +683,13 @@ export class KritzelAnchorManager {
|
|
|
648
683
|
const reference = endpoint === 'start'
|
|
649
684
|
? this.lineLocalToWorld(line, line.endX, line.endY)
|
|
650
685
|
: this.lineLocalToWorld(line, line.startX, line.startY);
|
|
651
|
-
|
|
686
|
+
let fallbackIntersection;
|
|
687
|
+
if (customClipPolygon) {
|
|
688
|
+
fallbackIntersection = KritzelGeometryHelper.getLinePointsArrayIntersection(reference, { x: targetObject.centerX, y: targetObject.centerY }, customClipPolygon);
|
|
689
|
+
}
|
|
690
|
+
else {
|
|
691
|
+
fallbackIntersection = KritzelGeometryHelper.getLinePolygonIntersection(reference, { x: targetObject.centerX, y: targetObject.centerY }, targetObject.rotatedPolygon);
|
|
692
|
+
}
|
|
652
693
|
if (!fallbackIntersection) {
|
|
653
694
|
return null;
|
|
654
695
|
}
|
|
@@ -688,6 +729,119 @@ export class KritzelAnchorManager {
|
|
|
688
729
|
}
|
|
689
730
|
return null;
|
|
690
731
|
}
|
|
732
|
+
/**
|
|
733
|
+
* Finds the exit point for a curved line going to a Path object.
|
|
734
|
+
* Uses distance-to-stroke sampling instead of polygon containment.
|
|
735
|
+
*/
|
|
736
|
+
findCurveExitPointForPath(line, endpoint, path) {
|
|
737
|
+
const steps = 64;
|
|
738
|
+
const initialT = endpoint === 'start' ? 0 : 1;
|
|
739
|
+
const halfStroke = path.strokeWidth / path.scale / 2;
|
|
740
|
+
// Ensure path has computed points
|
|
741
|
+
const pathPoints = this.getPathAdjustedPoints(path);
|
|
742
|
+
if (pathPoints.length < 1) {
|
|
743
|
+
return null;
|
|
744
|
+
}
|
|
745
|
+
// Check if starting point is inside the stroke
|
|
746
|
+
const initialSample = this.evaluateLineAtT(line, initialT);
|
|
747
|
+
let prevInside = this.isPointInPathStroke(initialSample.worldX, initialSample.worldY, pathPoints, halfStroke);
|
|
748
|
+
let prevT = initialT;
|
|
749
|
+
for (let i = 1; i <= steps; i++) {
|
|
750
|
+
const t = endpoint === 'start' ? i / steps : 1 - i / steps;
|
|
751
|
+
const sample = this.evaluateLineAtT(line, t);
|
|
752
|
+
const inside = this.isPointInPathStroke(sample.worldX, sample.worldY, pathPoints, halfStroke);
|
|
753
|
+
if (prevInside && !inside) {
|
|
754
|
+
// Refine using binary search
|
|
755
|
+
const refinedT = this.refineCurveExitParameterForPath(line, pathPoints, halfStroke, prevT, t);
|
|
756
|
+
const refinedPoint = this.evaluateLineAtT(line, refinedT);
|
|
757
|
+
return {
|
|
758
|
+
localX: refinedPoint.localX,
|
|
759
|
+
localY: refinedPoint.localY,
|
|
760
|
+
worldX: refinedPoint.worldX,
|
|
761
|
+
worldY: refinedPoint.worldY,
|
|
762
|
+
t: refinedT,
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
prevInside = inside;
|
|
766
|
+
prevT = t;
|
|
767
|
+
}
|
|
768
|
+
return null;
|
|
769
|
+
}
|
|
770
|
+
refineCurveExitParameterForPath(line, pathPoints, halfStroke, insideT, outsideT) {
|
|
771
|
+
let tInside = insideT;
|
|
772
|
+
let tOutside = outsideT;
|
|
773
|
+
for (let i = 0; i < 8; i++) {
|
|
774
|
+
const mid = (tInside + tOutside) / 2;
|
|
775
|
+
const sample = this.evaluateLineAtT(line, mid);
|
|
776
|
+
const inside = this.isPointInPathStroke(sample.worldX, sample.worldY, pathPoints, halfStroke);
|
|
777
|
+
if (inside) {
|
|
778
|
+
tInside = mid;
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
tOutside = mid;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
return (tInside + tOutside) / 2;
|
|
785
|
+
}
|
|
786
|
+
getPathAdjustedPoints(path) {
|
|
787
|
+
// Access the path's adjusted points through its internal computation
|
|
788
|
+
// We'll need to manually compute them since they're private
|
|
789
|
+
return this.computePathAdjustedPoints(path);
|
|
790
|
+
}
|
|
791
|
+
computePathAdjustedPoints(path) {
|
|
792
|
+
if (!path.points?.length) {
|
|
793
|
+
return [];
|
|
794
|
+
}
|
|
795
|
+
const angle = path.rotation;
|
|
796
|
+
const cos = Math.cos(angle);
|
|
797
|
+
const sin = Math.sin(angle);
|
|
798
|
+
const xs = path.points.map(p => p[0]);
|
|
799
|
+
const ys = path.points.map(p => p[1]);
|
|
800
|
+
const pivot = {
|
|
801
|
+
x: (Math.min(...xs) + Math.max(...xs)) / 2,
|
|
802
|
+
y: (Math.min(...ys) + Math.max(...ys)) / 2,
|
|
803
|
+
};
|
|
804
|
+
const { x: cx, y: cy } = pivot;
|
|
805
|
+
const rotatedPoints = path.points.map(([x, y]) => {
|
|
806
|
+
const dx = x - cx;
|
|
807
|
+
const dy = y - cy;
|
|
808
|
+
return [cx + dx * cos - dy * sin, cy + dx * sin + dy * cos];
|
|
809
|
+
});
|
|
810
|
+
return rotatedPoints.map(([px, py]) => [
|
|
811
|
+
Math.abs(px - path.x) / path.scale + path.translateX,
|
|
812
|
+
Math.abs(py - path.y) / path.scale + path.translateY,
|
|
813
|
+
]);
|
|
814
|
+
}
|
|
815
|
+
isPointInPathStroke(x, y, pathPoints, halfStroke) {
|
|
816
|
+
if (pathPoints.length === 1) {
|
|
817
|
+
const p = pathPoints[0];
|
|
818
|
+
const dx = x - p[0];
|
|
819
|
+
const dy = y - p[1];
|
|
820
|
+
return Math.sqrt(dx * dx + dy * dy) <= halfStroke;
|
|
821
|
+
}
|
|
822
|
+
for (let i = 0; i < pathPoints.length - 1; i++) {
|
|
823
|
+
const p1 = pathPoints[i];
|
|
824
|
+
const p2 = pathPoints[i + 1];
|
|
825
|
+
const dist = this.pointToSegmentDistance(x, y, p1[0], p1[1], p2[0], p2[1]);
|
|
826
|
+
if (dist <= halfStroke) {
|
|
827
|
+
return true;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
return false;
|
|
831
|
+
}
|
|
832
|
+
pointToSegmentDistance(px, py, x1, y1, x2, y2) {
|
|
833
|
+
const dx = x2 - x1;
|
|
834
|
+
const dy = y2 - y1;
|
|
835
|
+
const lengthSquared = dx * dx + dy * dy;
|
|
836
|
+
if (lengthSquared === 0) {
|
|
837
|
+
return Math.sqrt((px - x1) * (px - x1) + (py - y1) * (py - y1));
|
|
838
|
+
}
|
|
839
|
+
let t = ((px - x1) * dx + (py - y1) * dy) / lengthSquared;
|
|
840
|
+
t = Math.max(0, Math.min(1, t));
|
|
841
|
+
const nearestX = x1 + t * dx;
|
|
842
|
+
const nearestY = y1 + t * dy;
|
|
843
|
+
return Math.sqrt((px - nearestX) * (px - nearestX) + (py - nearestY) * (py - nearestY));
|
|
844
|
+
}
|
|
691
845
|
refineCurveExitParameter(line, polygonPoints, insideT, outsideT) {
|
|
692
846
|
let tInside = insideT;
|
|
693
847
|
let tOutside = outsideT;
|
|
@@ -821,6 +975,30 @@ export class KritzelAnchorManager {
|
|
|
821
975
|
getPolygonPoints(polygon) {
|
|
822
976
|
return [polygon.topLeft, polygon.topRight, polygon.bottomRight, polygon.bottomLeft];
|
|
823
977
|
}
|
|
978
|
+
/**
|
|
979
|
+
* Gets the custom clip polygon for an object if it has one.
|
|
980
|
+
* Returns null for objects that should use the default rotatedPolygon.
|
|
981
|
+
*/
|
|
982
|
+
getClipPolygonForObject(object) {
|
|
983
|
+
// Check if the object is a KritzelShape with a custom clip polygon
|
|
984
|
+
if (KritzelClassHelper.isInstanceOf(object, 'KritzelShape')) {
|
|
985
|
+
const shape = object;
|
|
986
|
+
return shape.getClipPolygon();
|
|
987
|
+
}
|
|
988
|
+
// Path objects use getPathClipPoint instead of polygon
|
|
989
|
+
return null;
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Gets the clip point for a Path object (stroke edge intersection).
|
|
993
|
+
* Returns null if the object is not a Path or no intersection found.
|
|
994
|
+
*/
|
|
995
|
+
getPathClipPoint(object, outsidePoint) {
|
|
996
|
+
if (KritzelClassHelper.isInstanceOf(object, 'KritzelPath')) {
|
|
997
|
+
const path = object;
|
|
998
|
+
return path.getClipPoint(outsidePoint);
|
|
999
|
+
}
|
|
1000
|
+
return null;
|
|
1001
|
+
}
|
|
824
1002
|
/**
|
|
825
1003
|
* Converts local line coordinates to world coordinates.
|
|
826
1004
|
*/
|