kritzel-stencil 0.0.141 → 0.0.142
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-BKstgWru.js → index-SaGfCHX3.js} +276 -805
- package/dist/cjs/index-SaGfCHX3.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/kritzel-color_22.cjs.entry.js +114 -77
- package/dist/collection/classes/commands/add-object.command.js +1 -0
- package/dist/collection/classes/commands/add-object.command.js.map +1 -1
- package/dist/collection/classes/commands/base.command.js +2 -0
- package/dist/collection/classes/commands/base.command.js.map +1 -1
- package/dist/collection/classes/commands/remove-object.command.js +1 -3
- package/dist/collection/classes/commands/remove-object.command.js.map +1 -1
- package/dist/collection/classes/commands/update-object.command.js +2 -0
- package/dist/collection/classes/commands/update-object.command.js.map +1 -1
- package/dist/collection/classes/core/command-manager.class.js +51 -0
- package/dist/collection/classes/core/command-manager.class.js.map +1 -0
- package/dist/collection/classes/core/core.class.js +23 -14
- package/dist/collection/classes/core/core.class.js.map +1 -1
- package/dist/collection/classes/core/history.class.js +2 -40
- package/dist/collection/classes/core/history.class.js.map +1 -1
- package/dist/collection/classes/core/viewport.class.js +16 -5
- package/dist/collection/classes/core/viewport.class.js.map +1 -1
- package/dist/collection/classes/handlers/context-menu.handler.js +1 -1
- package/dist/collection/classes/handlers/context-menu.handler.js.map +1 -1
- package/dist/collection/classes/handlers/move.handler.js +11 -6
- package/dist/collection/classes/handlers/move.handler.js.map +1 -1
- package/dist/collection/classes/handlers/resize.handler.js +29 -5
- package/dist/collection/classes/handlers/resize.handler.js.map +1 -1
- package/dist/collection/classes/handlers/rotation.handler.js +2 -2
- package/dist/collection/classes/handlers/rotation.handler.js.map +1 -1
- package/dist/collection/classes/handlers/selection.handler.js +4 -4
- package/dist/collection/classes/handlers/selection.handler.js.map +1 -1
- package/dist/collection/classes/objects/base-object.class.js +15 -14
- package/dist/collection/classes/objects/base-object.class.js.map +1 -1
- package/dist/collection/classes/objects/custom-element.class.js +7 -1
- package/dist/collection/classes/objects/custom-element.class.js.map +1 -1
- package/dist/collection/classes/objects/text.class.js +109 -49
- package/dist/collection/classes/objects/text.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/eraser-tool.class.js +2 -2
- package/dist/collection/classes/tools/eraser-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/image-tool.class.js +1 -1
- package/dist/collection/classes/tools/image-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/selection-tool.class.js +2 -2
- package/dist/collection/classes/tools/selection-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/text-tool.class.js +17 -11
- package/dist/collection/classes/tools/text-tool.class.js.map +1 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.css +1 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +21 -15
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
- package/dist/collection/interfaces/object.interface.js.map +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-editor.js +3 -3
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/{p-ChLi4Ufe.js → p-C8calcQF.js} +3 -3
- package/dist/components/{p-ChLi4Ufe.js.map → p-C8calcQF.js.map} +1 -1
- package/dist/components/{p-BuDVaqTF.js → p-CZk591FE.js} +165 -728
- package/dist/components/p-CZk591FE.js.map +1 -0
- package/dist/components/{p-C4nj29RW.js → p-CziwfEQh.js} +227 -156
- package/dist/components/p-CziwfEQh.js.map +1 -0
- package/dist/esm/{index-D0Q2MKPn.js → index-SIM_s7ed.js} +276 -805
- package/dist/esm/index-SIM_s7ed.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/kritzel-color_22.entry.js +114 -77
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/p-SIM_s7ed.js +2 -0
- package/dist/stencil/p-SIM_s7ed.js.map +1 -0
- package/dist/stencil/p-b697b2c1.entry.js +2 -0
- package/dist/stencil/p-b697b2c1.entry.js.map +1 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/types/classes/commands/add-object.command.d.ts +2 -2
- package/dist/types/classes/commands/base.command.d.ts +2 -1
- package/dist/types/classes/commands/remove-object.command.d.ts +2 -2
- package/dist/types/classes/commands/update-object.command.d.ts +2 -2
- package/dist/types/classes/core/command-manager.class.d.ts +16 -0
- package/dist/types/classes/core/core.class.d.ts +4 -0
- package/dist/types/classes/core/history.class.d.ts +0 -8
- package/dist/types/classes/core/viewport.class.d.ts +2 -0
- package/dist/types/classes/handlers/resize.handler.d.ts +1 -0
- package/dist/types/classes/objects/base-object.class.d.ts +6 -4
- package/dist/types/classes/objects/text.class.d.ts +13 -2
- package/dist/types/interfaces/object.interface.d.ts +1 -3
- package/package.json +1 -1
- package/dist/cjs/index-BKstgWru.js.map +0 -1
- package/dist/components/p-BuDVaqTF.js.map +0 -1
- package/dist/components/p-C4nj29RW.js.map +0 -1
- package/dist/esm/index-D0Q2MKPn.js.map +0 -1
- package/dist/stencil/p-73784709.entry.js +0 -2
- package/dist/stencil/p-73784709.entry.js.map +0 -1
- package/dist/stencil/p-D0Q2MKPn.js +0 -2
- package/dist/stencil/p-D0Q2MKPn.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;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,MAAM,OAAO,eAAe;IACT,KAAK,CAAc;IAEpC,oBAAoB,GAAW,CAAC,CAAC;IACjC,MAAM,GAAW,CAAC,CAAC;IACnB,MAAM,GAAW,CAAC,CAAC;IAEnB,YAAY,IAAiB,EAAE,IA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EvI,UAAU,CAAC,GAAG,EAAE;YACd,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC;QAC3C,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,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,KAAK,CAAC,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACzI,CAAC;CACF","sourcesContent":["import { KritzelBaseObject } from '../..';\r\nimport { KritzelMouseButton } from '../../enums/event-button.enum';\r\nimport { KritzelEventHelper } from '../../helpers/event.helper';\r\nimport { KritzelCore } from './core.class';\r\n\r\nexport class KritzelViewport {\r\n private readonly _core: KritzelCore;\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\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 this._core.store.state.currentPath = null;\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._core.updateWorkspaceViewport(this._core.store.state.translateX, this._core.store.state.translateY, this._core.store.state.scale);\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._core.updateWorkspaceViewport(this._core.store.state.translateX, this._core.store.state.translateY, this._core.store.state.scale);\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 this._core.store.state.isScaling = false;\r\n this._core.rerender();\r\n }\r\n }\r\n\r\n handleWheel(event: WheelEvent): void {\r\n event.preventDefault();\r\n\r\n if (event.ctrlKey === true && KritzelEventHelper.isMainMouseWheel(event)) {\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._core.updateWorkspaceViewport(this._core.store.state.translateX, this._core.store.state.translateY, this._core.store.state.scale);\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 delta = event.deltaY > 0 ? -this._core.store.state.scaleStep * this._core.store.state.scale : this._core.store.state.scaleStep * this._core.store.state.scale;\r\n const newScale = Math.min(this._core.store.state.scaleMax, Math.max(this._core.store.state.scaleMin, this._core.store.state.scale + delta));\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._core.updateWorkspaceViewport(this._core.store.state.translateX, this._core.store.state.translateY, this._core.store.state.scale);\r\n\r\n setTimeout(() => {\r\n this._core.store.state.isScaling = false;\r\n }, 300);\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._core.updateWorkspaceViewport(this._core.store.state.translateX, this._core.store.state.translateY, this._core.store.state.scale);\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;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,MAAM,OAAO,eAAe;IACT,KAAK,CAAc;IACnB,eAAe,CAAa;IAE7C,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,UA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ject } from '../..';\r\nimport { KritzelMouseButton } from '../../enums/event-button.enum';\r\nimport { KritzelEventHelper } from '../../helpers/event.helper';\r\nimport { KritzelCore } from './core.class';\r\n\r\nexport class KritzelViewport {\r\n private readonly _core: KritzelCore;\r\n private readonly _debounceUpdate: () => 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 = this.debounce(() => {\r\n this._core.updateWorkspaceViewport(this._core.store.state.translateX, this._core.store.state.translateY, this._core.store.state.scale);\r\n }, 0);\r\n }\r\n\r\n private debounce(func: () => void, delay: number): () => void {\r\n let timeoutId: ReturnType<typeof setTimeout>;\r\n return () => {\r\n clearTimeout(timeoutId);\r\n timeoutId = setTimeout(func, delay);\r\n };\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 this._core.store.state.currentPath = null;\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 this._core.store.state.isScaling = false;\r\n this._core.rerender();\r\n }\r\n }\r\n\r\n handleWheel(event: WheelEvent): void {\r\n event.preventDefault();\r\n\r\n if (event.ctrlKey === true && KritzelEventHelper.isMainMouseWheel(event)) {\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 delta = event.deltaY > 0 ? -this._core.store.state.scaleStep * this._core.store.state.scale : this._core.store.state.scaleStep * this._core.store.state.scale;\r\n const newScale = Math.min(this._core.store.state.scaleMax, Math.max(this._core.store.state.scaleMin, this._core.store.state.scale + delta));\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\r\n setTimeout(() => {\r\n this._core.store.state.isScaling = false;\r\n }, 300);\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"]}
|
|
@@ -39,7 +39,7 @@ export class KritzelContextMenuHandler extends KritzelBaseHandler {
|
|
|
39
39
|
new RemoveSelectionGroupCommand(this._core, this._core.store.state.selectionGroup),
|
|
40
40
|
new AddSelectionGroupCommand(this._core, this, selectionGroup),
|
|
41
41
|
]);
|
|
42
|
-
this._core.
|
|
42
|
+
this._core.commandManager.executeCommand(batch);
|
|
43
43
|
}
|
|
44
44
|
this._core.store.state.contextMenuItems = this._core.store.state.selectionGroup ? this.objectContextMenuItems : this.globalContextMenuItems;
|
|
45
45
|
let x = event.clientX - this._core.store.offsetX;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu.handler.js","sourceRoot":"","sources":["../../../src/classes/handlers/context-menu.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACz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GroupCommand } from '../commands/add-selection-group.command';\r\nimport { KritzelSelectionGroup } from '../objects/selection-group.class';\r\nimport { KritzelBaseHandler } from './base.handler';\r\nimport { KritzelCore } from '../core/core.class';\r\nimport { KritzelSelectionTool } from '../tools/selection-tool.class';\r\nimport { RemoveSelectionGroupCommand } from '../commands/remove-selection-group.command';\r\nimport { BatchCommand } from '../commands/batch.command';\r\nimport { KrtizelSelectionBox } from '../objects/selection-box.class';\r\n\r\nexport class KritzelContextMenuHandler extends KritzelBaseHandler {\r\n globalContextMenuItems = [];\r\n\r\n objectContextMenuItems = [];\r\n\r\n constructor(core: KritzelCore, globalContextMenuItems: any[], objectContextMenuItems: any[]) {\r\n super(core);\r\n this.globalContextMenuItems = globalContextMenuItems;\r\n this.objectContextMenuItems = objectContextMenuItems;\r\n }\r\n\r\n handleContextMenu(event: PointerEvent): void {\r\n if (!(this._core.store.state.activeTool instanceof KritzelSelectionTool)) {\r\n return;\r\n }\r\n\r\n if (this._core.store.state.skipContextMenu) {\r\n this._core.store.state.skipContextMenu = false;\r\n return;\r\n }\r\n\r\n const selectionTool = this._core.store.state.activeTool as KritzelSelectionTool;\r\n selectionTool?.moveHandler?.cancelPendingDrag();\r\n\r\n if (this._core.store.state.selectionBox) {\r\n this._core.store.state.objectsMap.remove(object => object instanceof KrtizelSelectionBox);\r\n this._core.store.state.selectionBox = null;\r\n this._core.store.state.isSelecting = false;\r\n }\r\n\r\n const selectedObject = this._core.getObjectFromPointerEvent(event, '.object');\r\n\r\n if (selectedObject && !(selectedObject instanceof KritzelSelectionGroup) && !(selectedObject instanceof KrtizelSelectionBox)) {\r\n const selectionGroup = KritzelSelectionGroup.create(this._core);\r\n selectionGroup.addOrRemove(selectedObject);\r\n selectionGroup.isSelected = true;\r\n selectionGroup.rotation = selectedObject.rotation;\r\n\r\n this._core.store.state.isSelecting = false;\r\n\r\n const batch = new BatchCommand(this._core, this, [\r\n new RemoveSelectionGroupCommand(this._core, this._core.store.state.selectionGroup),\r\n new AddSelectionGroupCommand(this._core, this, selectionGroup),\r\n ]);\r\n\r\n this._core.commandManager.executeCommand(batch);\r\n }\r\n\r\n this._core.store.state.contextMenuItems = this._core.store.state.selectionGroup ? this.objectContextMenuItems : this.globalContextMenuItems;\r\n\r\n let x: number = event.clientX - this._core.store.offsetX;\r\n let y: number = event.clientY - this._core.store.offsetY;\r\n\r\n const menuWidthEstimate = 150;\r\n const menuHeightEstimate = 200;\r\n const margin = 10;\r\n\r\n if (x + menuWidthEstimate > window.innerWidth - margin) {\r\n x = window.innerWidth - menuWidthEstimate - margin;\r\n }\r\n\r\n if (y + menuHeightEstimate > window.innerHeight - margin) {\r\n y = window.innerHeight - menuHeightEstimate - margin;\r\n }\r\n\r\n x = Math.max(margin, x);\r\n y = Math.max(margin, y);\r\n\r\n this._core.store.state.contextMenuX = x;\r\n this._core.store.state.contextMenuY = y;\r\n this._core.store.state.isContextMenuVisible = true;\r\n\r\n this._core.store.state.isEnabled = false;\r\n\r\n this._core.rerender();\r\n }\r\n}\r\n"]}
|
|
@@ -76,10 +76,15 @@ export class KritzelMoveHandler extends KritzelBaseHandler {
|
|
|
76
76
|
const clientY = event.clientY - this._core.store.offsetY;
|
|
77
77
|
this.endX = clientX;
|
|
78
78
|
this.endY = clientY;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
const moveDeltaX = Math.abs(clientX - this.startX);
|
|
80
|
+
const moveDeltaY = Math.abs(clientY - this.startY);
|
|
81
|
+
const moveThreshold = 5;
|
|
82
|
+
if (moveDeltaX > moveThreshold || moveDeltaY > moveThreshold) {
|
|
83
|
+
this._core.store.state.selectionGroup.move(clientX, clientY, this.dragStartX, this.dragStartY);
|
|
84
|
+
this.dragStartX = clientX;
|
|
85
|
+
this.dragStartY = clientY;
|
|
86
|
+
this.hasMoved = true;
|
|
87
|
+
}
|
|
83
88
|
}
|
|
84
89
|
}
|
|
85
90
|
if (event.pointerType === 'touch') {
|
|
@@ -114,7 +119,7 @@ export class KritzelMoveHandler extends KritzelBaseHandler {
|
|
|
114
119
|
if (this._core.store.state.isDragging) {
|
|
115
120
|
this._core.store.state.isDragging = false;
|
|
116
121
|
if (this.hasMoved) {
|
|
117
|
-
this._core.
|
|
122
|
+
this._core.commandManager.executeCommand(new MoveSelectionGroupCommand(this._core, this, this.endX, this.endY, this.startX, this.startY, true));
|
|
118
123
|
this._core.store.state.hasObjectsChanged = true;
|
|
119
124
|
}
|
|
120
125
|
}
|
|
@@ -123,7 +128,7 @@ export class KritzelMoveHandler extends KritzelBaseHandler {
|
|
|
123
128
|
if (this._core.store.state.isDragging) {
|
|
124
129
|
this._core.store.state.isDragging = false;
|
|
125
130
|
if (this.hasMoved) {
|
|
126
|
-
this._core.
|
|
131
|
+
this._core.commandManager.executeCommand(new MoveSelectionGroupCommand(this._core, this, this.endX, this.endY, this.startX, this.startY, true));
|
|
127
132
|
this._core.store.state.hasObjectsChanged = true;
|
|
128
133
|
}
|
|
129
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"move.handler.js","sourceRoot":"","sources":["../../../src/classes/handlers/move.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,OAAO,kBAAmB,SAAQ,kBAAkB;IACxD,UAAU,CAAS;IACnB,UAAU,CAAS;IAEnB,MAAM,CAAS;IACf,MAAM,CAAS;IAEf,IAAI,CAAS;IACb,IAAI,CAAS;IAEb,QAAQ,GAAY,KAAK,CAAC;IAClB,gBAAgB,GAAkB,IAAI,CAAC;IAE/C,YAAY,IAAiB;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEO,KAAK;QACX,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,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K,CAAC,UAAU,EAAE,CAAC;gBACtC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC;gBAE1C,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;oBAClB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,yBAAyB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;oBACzI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAClD,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF","sourcesContent":["import { KritzelEventHelper } from '../../helpers/event.helper';\r\nimport { MoveSelectionGroupCommand } from '../commands/move-selection-group.command';\r\nimport { KritzelBaseHandler } from './base.handler';\r\nimport { KritzelCore } from '../core/core.class';\r\nexport class KritzelMoveHandler extends KritzelBaseHandler {\r\n dragStartX: number;\r\n dragStartY: number;\r\n\r\n startX: number;\r\n startY: number;\r\n\r\n endX: number;\r\n endY: number;\r\n\r\n hasMoved: boolean = false;\r\n private trackedPointerId: number | null = null;\r\n\r\n constructor(core: KritzelCore) {\r\n super(core);\r\n }\r\n\r\n private reset() {\r\n this.dragStartX = 0;\r\n this.dragStartY = 0;\r\n this.startX = 0;\r\n this.startY = 0;\r\n this.endX = 0;\r\n this.endY = 0;\r\n this.hasMoved = false;\r\n this.trackedPointerId = null;\r\n }\r\n\r\n cancelPendingDrag(): void {\r\n this._core.store.state.isDragging = false;\r\n this.reset();\r\n }\r\n\r\n handlePointerDown(event: PointerEvent) {\r\n if (event.pointerType === 'mouse') {\r\n if (KritzelEventHelper.isLeftClick(event)) {\r\n if (this._core.store.state.selectionGroup?.isSelected && !this._core.store.state.isResizeHandleSelected && !this._core.store.state.isRotationHandleSelected) {\r\n const clientX = event.clientX - this._core.store.offsetX;\r\n const clientY = event.clientY - this._core.store.offsetY;\r\n\r\n this._core.store.state.isDragging = true;\r\n this.dragStartX = clientX;\r\n this.dragStartY = clientY;\r\n this.startX = this.dragStartX;\r\n this.startY = this.dragStartY;\r\n this.trackedPointerId = event.pointerId;\r\n } else {\r\n this.trackedPointerId = null;\r\n }\r\n } else {\r\n this.trackedPointerId = null;\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 (this._core.store.state.pointers.size === 1) {\r\n if (this._core.store.state.selectionGroup?.isSelected && !this._core.store.state.isResizeHandleSelected && !this._core.store.state.isRotationHandleSelected) {\r\n const x = Math.round(activePointers[0].clientX - this._core.store.offsetX);\r\n const y = Math.round(activePointers[0].clientY - this._core.store.offsetY);\r\n\r\n this.dragStartX = x;\r\n this.dragStartY = y;\r\n this.startX = x;\r\n this.startY = y;\r\n this.trackedPointerId = event.pointerId;\r\n } else {\r\n this.trackedPointerId = null;\r\n }\r\n }\r\n }\r\n }\r\n\r\n handlePointerMove(event: PointerEvent) {\r\n if (this.trackedPointerId === null || this.trackedPointerId !== event.pointerId) {\r\n return;\r\n }\r\n\r\n if (event.pointerType === 'mouse') {\r\n if (this._core.store.state.isDragging && this._core.store.state.selectionGroup) {\r\n const clientX = event.clientX - this._core.store.offsetX;\r\n const clientY = event.clientY - this._core.store.offsetY;\r\n\r\n this.endX = clientX;\r\n this.endY = clientY;\r\n this._core.store.state.selectionGroup.move(clientX, clientY, this.dragStartX, this.dragStartY);\r\n this.dragStartX = clientX;\r\n this.dragStartY = clientY;\r\n this.hasMoved = true;\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 (\r\n this._core.store.state.pointers.size === 1 &&\r\n this._core.store.state.selectionGroup &&\r\n !this._core.store.state.isResizeHandleSelected &&\r\n !this._core.store.state.isRotationHandleSelected\r\n ) {\r\n const x = Math.round(activePointers[0].clientX - this._core.store.offsetX);\r\n const y = Math.round(activePointers[0].clientY - this._core.store.offsetY);\r\n\r\n this._core.store.state.isDragging = true;\r\n this.endX = x;\r\n this.endY = y;\r\n \r\n const moveDeltaX = Math.abs(x - this.startX);\r\n const moveDeltaY = Math.abs(y - this.startY);\r\n const moveThreshold = 5;\r\n \r\n if (moveDeltaX > moveThreshold || moveDeltaY > moveThreshold) {\r\n clearTimeout(this._core.store.state.longTouchTimeout);\r\n \r\n this._core.store.state.selectionGroup.move(x, y, this.dragStartX, this.dragStartY);\r\n this.dragStartX = x;\r\n this.dragStartY = y;\r\n this.hasMoved = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n handlePointerUp(event: PointerEvent) {\r\n if (this.trackedPointerId === null || this.trackedPointerId !== event.pointerId) {\r\n return;\r\n }\r\n\r\n if (event.pointerType === 'mouse') {\r\n if (this._core.store.state.isDragging) {\r\n this._core.store.state.isDragging = false;\r\n\r\n if (this.hasMoved) {\r\n this._core.history.executeCommand(new MoveSelectionGroupCommand(this._core, this, this.endX, this.endY, this.startX, this.startY, true));\r\n this._core.store.state.hasObjectsChanged = true;\r\n }\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n if (this._core.store.state.isDragging) {\r\n this._core.store.state.isDragging = false;\r\n\r\n if (this.hasMoved) {\r\n this._core.history.executeCommand(new MoveSelectionGroupCommand(this._core, this, this.endX, this.endY, this.startX, this.startY, true));\r\n this._core.store.state.hasObjectsChanged = true;\r\n }\r\n }\r\n }\r\n\r\n this.reset();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"move.handler.js","sourceRoot":"","sources":["../../../src/classes/handlers/move.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM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,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF","sourcesContent":["import { KritzelEventHelper } from '../../helpers/event.helper';\r\nimport { MoveSelectionGroupCommand } from '../commands/move-selection-group.command';\r\nimport { KritzelBaseHandler } from './base.handler';\r\nimport { KritzelCore } from '../core/core.class';\r\nexport class KritzelMoveHandler extends KritzelBaseHandler {\r\n dragStartX: number;\r\n dragStartY: number;\r\n\r\n startX: number;\r\n startY: number;\r\n\r\n endX: number;\r\n endY: number;\r\n\r\n hasMoved: boolean = false;\r\n private trackedPointerId: number | null = null;\r\n\r\n constructor(core: KritzelCore) {\r\n super(core);\r\n }\r\n\r\n private reset() {\r\n this.dragStartX = 0;\r\n this.dragStartY = 0;\r\n this.startX = 0;\r\n this.startY = 0;\r\n this.endX = 0;\r\n this.endY = 0;\r\n this.hasMoved = false;\r\n this.trackedPointerId = null;\r\n }\r\n\r\n cancelPendingDrag(): void {\r\n this._core.store.state.isDragging = false;\r\n this.reset();\r\n }\r\n\r\n handlePointerDown(event: PointerEvent) {\r\n if (event.pointerType === 'mouse') {\r\n if (KritzelEventHelper.isLeftClick(event)) {\r\n if (this._core.store.state.selectionGroup?.isSelected && !this._core.store.state.isResizeHandleSelected && !this._core.store.state.isRotationHandleSelected) {\r\n const clientX = event.clientX - this._core.store.offsetX;\r\n const clientY = event.clientY - this._core.store.offsetY;\r\n\r\n this._core.store.state.isDragging = true;\r\n this.dragStartX = clientX;\r\n this.dragStartY = clientY;\r\n this.startX = this.dragStartX;\r\n this.startY = this.dragStartY;\r\n this.trackedPointerId = event.pointerId;\r\n } else {\r\n this.trackedPointerId = null;\r\n }\r\n } else {\r\n this.trackedPointerId = null;\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 (this._core.store.state.pointers.size === 1) {\r\n if (this._core.store.state.selectionGroup?.isSelected && !this._core.store.state.isResizeHandleSelected && !this._core.store.state.isRotationHandleSelected) {\r\n const x = Math.round(activePointers[0].clientX - this._core.store.offsetX);\r\n const y = Math.round(activePointers[0].clientY - this._core.store.offsetY);\r\n\r\n this.dragStartX = x;\r\n this.dragStartY = y;\r\n this.startX = x;\r\n this.startY = y;\r\n this.trackedPointerId = event.pointerId;\r\n } else {\r\n this.trackedPointerId = null;\r\n }\r\n }\r\n }\r\n }\r\n\r\n handlePointerMove(event: PointerEvent) {\r\n if (this.trackedPointerId === null || this.trackedPointerId !== event.pointerId) {\r\n return;\r\n }\r\n\r\n if (event.pointerType === 'mouse') {\r\n if (this._core.store.state.isDragging && this._core.store.state.selectionGroup) {\r\n const clientX = event.clientX - this._core.store.offsetX;\r\n const clientY = event.clientY - this._core.store.offsetY;\r\n\r\n this.endX = clientX;\r\n this.endY = clientY;\r\n \r\n const moveDeltaX = Math.abs(clientX - this.startX);\r\n const moveDeltaY = Math.abs(clientY - this.startY);\r\n const moveThreshold = 5;\r\n \r\n if (moveDeltaX > moveThreshold || moveDeltaY > moveThreshold) {\r\n this._core.store.state.selectionGroup.move(clientX, clientY, this.dragStartX, this.dragStartY);\r\n this.dragStartX = clientX;\r\n this.dragStartY = clientY;\r\n this.hasMoved = true;\r\n }\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 (\r\n this._core.store.state.pointers.size === 1 &&\r\n this._core.store.state.selectionGroup &&\r\n !this._core.store.state.isResizeHandleSelected &&\r\n !this._core.store.state.isRotationHandleSelected\r\n ) {\r\n const x = Math.round(activePointers[0].clientX - this._core.store.offsetX);\r\n const y = Math.round(activePointers[0].clientY - this._core.store.offsetY);\r\n\r\n this._core.store.state.isDragging = true;\r\n this.endX = x;\r\n this.endY = y;\r\n \r\n const moveDeltaX = Math.abs(x - this.startX);\r\n const moveDeltaY = Math.abs(y - this.startY);\r\n const moveThreshold = 5;\r\n \r\n if (moveDeltaX > moveThreshold || moveDeltaY > moveThreshold) {\r\n clearTimeout(this._core.store.state.longTouchTimeout);\r\n \r\n this._core.store.state.selectionGroup.move(x, y, this.dragStartX, this.dragStartY);\r\n this.dragStartX = x;\r\n this.dragStartY = y;\r\n this.hasMoved = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n handlePointerUp(event: PointerEvent) {\r\n if (this.trackedPointerId === null || this.trackedPointerId !== event.pointerId) {\r\n return;\r\n }\r\n\r\n if (event.pointerType === 'mouse') {\r\n if (this._core.store.state.isDragging) {\r\n this._core.store.state.isDragging = false;\r\n\r\n if (this.hasMoved) {\r\n this._core.commandManager.executeCommand(new MoveSelectionGroupCommand(this._core, this, this.endX, this.endY, this.startX, this.startY, true));\r\n this._core.store.state.hasObjectsChanged = true;\r\n }\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n if (this._core.store.state.isDragging) {\r\n this._core.store.state.isDragging = false;\r\n\r\n if (this.hasMoved) {\r\n this._core.commandManager.executeCommand(new MoveSelectionGroupCommand(this._core, this, this.endX, this.endY, this.startX, this.startY, true));\r\n this._core.store.state.hasObjectsChanged = true;\r\n }\r\n }\r\n }\r\n\r\n this.reset();\r\n }\r\n}\r\n"]}
|
|
@@ -7,6 +7,7 @@ export class KritzelResizeHandler extends KritzelBaseHandler {
|
|
|
7
7
|
initialMouseY = 0;
|
|
8
8
|
initialSize = { x: 0, y: 0, width: 0, height: 0 };
|
|
9
9
|
newSize = { x: 0, y: 0, width: 0, height: 0 };
|
|
10
|
+
hasResized = false;
|
|
10
11
|
constructor(core) {
|
|
11
12
|
super(core);
|
|
12
13
|
}
|
|
@@ -15,6 +16,7 @@ export class KritzelResizeHandler extends KritzelBaseHandler {
|
|
|
15
16
|
this.initialMouseY = 0;
|
|
16
17
|
this.initialSize = { x: 0, y: 0, width: 0, height: 0 };
|
|
17
18
|
this.newSize = { x: 0, y: 0, width: 0, height: 0 };
|
|
19
|
+
this.hasResized = false;
|
|
18
20
|
}
|
|
19
21
|
handlePointerDown(event) {
|
|
20
22
|
if (event.pointerType === 'mouse') {
|
|
@@ -61,6 +63,15 @@ export class KritzelResizeHandler extends KritzelBaseHandler {
|
|
|
61
63
|
const clientY = event.clientY - this._core.store.offsetY;
|
|
62
64
|
const dx = clientX - this.initialMouseX;
|
|
63
65
|
const dy = clientY - this.initialMouseY;
|
|
66
|
+
const resizeDeltaX = Math.abs(dx);
|
|
67
|
+
const resizeDeltaY = Math.abs(dy);
|
|
68
|
+
const resizeThreshold = 5;
|
|
69
|
+
if (resizeDeltaX > resizeThreshold || resizeDeltaY > resizeThreshold) {
|
|
70
|
+
this.hasResized = true;
|
|
71
|
+
}
|
|
72
|
+
if (!this.hasResized) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
64
75
|
switch (this._core.store.state.resizeHandleType) {
|
|
65
76
|
case KritzelHandleType.TopLeft:
|
|
66
77
|
this.newSize.width = this.initialSize.width - dx;
|
|
@@ -101,6 +112,16 @@ export class KritzelResizeHandler extends KritzelBaseHandler {
|
|
|
101
112
|
const clientY = Math.round(oneFingerTouch.clientY - this._core.store.offsetY);
|
|
102
113
|
const dx = clientX - this.initialMouseX;
|
|
103
114
|
const dy = clientY - this.initialMouseY;
|
|
115
|
+
const resizeDeltaX = Math.abs(dx);
|
|
116
|
+
const resizeDeltaY = Math.abs(dy);
|
|
117
|
+
const resizeThreshold = 5;
|
|
118
|
+
if (resizeDeltaX > resizeThreshold || resizeDeltaY > resizeThreshold) {
|
|
119
|
+
clearTimeout(this._core.store.state.longTouchTimeout);
|
|
120
|
+
this.hasResized = true;
|
|
121
|
+
}
|
|
122
|
+
if (!this.hasResized) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
104
125
|
switch (this._core.store.state.resizeHandleType) {
|
|
105
126
|
case KritzelHandleType.TopLeft:
|
|
106
127
|
this.newSize.width = this.initialSize.width - dx;
|
|
@@ -128,24 +149,27 @@ export class KritzelResizeHandler extends KritzelBaseHandler {
|
|
|
128
149
|
break;
|
|
129
150
|
}
|
|
130
151
|
this._core.store.state.selectionGroup.resize(this.newSize.x, this.newSize.y, this.newSize.width, this.newSize.height);
|
|
131
|
-
clearTimeout(this._core.store.state.longTouchTimeout);
|
|
132
152
|
}
|
|
133
153
|
}
|
|
134
154
|
}
|
|
135
155
|
handlePointerUp(event) {
|
|
136
156
|
if (event.pointerType === 'mouse') {
|
|
137
157
|
if (this._core.store.state.isResizing) {
|
|
138
|
-
this._core.history.executeCommand(new ResizeSelectionGroupCommand(this._core, this, structuredClone(this.initialSize), structuredClone(this.newSize)));
|
|
139
158
|
this._core.store.state.isResizing = false;
|
|
140
|
-
this.
|
|
159
|
+
if (this.hasResized) {
|
|
160
|
+
this._core.commandManager.executeCommand(new ResizeSelectionGroupCommand(this._core, this, structuredClone(this.initialSize), structuredClone(this.newSize)));
|
|
161
|
+
this._core.store.state.hasObjectsChanged = true;
|
|
162
|
+
}
|
|
141
163
|
this.reset();
|
|
142
164
|
}
|
|
143
165
|
}
|
|
144
166
|
if (event.pointerType === 'touch') {
|
|
145
167
|
if (this._core.store.state.isResizing) {
|
|
146
|
-
this._core.history.executeCommand(new ResizeSelectionGroupCommand(this._core, this, structuredClone(this.initialSize), structuredClone(this.newSize)));
|
|
147
168
|
this._core.store.state.isResizing = false;
|
|
148
|
-
this.
|
|
169
|
+
if (this.hasResized) {
|
|
170
|
+
this._core.commandManager.executeCommand(new ResizeSelectionGroupCommand(this._core, this, structuredClone(this.initialSize), structuredClone(this.newSize)));
|
|
171
|
+
this._core.store.state.hasObjectsChanged = true;
|
|
172
|
+
}
|
|
149
173
|
this.reset();
|
|
150
174
|
clearTimeout(this._core.store.state.longTouchTimeout);
|
|
151
175
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resize.handler.js","sourceRoot":"","sources":["../../../src/classes/handlers/resize.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,2B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AAC;gBAC1C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAEhD,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,CAAC;QACH,CAAC;QAED,IAAI,KAAK,CAAC,WAAW,KAAK,OAAO,EAAE,CAAC;YAClC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;gBACtC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,2BAA2B,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;gBAEvJ,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC;gBAC1C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAEhD,IAAI,CAAC,KAAK,EAAE,CAAC;gBAEb,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACxD,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import { KritzelHandleType } from '../../enums/handle-type.enum';\r\nimport { KritzelEventHelper } from '../../helpers/event.helper';\r\nimport { ResizeSelectionGroupCommand } from '../commands/resize-selection-group.command';\r\nimport { KritzelCore } from '../core/core.class';\r\nimport { KritzelBaseHandler } from './base.handler';\r\n\r\nexport class KritzelResizeHandler extends KritzelBaseHandler {\r\n initialMouseX: number = 0;\r\n initialMouseY: number = 0;\r\n\r\n initialSize: { x: number; y: number; width: number; height: number } = { x: 0, y: 0, width: 0, height: 0 };\r\n\r\n newSize: { x: number; y: number; width: number; height: number } = { x: 0, y: 0, width: 0, height: 0 };\r\n\r\n constructor(core: KritzelCore) {\r\n super(core);\r\n }\r\n\r\n private reset() {\r\n this.initialMouseX = 0;\r\n this.initialMouseY = 0;\r\n this.initialSize = { x: 0, y: 0, width: 0, height: 0 };\r\n this.newSize = { x: 0, y: 0, width: 0, height: 0 };\r\n }\r\n\r\n handlePointerDown(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (KritzelEventHelper.isLeftClick(event)) {\r\n if (this._core.store.state.selectionGroup && this._core.store.state.isResizeHandleSelected) {\r\n const clientX = event.clientX - this._core.store.offsetX;\r\n const clientY = event.clientY - this._core.store.offsetY;\r\n\r\n this._core.store.state.isResizing = true;\r\n this.initialMouseX = clientX;\r\n this.initialMouseY = clientY;\r\n this.initialSize.width = this._core.store.state.selectionGroup.width;\r\n this.initialSize.height = this._core.store.state.selectionGroup.height;\r\n this.initialSize.x = this._core.store.state.selectionGroup.translateX;\r\n this.initialSize.y = this._core.store.state.selectionGroup.translateY;\r\n }\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 const firstTouch = activePointers[0];\r\n\r\n if (!firstTouch) {\r\n return;\r\n }\r\n\r\n if (activePointers.length === 1) {\r\n if (this._core.store.state.selectionGroup && this._core.store.state.isResizeHandleSelected) {\r\n const clientX = Math.round(firstTouch.clientX - this._core.store.offsetX);\r\n const clientY = Math.round(firstTouch.clientY - this._core.store.offsetY);\r\n\r\n this._core.store.state.isResizing = true;\r\n this.initialMouseX = clientX;\r\n this.initialMouseY = clientY;\r\n this.initialSize.width = this._core.store.state.selectionGroup.width;\r\n this.initialSize.height = this._core.store.state.selectionGroup.height;\r\n this.initialSize.x = this._core.store.state.selectionGroup.translateX;\r\n this.initialSize.y = this._core.store.state.selectionGroup.translateY;\r\n\r\n clearTimeout(this._core.store.state.longTouchTimeout);\r\n }\r\n }\r\n }\r\n }\r\n\r\n handlePointerMove(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (this._core.store.state.isResizing && this._core.store.state.selectionGroup) {\r\n const clientX = event.clientX - this._core.store.offsetX;\r\n const clientY = event.clientY - this._core.store.offsetY;\r\n\r\n const dx = clientX - this.initialMouseX;\r\n const dy = clientY - this.initialMouseY;\r\n\r\n switch (this._core.store.state.resizeHandleType) {\r\n case KritzelHandleType.TopLeft:\r\n this.newSize.width = this.initialSize.width - dx;\r\n this.newSize.height = this.initialSize.height - dy;\r\n this.newSize.x = dx / this._core.store.state.scale + this.initialSize.x;\r\n this.newSize.y = dy / this._core.store.state.scale + this.initialSize.y;\r\n break;\r\n case KritzelHandleType.TopRight:\r\n this.newSize.width = this.initialSize.width + dx;\r\n this.newSize.height = this.initialSize.height - dy;\r\n this.newSize.x = this.initialSize.x;\r\n this.newSize.y = dy / this._core.store.state.scale + this.initialSize.y;\r\n break;\r\n case KritzelHandleType.BottomLeft:\r\n this.newSize.width = this.initialSize.width - dx;\r\n this.newSize.height = this.initialSize.height + dy;\r\n this.newSize.x = dx / this._core.store.state.scale + this.initialSize.x;\r\n this.newSize.y = this.initialSize.y;\r\n break;\r\n case KritzelHandleType.BottomRight:\r\n this.newSize.width = this.initialSize.width + dx;\r\n this.newSize.height = this.initialSize.height + dy;\r\n this.newSize.x = this.initialSize.x;\r\n this.newSize.y = this.initialSize.y;\r\n break;\r\n }\r\n\r\n this._core.store.state.selectionGroup.resize(this.newSize.x, this.newSize.y, this.newSize.width, this.newSize.height);\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 const oneFingerTouch = activePointers[0];\r\n\r\n if (!oneFingerTouch) {\r\n return;\r\n }\r\n\r\n if (this._core.store.state.isResizing && this._core.store.state.selectionGroup) {\r\n const clientX = Math.round(oneFingerTouch.clientX - this._core.store.offsetX);\r\n const clientY = Math.round(oneFingerTouch.clientY - this._core.store.offsetY);\r\n\r\n const dx = clientX - this.initialMouseX;\r\n const dy = clientY - this.initialMouseY;\r\n\r\n switch (this._core.store.state.resizeHandleType) {\r\n case KritzelHandleType.TopLeft:\r\n this.newSize.width = this.initialSize.width - dx;\r\n this.newSize.height = this.initialSize.height - dy;\r\n this.newSize.x = dx / this._core.store.state.scale + this.initialSize.x;\r\n this.newSize.y = dy / this._core.store.state.scale + this.initialSize.y;\r\n break;\r\n case KritzelHandleType.TopRight:\r\n this.newSize.width = this.initialSize.width + dx;\r\n this.newSize.height = this.initialSize.height - dy;\r\n this.newSize.x = this.initialSize.x;\r\n this.newSize.y = dy / this._core.store.state.scale + this.initialSize.y;\r\n break;\r\n case KritzelHandleType.BottomLeft:\r\n this.newSize.width = this.initialSize.width - dx;\r\n this.newSize.height = this.initialSize.height + dy;\r\n this.newSize.x = dx / this._core.store.state.scale + this.initialSize.x;\r\n this.newSize.y = this.initialSize.y;\r\n break;\r\n case KritzelHandleType.BottomRight:\r\n this.newSize.width = this.initialSize.width + dx;\r\n this.newSize.height = this.initialSize.height + dy;\r\n this.newSize.x = this.initialSize.x;\r\n this.newSize.y = this.initialSize.y;\r\n break;\r\n }\r\n\r\n this._core.store.state.selectionGroup.resize(this.newSize.x, this.newSize.y, this.newSize.width, this.newSize.height);\r\n\r\n clearTimeout(this._core.store.state.longTouchTimeout);\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.isResizing) {\r\n this._core.history.executeCommand(new ResizeSelectionGroupCommand(this._core, this, structuredClone(this.initialSize), structuredClone(this.newSize)));\r\n\r\n this._core.store.state.isResizing = false;\r\n this._core.store.state.hasObjectsChanged = true;\r\n\r\n this.reset();\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n if (this._core.store.state.isResizing) {\r\n this._core.history.executeCommand(new ResizeSelectionGroupCommand(this._core, this, structuredClone(this.initialSize), structuredClone(this.newSize)));\r\n\r\n this._core.store.state.isResizing = false;\r\n this._core.store.state.hasObjectsChanged = true;\r\n\r\n this.reset();\r\n\r\n clearTimeout(this._core.store.state.longTou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AK,EAAE,CAAC;YACf,CAAC;QACH,CAAC;QAED,IAAI,KAAK,CAAC,WAAW,KAAK,OAAO,EAAE,CAAC;YAClC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;gBACtC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC;gBAE1C,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;oBACpB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,IAAI,2BAA2B,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;oBAC9J,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAClD,CAAC;gBAED,IAAI,CAAC,KAAK,EAAE,CAAC;gBAEb,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACxD,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import { KritzelHandleType } from '../../enums/handle-type.enum';\r\nimport { KritzelEventHelper } from '../../helpers/event.helper';\r\nimport { ResizeSelectionGroupCommand } from '../commands/resize-selection-group.command';\r\nimport { KritzelCore } from '../core/core.class';\r\nimport { KritzelBaseHandler } from './base.handler';\r\n\r\nexport class KritzelResizeHandler extends KritzelBaseHandler {\r\n initialMouseX: number = 0;\r\n initialMouseY: number = 0;\r\n\r\n initialSize: { x: number; y: number; width: number; height: number } = { x: 0, y: 0, width: 0, height: 0 };\r\n\r\n newSize: { x: number; y: number; width: number; height: number } = { x: 0, y: 0, width: 0, height: 0 };\r\n\r\n hasResized: boolean = false;\r\n\r\n constructor(core: KritzelCore) {\r\n super(core);\r\n }\r\n\r\n private reset() {\r\n this.initialMouseX = 0;\r\n this.initialMouseY = 0;\r\n this.initialSize = { x: 0, y: 0, width: 0, height: 0 };\r\n this.newSize = { x: 0, y: 0, width: 0, height: 0 };\r\n this.hasResized = false;\r\n }\r\n\r\n handlePointerDown(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (KritzelEventHelper.isLeftClick(event)) {\r\n if (this._core.store.state.selectionGroup && this._core.store.state.isResizeHandleSelected) {\r\n const clientX = event.clientX - this._core.store.offsetX;\r\n const clientY = event.clientY - this._core.store.offsetY;\r\n\r\n this._core.store.state.isResizing = true;\r\n this.initialMouseX = clientX;\r\n this.initialMouseY = clientY;\r\n this.initialSize.width = this._core.store.state.selectionGroup.width;\r\n this.initialSize.height = this._core.store.state.selectionGroup.height;\r\n this.initialSize.x = this._core.store.state.selectionGroup.translateX;\r\n this.initialSize.y = this._core.store.state.selectionGroup.translateY;\r\n }\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 const firstTouch = activePointers[0];\r\n\r\n if (!firstTouch) {\r\n return;\r\n }\r\n\r\n if (activePointers.length === 1) {\r\n if (this._core.store.state.selectionGroup && this._core.store.state.isResizeHandleSelected) {\r\n const clientX = Math.round(firstTouch.clientX - this._core.store.offsetX);\r\n const clientY = Math.round(firstTouch.clientY - this._core.store.offsetY);\r\n\r\n this._core.store.state.isResizing = true;\r\n this.initialMouseX = clientX;\r\n this.initialMouseY = clientY;\r\n this.initialSize.width = this._core.store.state.selectionGroup.width;\r\n this.initialSize.height = this._core.store.state.selectionGroup.height;\r\n this.initialSize.x = this._core.store.state.selectionGroup.translateX;\r\n this.initialSize.y = this._core.store.state.selectionGroup.translateY;\r\n\r\n clearTimeout(this._core.store.state.longTouchTimeout);\r\n }\r\n }\r\n }\r\n }\r\n\r\n handlePointerMove(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (this._core.store.state.isResizing && this._core.store.state.selectionGroup) {\r\n const clientX = event.clientX - this._core.store.offsetX;\r\n const clientY = event.clientY - this._core.store.offsetY;\r\n\r\n const dx = clientX - this.initialMouseX;\r\n const dy = clientY - this.initialMouseY;\r\n\r\n const resizeDeltaX = Math.abs(dx);\r\n const resizeDeltaY = Math.abs(dy);\r\n const resizeThreshold = 5;\r\n\r\n if (resizeDeltaX > resizeThreshold || resizeDeltaY > resizeThreshold) {\r\n this.hasResized = true;\r\n }\r\n\r\n if (!this.hasResized) {\r\n return;\r\n }\r\n\r\n switch (this._core.store.state.resizeHandleType) {\r\n case KritzelHandleType.TopLeft:\r\n this.newSize.width = this.initialSize.width - dx;\r\n this.newSize.height = this.initialSize.height - dy;\r\n this.newSize.x = dx / this._core.store.state.scale + this.initialSize.x;\r\n this.newSize.y = dy / this._core.store.state.scale + this.initialSize.y;\r\n break;\r\n case KritzelHandleType.TopRight:\r\n this.newSize.width = this.initialSize.width + dx;\r\n this.newSize.height = this.initialSize.height - dy;\r\n this.newSize.x = this.initialSize.x;\r\n this.newSize.y = dy / this._core.store.state.scale + this.initialSize.y;\r\n break;\r\n case KritzelHandleType.BottomLeft:\r\n this.newSize.width = this.initialSize.width - dx;\r\n this.newSize.height = this.initialSize.height + dy;\r\n this.newSize.x = dx / this._core.store.state.scale + this.initialSize.x;\r\n this.newSize.y = this.initialSize.y;\r\n break;\r\n case KritzelHandleType.BottomRight:\r\n this.newSize.width = this.initialSize.width + dx;\r\n this.newSize.height = this.initialSize.height + dy;\r\n this.newSize.x = this.initialSize.x;\r\n this.newSize.y = this.initialSize.y;\r\n break;\r\n }\r\n\r\n this._core.store.state.selectionGroup.resize(this.newSize.x, this.newSize.y, this.newSize.width, this.newSize.height);\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 const oneFingerTouch = activePointers[0];\r\n\r\n if (!oneFingerTouch) {\r\n return;\r\n }\r\n\r\n if (this._core.store.state.isResizing && this._core.store.state.selectionGroup) {\r\n const clientX = Math.round(oneFingerTouch.clientX - this._core.store.offsetX);\r\n const clientY = Math.round(oneFingerTouch.clientY - this._core.store.offsetY);\r\n\r\n const dx = clientX - this.initialMouseX;\r\n const dy = clientY - this.initialMouseY;\r\n\r\n const resizeDeltaX = Math.abs(dx);\r\n const resizeDeltaY = Math.abs(dy);\r\n const resizeThreshold = 5;\r\n\r\n if (resizeDeltaX > resizeThreshold || resizeDeltaY > resizeThreshold) {\r\n clearTimeout(this._core.store.state.longTouchTimeout);\r\n this.hasResized = true;\r\n }\r\n\r\n if (!this.hasResized) {\r\n return;\r\n }\r\n\r\n switch (this._core.store.state.resizeHandleType) {\r\n case KritzelHandleType.TopLeft:\r\n this.newSize.width = this.initialSize.width - dx;\r\n this.newSize.height = this.initialSize.height - dy;\r\n this.newSize.x = dx / this._core.store.state.scale + this.initialSize.x;\r\n this.newSize.y = dy / this._core.store.state.scale + this.initialSize.y;\r\n break;\r\n case KritzelHandleType.TopRight:\r\n this.newSize.width = this.initialSize.width + dx;\r\n this.newSize.height = this.initialSize.height - dy;\r\n this.newSize.x = this.initialSize.x;\r\n this.newSize.y = dy / this._core.store.state.scale + this.initialSize.y;\r\n break;\r\n case KritzelHandleType.BottomLeft:\r\n this.newSize.width = this.initialSize.width - dx;\r\n this.newSize.height = this.initialSize.height + dy;\r\n this.newSize.x = dx / this._core.store.state.scale + this.initialSize.x;\r\n this.newSize.y = this.initialSize.y;\r\n break;\r\n case KritzelHandleType.BottomRight:\r\n this.newSize.width = this.initialSize.width + dx;\r\n this.newSize.height = this.initialSize.height + dy;\r\n this.newSize.x = this.initialSize.x;\r\n this.newSize.y = this.initialSize.y;\r\n break;\r\n }\r\n\r\n this._core.store.state.selectionGroup.resize(this.newSize.x, this.newSize.y, this.newSize.width, this.newSize.height);\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.isResizing) {\r\n this._core.store.state.isResizing = false;\r\n\r\n if (this.hasResized) {\r\n this._core.commandManager.executeCommand(new ResizeSelectionGroupCommand(this._core, this, structuredClone(this.initialSize), structuredClone(this.newSize)));\r\n this._core.store.state.hasObjectsChanged = true;\r\n }\r\n\r\n this.reset();\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n if (this._core.store.state.isResizing) {\r\n this._core.store.state.isResizing = false;\r\n\r\n if (this.hasResized) {\r\n this._core.commandManager.executeCommand(new ResizeSelectionGroupCommand(this._core, this, structuredClone(this.initialSize), structuredClone(this.newSize)));\r\n this._core.store.state.hasObjectsChanged = true;\r\n }\r\n\r\n this.reset();\r\n\r\n clearTimeout(this._core.store.state.longTouchTimeout);\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -91,7 +91,7 @@ export class KritzelRotationHandler extends KritzelBaseHandler {
|
|
|
91
91
|
handlePointerUp(event) {
|
|
92
92
|
if (event.pointerType === 'mouse') {
|
|
93
93
|
if (this._core.store.state.isRotating) {
|
|
94
|
-
this._core.
|
|
94
|
+
this._core.commandManager.executeCommand(new RotateSelectionGroupCommand(this._core, this, this.rotation, this.initialSelectionGroupRotation));
|
|
95
95
|
this._core.store.state.isRotating = false;
|
|
96
96
|
this._core.store.state.hasObjectsChanged = true;
|
|
97
97
|
this.reset();
|
|
@@ -99,7 +99,7 @@ export class KritzelRotationHandler extends KritzelBaseHandler {
|
|
|
99
99
|
}
|
|
100
100
|
if (event.pointerType === 'touch') {
|
|
101
101
|
if (this._core.store.state.isRotating) {
|
|
102
|
-
this._core.
|
|
102
|
+
this._core.commandManager.executeCommand(new RotateSelectionGroupCommand(this._core, this, this.rotation, this.initialSelectionGroupRotation));
|
|
103
103
|
this._core.store.state.isRotating = false;
|
|
104
104
|
this._core.store.state.hasObjectsChanged = true;
|
|
105
105
|
this.reset();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rotation.handler.js","sourceRoot":"","sources":["../../../src/classes/handlers/rotation.handler.ts"],"names":[],"mappings":"AAAA,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AAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAEhD,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,CAAC;QACH,CAAC;QAED,IAAI,KAAK,CAAC,WAAW,KAAK,OAAO,EAAE,CAAC;YAClC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;gBACtC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,2BAA2B,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,6BAA6B,CAAC,CAAC,CAAC;gBAExI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC;gBAC1C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAEhD,IAAI,CAAC,KAAK,EAAE,CAAC;gBAEb,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACxD,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import { KritzelEventHelper } from '../../helpers/event.helper';\r\nimport { RotateSelectionGroupCommand } from '../commands/rotate-selection-group.command';\r\nimport { KritzelBaseHandler } from './base.handler';\r\nimport { KritzelCore } from '../core/core.class';\r\nimport { KritzelBaseObject } from '../objects/base-object.class';\r\n\r\nexport class KritzelRotationHandler extends KritzelBaseHandler {\r\n initialRotation: number = 0;\r\n\r\n rotation: number = 0;\r\n\r\n unchangedObjects: KritzelBaseObject<any>[] = [];\r\n\r\n initialSelectionGroupRotation: number = 0;\r\n\r\n constructor(core: KritzelCore) {\r\n super(core);\r\n }\r\n\r\n private reset() {\r\n this.initialRotation = 0;\r\n this.rotation = 0;\r\n this.unchangedObjects = [];\r\n }\r\n\r\n handlePointerDown(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (KritzelEventHelper.isLeftClick(event)) {\r\n if (this._core.store.state.selectionGroup && this._core.store.state.isRotationHandleSelected) {\r\n const clientX = event.clientX - this._core.store.offsetX;\r\n const clientY = event.clientY - this._core.store.offsetY;\r\n\r\n this._core.store.state.isRotating = true;\r\n\r\n const centerX = this._core.store.state.selectionGroup.translateX + this._core.store.state.selectionGroup.width / 2 / this._core.store.state.scale;\r\n const centerY = this._core.store.state.selectionGroup.translateY + this._core.store.state.selectionGroup.height / 2 / this._core.store.state.scale;\r\n\r\n const cursorX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;\r\n const cursorY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;\r\n\r\n this.initialSelectionGroupRotation = this._core.store.state.selectionGroup.rotation;\r\n this.initialRotation = Math.atan2(centerY - cursorY, centerX - cursorX) - this._core.store.state.selectionGroup.rotation;\r\n\r\n this.unchangedObjects = this._core.store.state.selectionGroup.objects.map(obj => obj.clone());\r\n }\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 const firstTouch = activePointers[0];\r\n\r\n if (!firstTouch) {\r\n return;\r\n }\r\n\r\n if (activePointers.length === 1) {\r\n if (this._core.store.state.selectionGroup && this._core.store.state.isRotationHandleSelected) {\r\n const clientX = Math.round(firstTouch.clientX - this._core.store.offsetX);\r\n const clientY = Math.round(firstTouch.clientY - this._core.store.offsetY);\r\n\r\n this._core.store.state.isRotating = true;\r\n\r\n const centerX = this._core.store.state.selectionGroup.translateX + this._core.store.state.selectionGroup.width / 2 / this._core.store.state.scale;\r\n const centerY = this._core.store.state.selectionGroup.translateY + this._core.store.state.selectionGroup.height / 2 / this._core.store.state.scale;\r\n\r\n const cursorX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;\r\n const cursorY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;\r\n\r\n this.initialSelectionGroupRotation = this._core.store.state.selectionGroup.rotation;\r\n this.initialRotation = Math.atan2(centerY - cursorY, centerX - cursorX) - this._core.store.state.selectionGroup.rotation;\r\n\r\n this.unchangedObjects = this._core.store.state.selectionGroup.objects.map(obj => obj.clone());\r\n\r\n clearTimeout(this._core.store.state.longTouchTimeout);\r\n }\r\n }\r\n }\r\n }\r\n\r\n handlePointerMove(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (this._core.store.state.isRotating && this._core.store.state.selectionGroup) {\r\n const clientX = event.clientX - this._core.store.offsetX;\r\n const clientY = event.clientY - this._core.store.offsetY;\r\n\r\n const groupCenterX = this._core.store.state.selectionGroup.translateX + this._core.store.state.selectionGroup.width / 2 / this._core.store.state.scale;\r\n const groupCenterY = this._core.store.state.selectionGroup.translateY + this._core.store.state.selectionGroup.height / 2 / this._core.store.state.scale;\r\n\r\n const cursorX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;\r\n const cursorY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;\r\n\r\n const currentRotation = Math.atan2(groupCenterY - cursorY, groupCenterX - cursorX);\r\n\r\n this.rotation = currentRotation - this.initialRotation;\r\n\r\n this._core.store.state.selectionGroup.rotate(this.rotation);\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 const firstTouch = activePointers[0];\r\n\r\n if (!firstTouch) {\r\n return;\r\n }\r\n\r\n if (this._core.store.state.isRotating && this._core.store.state.selectionGroup) {\r\n const clientX = Math.round(firstTouch.clientX - this._core.store.offsetX);\r\n const clientY = Math.round(firstTouch.clientY - this._core.store.offsetY);\r\n\r\n const groupCenterX = this._core.store.state.selectionGroup.translateX + this._core.store.state.selectionGroup.width / 2 / this._core.store.state.scale;\r\n const groupCenterY = this._core.store.state.selectionGroup.translateY + this._core.store.state.selectionGroup.height / 2 / this._core.store.state.scale;\r\n\r\n const cursorX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;\r\n const cursorY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;\r\n\r\n const currentRotation = Math.atan2(groupCenterY - cursorY, groupCenterX - cursorX);\r\n\r\n this.rotation = currentRotation - this.initialRotation;\r\n\r\n this._core.store.state.selectionGroup.rotate(this.rotation);\r\n\r\n clearTimeout(this._core.store.state.longTouchTimeout);\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.isRotating) {\r\n this._core.history.executeCommand(new RotateSelectionGroupCommand(this._core, this, this.rotation, this.initialSelectionGroupRotation));\r\n\r\n this._core.store.state.isRotating = false;\r\n this._core.store.state.hasObjectsChanged = true;\r\n\r\n this.reset();\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n if (this._core.store.state.isRotating) {\r\n this._core.history.executeCommand(new RotateSelectionGroupCommand(this._core, this, this.rotation, this.initialSelectionGroupRotation));\r\n\r\n this._core.store.state.isRotating = false;\r\n this._core.store.state.hasObjectsChanged = true;\r\n\r\n this.reset();\r\n\r\n clearTimeout(this._core.store.state.longTouchTimeout);\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"rotation.handler.js","sourceRoot":"","sources":["../../../src/classes/handlers/rotation.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAIpD,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IAC5D,eAAe,GAAW,CAAC,CAAC;IAE5B,QAAQ,GAAW,CAAC,CAAC;IAErB,gBAAgB,GAA6B,EAAE,CAAC;IAEhD,6BAA6B,GAAW,CAAC,CAAC;IAE1C,YAAY,IAAiB;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEO,KAAK;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,CAAC,6BAA6B,CAAC,CAAC,CAAC;gBAE/I,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC;gBAC1C,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAEhD,IAAI,CAAC,KAAK,EAAE,CAAC;gBAEb,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACxD,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import { KritzelEventHelper } from '../../helpers/event.helper';\r\nimport { RotateSelectionGroupCommand } from '../commands/rotate-selection-group.command';\r\nimport { KritzelBaseHandler } from './base.handler';\r\nimport { KritzelCore } from '../core/core.class';\r\nimport { KritzelBaseObject } from '../objects/base-object.class';\r\n\r\nexport class KritzelRotationHandler extends KritzelBaseHandler {\r\n initialRotation: number = 0;\r\n\r\n rotation: number = 0;\r\n\r\n unchangedObjects: KritzelBaseObject<any>[] = [];\r\n\r\n initialSelectionGroupRotation: number = 0;\r\n\r\n constructor(core: KritzelCore) {\r\n super(core);\r\n }\r\n\r\n private reset() {\r\n this.initialRotation = 0;\r\n this.rotation = 0;\r\n this.unchangedObjects = [];\r\n }\r\n\r\n handlePointerDown(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (KritzelEventHelper.isLeftClick(event)) {\r\n if (this._core.store.state.selectionGroup && this._core.store.state.isRotationHandleSelected) {\r\n const clientX = event.clientX - this._core.store.offsetX;\r\n const clientY = event.clientY - this._core.store.offsetY;\r\n\r\n this._core.store.state.isRotating = true;\r\n\r\n const centerX = this._core.store.state.selectionGroup.translateX + this._core.store.state.selectionGroup.width / 2 / this._core.store.state.scale;\r\n const centerY = this._core.store.state.selectionGroup.translateY + this._core.store.state.selectionGroup.height / 2 / this._core.store.state.scale;\r\n\r\n const cursorX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;\r\n const cursorY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;\r\n\r\n this.initialSelectionGroupRotation = this._core.store.state.selectionGroup.rotation;\r\n this.initialRotation = Math.atan2(centerY - cursorY, centerX - cursorX) - this._core.store.state.selectionGroup.rotation;\r\n\r\n this.unchangedObjects = this._core.store.state.selectionGroup.objects.map(obj => obj.clone());\r\n }\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 const firstTouch = activePointers[0];\r\n\r\n if (!firstTouch) {\r\n return;\r\n }\r\n\r\n if (activePointers.length === 1) {\r\n if (this._core.store.state.selectionGroup && this._core.store.state.isRotationHandleSelected) {\r\n const clientX = Math.round(firstTouch.clientX - this._core.store.offsetX);\r\n const clientY = Math.round(firstTouch.clientY - this._core.store.offsetY);\r\n\r\n this._core.store.state.isRotating = true;\r\n\r\n const centerX = this._core.store.state.selectionGroup.translateX + this._core.store.state.selectionGroup.width / 2 / this._core.store.state.scale;\r\n const centerY = this._core.store.state.selectionGroup.translateY + this._core.store.state.selectionGroup.height / 2 / this._core.store.state.scale;\r\n\r\n const cursorX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;\r\n const cursorY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;\r\n\r\n this.initialSelectionGroupRotation = this._core.store.state.selectionGroup.rotation;\r\n this.initialRotation = Math.atan2(centerY - cursorY, centerX - cursorX) - this._core.store.state.selectionGroup.rotation;\r\n\r\n this.unchangedObjects = this._core.store.state.selectionGroup.objects.map(obj => obj.clone());\r\n\r\n clearTimeout(this._core.store.state.longTouchTimeout);\r\n }\r\n }\r\n }\r\n }\r\n\r\n handlePointerMove(event: PointerEvent): void {\r\n if (event.pointerType === 'mouse') {\r\n if (this._core.store.state.isRotating && this._core.store.state.selectionGroup) {\r\n const clientX = event.clientX - this._core.store.offsetX;\r\n const clientY = event.clientY - this._core.store.offsetY;\r\n\r\n const groupCenterX = this._core.store.state.selectionGroup.translateX + this._core.store.state.selectionGroup.width / 2 / this._core.store.state.scale;\r\n const groupCenterY = this._core.store.state.selectionGroup.translateY + this._core.store.state.selectionGroup.height / 2 / this._core.store.state.scale;\r\n\r\n const cursorX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;\r\n const cursorY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;\r\n\r\n const currentRotation = Math.atan2(groupCenterY - cursorY, groupCenterX - cursorX);\r\n\r\n this.rotation = currentRotation - this.initialRotation;\r\n\r\n this._core.store.state.selectionGroup.rotate(this.rotation);\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 const firstTouch = activePointers[0];\r\n\r\n if (!firstTouch) {\r\n return;\r\n }\r\n\r\n if (this._core.store.state.isRotating && this._core.store.state.selectionGroup) {\r\n const clientX = Math.round(firstTouch.clientX - this._core.store.offsetX);\r\n const clientY = Math.round(firstTouch.clientY - this._core.store.offsetY);\r\n\r\n const groupCenterX = this._core.store.state.selectionGroup.translateX + this._core.store.state.selectionGroup.width / 2 / this._core.store.state.scale;\r\n const groupCenterY = this._core.store.state.selectionGroup.translateY + this._core.store.state.selectionGroup.height / 2 / this._core.store.state.scale;\r\n\r\n const cursorX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;\r\n const cursorY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;\r\n\r\n const currentRotation = Math.atan2(groupCenterY - cursorY, groupCenterX - cursorX);\r\n\r\n this.rotation = currentRotation - this.initialRotation;\r\n\r\n this._core.store.state.selectionGroup.rotate(this.rotation);\r\n\r\n clearTimeout(this._core.store.state.longTouchTimeout);\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.isRotating) {\r\n this._core.commandManager.executeCommand(new RotateSelectionGroupCommand(this._core, this, this.rotation, this.initialSelectionGroupRotation));\r\n\r\n this._core.store.state.isRotating = false;\r\n this._core.store.state.hasObjectsChanged = true;\r\n\r\n this.reset();\r\n }\r\n }\r\n\r\n if (event.pointerType === 'touch') {\r\n if (this._core.store.state.isRotating) {\r\n this._core.commandManager.executeCommand(new RotateSelectionGroupCommand(this._core, this, this.rotation, this.initialSelectionGroupRotation));\r\n\r\n this._core.store.state.isRotating = false;\r\n this._core.store.state.hasObjectsChanged = true;\r\n\r\n this.reset();\r\n\r\n clearTimeout(this._core.store.state.longTouchTimeout);\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -57,7 +57,7 @@ export class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
57
57
|
if (KritzelEventHelper.isLeftClick(event)) {
|
|
58
58
|
const hasObjectsMoved = this._core.store.state.hasObjectsChanged;
|
|
59
59
|
if (this._core.store.state.selectionGroup?.objects.length === 1 && hasObjectsMoved === false) {
|
|
60
|
-
this._core.store.state.selectionGroup.objects[0].edit();
|
|
60
|
+
this._core.store.state.selectionGroup.objects[0].edit(event);
|
|
61
61
|
}
|
|
62
62
|
this._core.store.state.hasObjectsChanged = false;
|
|
63
63
|
if (this._core.store.state.isSelecting) {
|
|
@@ -76,7 +76,7 @@ export class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
76
76
|
clearTimeout(this.touchStartTimeout);
|
|
77
77
|
const hasObjectsMoved = this._core.store.state.hasObjectsChanged;
|
|
78
78
|
if (this._core.store.state.selectionGroup?.objects.length === 1 && hasObjectsMoved === false) {
|
|
79
|
-
this._core.store.state.selectionGroup.objects[0].edit();
|
|
79
|
+
this._core.store.state.selectionGroup.objects[0].edit(event);
|
|
80
80
|
}
|
|
81
81
|
this._core.store.state.hasObjectsChanged = false;
|
|
82
82
|
if (this._core.store.state.isSelecting) {
|
|
@@ -219,7 +219,7 @@ export class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
219
219
|
selectionGroup.addOrRemove(object);
|
|
220
220
|
selectionGroup.isSelected = true;
|
|
221
221
|
selectionGroup.rotation = object.rotation;
|
|
222
|
-
this._core.
|
|
222
|
+
this._core.commandManager.executeCommand(new AddSelectionGroupCommand(this._core, this, selectionGroup));
|
|
223
223
|
}
|
|
224
224
|
addSelectedObjectsToSelectionGroup() {
|
|
225
225
|
const selectedObjects = this._core.store.selectedObjects;
|
|
@@ -236,7 +236,7 @@ export class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
|
236
236
|
if (selectionGroup.length === 1) {
|
|
237
237
|
selectionGroup.rotation = selectionGroup.objects[0].rotation;
|
|
238
238
|
}
|
|
239
|
-
this._core.
|
|
239
|
+
this._core.commandManager.executeCommand(new AddSelectionGroupCommand(this._core, this, selectionGroup));
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
//# sourceMappingURL=selection.handler.js.map
|