@embedpdf/utils 1.1.1 → 1.2.0
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/preact/adapter.d.ts +1 -0
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +683 -2
- package/dist/preact/index.js.map +1 -1
- package/dist/react/adapter.d.ts +1 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +683 -2
- package/dist/react/index.js.map +1 -1
- package/dist/shared-preact/hooks/index.d.ts +3 -0
- package/dist/shared-preact/hooks/use-double-press-props.d.ts +11 -0
- package/dist/shared-preact/hooks/use-drag-resize.d.ts +27 -0
- package/dist/shared-preact/hooks/use-interaction-handles.d.ts +33 -0
- package/dist/shared-preact/index.d.ts +1 -0
- package/dist/shared-preact/plugin-interaction-primitives/drag-resize-controller.d.ts +68 -0
- package/dist/shared-preact/plugin-interaction-primitives/index.d.ts +2 -0
- package/dist/shared-preact/plugin-interaction-primitives/utils.d.ts +22 -0
- package/dist/shared-react/hooks/index.d.ts +3 -0
- package/dist/shared-react/hooks/use-double-press-props.d.ts +11 -0
- package/dist/shared-react/hooks/use-drag-resize.d.ts +27 -0
- package/dist/shared-react/hooks/use-interaction-handles.d.ts +33 -0
- package/dist/shared-react/index.d.ts +1 -0
- package/dist/shared-react/plugin-interaction-primitives/drag-resize-controller.d.ts +68 -0
- package/dist/shared-react/plugin-interaction-primitives/index.d.ts +2 -0
- package/dist/shared-react/plugin-interaction-primitives/utils.d.ts +22 -0
- package/dist/shared-vue/plugin-interaction-primitives/drag-resize-controller.d.ts +68 -0
- package/dist/shared-vue/plugin-interaction-primitives/index.d.ts +2 -0
- package/dist/shared-vue/plugin-interaction-primitives/utils.d.ts +22 -0
- package/dist/vue/hooks/index.d.ts +1 -0
- package/dist/vue/hooks/use-drag-resize.d.ts +24 -0
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +478 -2
- package/dist/vue/index.js.map +1 -1
- package/package.json +2 -2
package/dist/vue/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/vue/components/counter-rotate-container.vue"],"sourcesContent":["<template>\n <slot :menu-wrapper-props=\"menuWrapperProps\" :matrix=\"matrix\" :rect=\"adjustedRect\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, type CSSProperties } from 'vue';\nimport type { Rect, Rotation } from '@embedpdf/models';\nimport { getCounterRotation } from '@embedpdf/utils';\n\ninterface CounterRotateProps {\n rect: Rect;\n rotation: Rotation;\n}\n\nconst props = defineProps<CounterRotateProps>();\n\nconst { matrix, width, height } = getCounterRotation(props.rect, props.rotation);\n\nconst menuWrapperProps = computed(() => ({\n style: {\n position: 'absolute',\n left: `${props.rect.origin.x}px`,\n top: `${props.rect.origin.y}px`,\n transform: matrix,\n transformOrigin: '0 0',\n width: `${width}px`,\n height: `${height}px`,\n pointerEvents: 'none',\n zIndex: 3,\n } as CSSProperties,\n onPointerDown: (e: PointerEvent) => e.stopPropagation(),\n onTouchStart: (e: TouchEvent) => e.stopPropagation(),\n}));\n\nconst adjustedRect = computed(() => ({\n origin: { x: props.rect.origin.x, y: props.rect.origin.y },\n size: { width, height },\n}));\n</script>\n"],"names":["props","__props","matrix","width","height","getCounterRotation","rect","rotation","menuWrapperProps","computed","style","position","left","origin","x","top","y","transform","transformOrigin","pointerEvents","zIndex","onPointerDown","e","stopPropagation","onTouchStart","adjustedRect","size","_renderSlot","_ctx","$slots","value","_unref"],"mappings":"gOAcA,MAAMA,EAAQC,GAERC,OAAEA,EAAQC,MAAAA,EAAAC,OAAOA,GAAWC,EAAmBA,mBAAAL,EAAMM,KAAMN,EAAMO,UAEjEC,EAAmBC,EAAAA,UAAS,KAAO,CACvCC,MAAO,CACLC,SAAU,WACVC,KAAM,GAAGZ,EAAMM,KAAKO,OAAOC,MAC3BC,IAAK,GAAGf,EAAMM,KAAKO,OAAOG,MAC1BC,UAAWf,EACXgB,gBAAiB,MACjBf,MAAO,GAAGA,MACVC,OAAQ,GAAGA,MACXe,cAAe,OACfC,OAAQ,GAEVC,cAAgBC,GAAoBA,EAAEC,kBACtCC,aAAeF,GAAkBA,EAAEC,sBAG/BE,EAAehB,EAAAA,UAAS,KAAO,CACnCI,OAAQ,CAAEC,EAAGd,EAAMM,KAAKO,OAAOC,EAAGE,EAAGhB,EAAMM,KAAKO,OAAOG,GACvDU,KAAM,CAAEvB,QAAOC,2BAnCfuB,aAAqFC,EAAAC,OAAA,UAAA,CAA9ErB,iBAAoBA,EAAgBsB,MAAG5B,OAAQ6B,QAAM7B,GAAGI,KAAMmB,EAAYK"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/vue/components/counter-rotate-container.vue","../../src/shared/plugin-interaction-primitives/drag-resize-controller.ts","../../src/vue/hooks/use-drag-resize.ts"],"sourcesContent":["<template>\n <slot :menu-wrapper-props=\"menuWrapperProps\" :matrix=\"matrix\" :rect=\"adjustedRect\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, type CSSProperties } from 'vue';\nimport type { Rect, Rotation } from '@embedpdf/models';\nimport { getCounterRotation } from '@embedpdf/utils';\n\ninterface CounterRotateProps {\n rect: Rect;\n rotation: Rotation;\n}\n\nconst props = defineProps<CounterRotateProps>();\n\nconst { matrix, width, height } = getCounterRotation(props.rect, props.rotation);\n\nconst menuWrapperProps = computed(() => ({\n style: {\n position: 'absolute',\n left: `${props.rect.origin.x}px`,\n top: `${props.rect.origin.y}px`,\n transform: matrix,\n transformOrigin: '0 0',\n width: `${width}px`,\n height: `${height}px`,\n pointerEvents: 'none',\n zIndex: 3,\n } as CSSProperties,\n onPointerDown: (e: PointerEvent) => e.stopPropagation(),\n onTouchStart: (e: TouchEvent) => e.stopPropagation(),\n}));\n\nconst adjustedRect = computed(() => ({\n origin: { x: props.rect.origin.x, y: props.rect.origin.y },\n size: { width, height },\n}));\n</script>\n","import { Position, Rect } from '@embedpdf/models';\n\nexport interface DragResizeConfig {\n element: Rect;\n vertices?: Position[];\n constraints?: {\n minWidth?: number;\n minHeight?: number;\n maxWidth?: number;\n maxHeight?: number;\n boundingBox?: { width: number; height: number }; // page bounds\n };\n maintainAspectRatio?: boolean;\n pageRotation?: number;\n scale?: number;\n}\n\nexport type InteractionState = 'idle' | 'dragging' | 'resizing' | 'vertex-editing';\nexport type ResizeHandle = 'nw' | 'ne' | 'sw' | 'se' | 'n' | 'e' | 's' | 'w';\n\nexport interface TransformData {\n type: 'move' | 'resize' | 'vertex-edit';\n changes: {\n rect?: Rect;\n vertices?: Position[];\n };\n metadata?: {\n handle?: ResizeHandle;\n vertexIndex?: number;\n maintainAspectRatio?: boolean;\n };\n}\n\nexport interface InteractionEvent {\n state: 'start' | 'move' | 'end';\n transformData?: TransformData;\n}\n\n/**\n * Pure geometric controller that manages drag/resize/vertex-edit logic.\n */\nexport class DragResizeController {\n private state: InteractionState = 'idle';\n private startPoint: Position | null = null;\n private startElement: Rect | null = null;\n private activeHandle: ResizeHandle | null = null;\n private currentPosition: Rect | null = null;\n\n // Vertex editing state - pure geometric\n private activeVertexIndex: number | null = null;\n private startVertices: Position[] = [];\n private currentVertices: Position[] = [];\n\n constructor(\n private config: DragResizeConfig,\n private onUpdate: (event: InteractionEvent) => void,\n ) {\n this.currentVertices = config.vertices || [];\n }\n\n updateConfig(config: Partial<DragResizeConfig>) {\n this.config = { ...this.config, ...config };\n this.currentVertices = config.vertices || [];\n }\n\n startDrag(clientX: number, clientY: number) {\n this.state = 'dragging';\n this.startPoint = { x: clientX, y: clientY };\n this.startElement = { ...this.config.element };\n this.currentPosition = { ...this.config.element };\n\n this.onUpdate({\n state: 'start',\n transformData: {\n type: 'move',\n changes: {\n rect: this.startElement,\n },\n },\n });\n }\n\n startResize(handle: ResizeHandle, clientX: number, clientY: number) {\n this.state = 'resizing';\n this.activeHandle = handle;\n this.startPoint = { x: clientX, y: clientY };\n this.startElement = { ...this.config.element };\n this.currentPosition = { ...this.config.element };\n\n this.onUpdate({\n state: 'start',\n transformData: {\n type: 'resize',\n changes: {\n rect: this.startElement,\n },\n metadata: {\n handle: this.activeHandle,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n }\n\n startVertexEdit(vertexIndex: number, clientX: number, clientY: number) {\n // Refresh vertices from latest config before validating index\n this.currentVertices = [...(this.config.vertices ?? this.currentVertices)];\n if (vertexIndex < 0 || vertexIndex >= this.currentVertices.length) return;\n\n this.state = 'vertex-editing';\n this.activeVertexIndex = vertexIndex;\n this.startPoint = { x: clientX, y: clientY };\n this.startVertices = [...this.currentVertices];\n\n this.onUpdate({\n state: 'start',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices: this.startVertices,\n },\n metadata: {\n vertexIndex,\n },\n },\n });\n }\n\n move(clientX: number, clientY: number) {\n if (this.state === 'idle' || !this.startPoint) return;\n\n if (this.state === 'dragging' && this.startElement) {\n const delta = this.calculateDelta(clientX, clientY);\n const position = this.calculateDragPosition(delta);\n this.currentPosition = position;\n\n this.onUpdate({\n state: 'move',\n transformData: {\n type: 'move',\n changes: {\n rect: position,\n },\n },\n });\n } else if (this.state === 'resizing' && this.activeHandle && this.startElement) {\n const delta = this.calculateDelta(clientX, clientY);\n const position = this.calculateResizePosition(delta, this.activeHandle);\n this.currentPosition = position;\n\n this.onUpdate({\n state: 'move',\n transformData: {\n type: 'resize',\n changes: {\n rect: position,\n },\n metadata: {\n handle: this.activeHandle,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n } else if (this.state === 'vertex-editing' && this.activeVertexIndex !== null) {\n const vertices = this.calculateVertexPosition(clientX, clientY);\n this.currentVertices = vertices;\n\n this.onUpdate({\n state: 'move',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices,\n },\n metadata: {\n vertexIndex: this.activeVertexIndex,\n },\n },\n });\n }\n }\n\n end() {\n if (this.state === 'idle') return;\n\n const wasState = this.state;\n const handle = this.activeHandle;\n const vertexIndex = this.activeVertexIndex;\n\n if (wasState === 'vertex-editing') {\n this.onUpdate({\n state: 'end',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices: this.currentVertices,\n },\n metadata: {\n vertexIndex: vertexIndex || undefined,\n },\n },\n });\n } else {\n const finalPosition = this.getCurrentPosition();\n this.onUpdate({\n state: 'end',\n transformData: {\n type: wasState === 'dragging' ? 'move' : 'resize',\n changes: {\n rect: finalPosition,\n },\n metadata:\n wasState === 'dragging'\n ? undefined\n : {\n handle: handle || undefined,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n }\n\n this.reset();\n }\n\n cancel() {\n if (this.state === 'idle') return;\n\n if (this.state === 'vertex-editing') {\n this.onUpdate({\n state: 'end',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices: this.startVertices,\n },\n metadata: {\n vertexIndex: this.activeVertexIndex || undefined,\n },\n },\n });\n } else if (this.startElement) {\n this.onUpdate({\n state: 'end',\n transformData: {\n type: this.state === 'dragging' ? 'move' : 'resize',\n changes: {\n rect: this.startElement,\n },\n metadata:\n this.state === 'dragging'\n ? undefined\n : {\n handle: this.activeHandle || undefined,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n }\n\n this.reset();\n }\n\n private reset() {\n this.state = 'idle';\n this.startPoint = null;\n this.startElement = null;\n this.activeHandle = null;\n this.currentPosition = null;\n this.activeVertexIndex = null;\n this.startVertices = [];\n }\n\n private getCurrentPosition() {\n return this.currentPosition || this.config.element;\n }\n\n private calculateDelta(clientX: number, clientY: number): Position {\n if (!this.startPoint) return { x: 0, y: 0 };\n\n const rawDelta: Position = {\n x: clientX - this.startPoint.x,\n y: clientY - this.startPoint.y,\n };\n\n return this.transformDelta(rawDelta);\n }\n\n private transformDelta(delta: Position): Position {\n const { pageRotation = 0, scale = 1 } = this.config;\n\n const rad = (pageRotation * Math.PI) / 2;\n const cos = Math.cos(rad);\n const sin = Math.sin(rad);\n\n const scaledX = delta.x / scale;\n const scaledY = delta.y / scale;\n\n return {\n x: cos * scaledX + sin * scaledY,\n y: -sin * scaledX + cos * scaledY,\n };\n }\n\n private clampPoint(p: Position): Position {\n const bbox = this.config.constraints?.boundingBox;\n if (!bbox) return p;\n return {\n x: Math.max(0, Math.min(p.x, bbox.width)),\n y: Math.max(0, Math.min(p.y, bbox.height)),\n };\n }\n\n private calculateVertexPosition(clientX: number, clientY: number): Position[] {\n if (this.activeVertexIndex === null) return this.startVertices;\n\n const delta = this.calculateDelta(clientX, clientY);\n const newVertices = [...this.startVertices];\n const currentVertex = newVertices[this.activeVertexIndex];\n\n const moved = {\n x: currentVertex.x + delta.x,\n y: currentVertex.y + delta.y,\n };\n newVertices[this.activeVertexIndex] = this.clampPoint(moved);\n\n return newVertices;\n }\n\n private calculateDragPosition(delta: Position): Rect {\n if (!this.startElement) return this.config.element;\n\n const position: Rect = {\n origin: {\n x: this.startElement.origin.x + delta.x,\n y: this.startElement.origin.y + delta.y,\n },\n size: {\n width: this.startElement.size.width,\n height: this.startElement.size.height,\n },\n };\n\n return this.applyConstraints(position);\n }\n\n private calculateResizePosition(delta: Position, handle: ResizeHandle): Rect {\n if (!this.startElement) return this.config.element;\n\n let {\n origin: { x, y },\n size: { width, height },\n } = this.startElement;\n\n switch (handle) {\n case 'se':\n width += delta.x;\n height += delta.y;\n break;\n case 'sw':\n x += delta.x;\n width -= delta.x;\n height += delta.y;\n break;\n case 'ne':\n width += delta.x;\n y += delta.y;\n height -= delta.y;\n break;\n case 'nw':\n x += delta.x;\n width -= delta.x;\n y += delta.y;\n height -= delta.y;\n break;\n case 'n':\n y += delta.y;\n height -= delta.y;\n break;\n case 's':\n height += delta.y;\n break;\n case 'e':\n width += delta.x;\n break;\n case 'w':\n x += delta.x;\n width -= delta.x;\n break;\n }\n\n // Maintain aspect ratio if needed\n if (this.config.maintainAspectRatio && this.startElement) {\n const aspectRatio = this.startElement.size.width / this.startElement.size.height;\n\n if (['n', 's', 'e', 'w'].includes(handle)) {\n if (handle === 'n' || handle === 's') {\n const newWidth = height * aspectRatio;\n const widthDiff = newWidth - width;\n width = newWidth;\n x -= widthDiff / 2;\n } else {\n const newHeight = width / aspectRatio;\n const heightDiff = newHeight - height;\n height = newHeight;\n if (handle === 'w') {\n x = this.startElement.origin.x + this.startElement.size.width - width;\n }\n y -= heightDiff / 2;\n }\n } else {\n const widthChange = Math.abs(width - this.startElement.size.width);\n const heightChange = Math.abs(height - this.startElement.size.height);\n if (widthChange > heightChange) {\n height = width / aspectRatio;\n } else {\n width = height * aspectRatio;\n }\n if (handle.includes('w')) {\n x = this.startElement.origin.x + this.startElement.size.width - width;\n }\n if (handle.includes('n')) {\n y = this.startElement.origin.y + this.startElement.size.height - height;\n }\n }\n }\n\n // Handle-aware bounding box clamping to avoid shifting opposite edge\n const bbox = this.config.constraints?.boundingBox;\n if (bbox) {\n switch (handle) {\n case 'e':\n width = Math.min(width, bbox.width - x);\n break;\n case 's':\n height = Math.min(height, bbox.height - y);\n break;\n case 'se':\n width = Math.min(width, bbox.width - x);\n height = Math.min(height, bbox.height - y);\n break;\n case 'w':\n if (x < 0) {\n width += x;\n x = 0;\n }\n break;\n case 'n':\n if (y < 0) {\n height += y;\n y = 0;\n }\n break;\n case 'sw':\n if (x < 0) {\n width += x;\n x = 0;\n }\n height = Math.min(height, bbox.height - y);\n break;\n case 'nw':\n if (x < 0) {\n width += x;\n x = 0;\n }\n if (y < 0) {\n height += y;\n y = 0;\n }\n break;\n case 'ne':\n width = Math.min(width, bbox.width - x);\n if (y < 0) {\n height += y;\n y = 0;\n }\n break;\n }\n }\n\n return this.applyConstraints({ origin: { x, y }, size: { width, height } });\n }\n\n private applyConstraints(position: Rect): Rect {\n const { constraints } = this.config;\n if (!constraints) return position;\n\n let {\n origin: { x, y },\n size: { width, height },\n } = position;\n\n // Apply size constraints\n width = Math.max(constraints.minWidth || 1, width);\n height = Math.max(constraints.minHeight || 1, height);\n\n if (constraints.maxWidth) width = Math.min(constraints.maxWidth, width);\n if (constraints.maxHeight) height = Math.min(constraints.maxHeight, height);\n\n // Apply bounding box constraints\n if (constraints.boundingBox) {\n x = Math.max(0, Math.min(x, constraints.boundingBox.width - width));\n y = Math.max(0, Math.min(y, constraints.boundingBox.height - height));\n }\n\n return { origin: { x, y }, size: { width, height } };\n }\n}\n","import { ref, watch, computed, onUnmounted } from 'vue';\nimport {\n DragResizeController,\n DragResizeConfig,\n InteractionEvent,\n ResizeHandle,\n} from '../../shared/plugin-interaction-primitives';\n\nexport interface UseDragResizeOptions extends DragResizeConfig {\n onUpdate?: (event: InteractionEvent) => void;\n enabled?: boolean;\n}\n\nexport function useDragResize(options: UseDragResizeOptions) {\n const controller = ref<DragResizeController | null>(null);\n\n // Extract reactive options\n const { onUpdate, enabled = true, ...config } = options;\n\n // Initialize controller\n if (!controller.value) {\n controller.value = new DragResizeController(config, (event) => onUpdate?.(event));\n }\n\n // Watch for config changes\n watch(\n () => ({\n element: config.element,\n constraints: config.constraints,\n maintainAspectRatio: config.maintainAspectRatio,\n pageRotation: config.pageRotation,\n scale: config.scale,\n }),\n (newConfig) => {\n controller.value?.updateConfig(newConfig);\n },\n { deep: true },\n );\n\n // Cleanup on unmount\n onUnmounted(() => {\n controller.value = null;\n });\n\n // Drag handlers\n const handleDragStart = (e: PointerEvent) => {\n if (!enabled) return;\n e.preventDefault();\n e.stopPropagation();\n controller.value?.startDrag(e.clientX, e.clientY);\n (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);\n };\n\n const handleMove = (e: PointerEvent) => {\n controller.value?.move(e.clientX, e.clientY);\n };\n\n const handleEnd = (e: PointerEvent) => {\n controller.value?.end();\n (e.currentTarget as HTMLElement).releasePointerCapture?.(e.pointerId);\n };\n\n const handleCancel = (e: PointerEvent) => {\n controller.value?.cancel();\n (e.currentTarget as HTMLElement).releasePointerCapture?.(e.pointerId);\n };\n\n // Create resize handler factory\n const createResizeProps = (handle: ResizeHandle) => ({\n onPointerdown: (e: PointerEvent) => {\n if (!enabled) return;\n e.preventDefault();\n e.stopPropagation();\n controller.value?.startResize(handle, e.clientX, e.clientY);\n (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);\n },\n onPointermove: handleMove,\n onPointerup: handleEnd,\n onPointercancel: handleCancel,\n });\n\n // Computed drag props\n const dragProps = computed(() =>\n enabled\n ? {\n onPointerdown: handleDragStart,\n onPointermove: handleMove,\n onPointerup: handleEnd,\n onPointercancel: handleCancel,\n }\n : {},\n );\n\n return {\n dragProps,\n createResizeProps,\n };\n}\n"],"names":["props","__props","matrix","width","height","getCounterRotation","rect","rotation","menuWrapperProps","computed","style","position","left","origin","x","top","y","transform","transformOrigin","pointerEvents","zIndex","onPointerDown","e","stopPropagation","onTouchStart","adjustedRect","size","_renderSlot","_ctx","$slots","value","_unref","DragResizeController","constructor","config","onUpdate","this","state","startPoint","startElement","activeHandle","currentPosition","activeVertexIndex","startVertices","currentVertices","vertices","updateConfig","startDrag","clientX","clientY","element","transformData","type","changes","startResize","handle","metadata","maintainAspectRatio","startVertexEdit","vertexIndex","length","move","delta","calculateDelta","calculateDragPosition","calculateResizePosition","calculateVertexPosition","end","wasState","finalPosition","getCurrentPosition","reset","cancel","rawDelta","transformDelta","pageRotation","scale","rad","Math","PI","cos","sin","scaledX","scaledY","clampPoint","p","bbox","_a","constraints","boundingBox","max","min","newVertices","currentVertex","moved","applyConstraints","aspectRatio","includes","newWidth","widthDiff","newHeight","heightDiff","abs","minWidth","minHeight","maxWidth","maxHeight","options","controller","ref","enabled","event","vue","watch","newConfig","deep","onUnmounted","handleDragStart","preventDefault","currentTarget","setPointerCapture","pointerId","handleMove","handleEnd","_c","_b","releasePointerCapture","call","handleCancel","dragProps","onPointerdown","onPointermove","onPointerup","onPointercancel","createResizeProps"],"mappings":"gOAcA,MAAMA,EAAQC,GAERC,OAAEA,EAAQC,MAAAA,EAAAC,OAAOA,GAAWC,EAAmBA,mBAAAL,EA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AAvG,EAAAiG,eAA8BO,wBAAhCF,EAAAG,KAAAF,EAAwDvG,EAAEmG,UAAA,EAGvDO,EAAgB1G,cACpB,OAAAiE,EAAAqB,EAAW9E,QAAOyD,EAAAf,SACjB,OAAEoD,GAAAC,EAAAvG,EAAAiG,eAA8BO,wBAAhCF,EAAAG,KAAAF,EAAwDvG,EAAEmG,UAAA,EA6BtD,MAAA,CACLQ,UAZgBxH,EAAAA,UAAS,IACzBqG,EACI,CACEoB,cAAeb,EACfc,cAAeT,EACfU,YAAaT,EACbU,gBAAiBL,GAEnB,CAAA,IAKJM,kBA3ByB/E,IAA0B,CACnD2E,cAAgB5G,UACTwF,IACLxF,EAAEgG,iBACFhG,EAAEC,kBACF,OAAAgE,EAAAqB,EAAW9E,QAAOyD,EAAAjC,YAAYC,EAAQjC,EAAE0B,QAAS1B,EAAE2B,SAChD3B,EAAAiG,cAA8BC,kBAAkBlG,EAAEmG,WAAS,EAEhEU,cAAeT,EACfU,YAAaT,EACbU,gBAAiBL,IAmBrB"}
|
package/dist/vue/index.d.ts
CHANGED
package/dist/vue/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, computed, renderSlot, unref } from "vue";
|
|
1
|
+
import { defineComponent, computed, renderSlot, unref, ref, watch, onUnmounted } from "vue";
|
|
2
2
|
import { getCounterRotation } from "@embedpdf/utils";
|
|
3
3
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
4
|
__name: "counter-rotate-container",
|
|
@@ -37,7 +37,483 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
|
+
class DragResizeController {
|
|
41
|
+
constructor(config, onUpdate) {
|
|
42
|
+
this.config = config;
|
|
43
|
+
this.onUpdate = onUpdate;
|
|
44
|
+
this.state = "idle";
|
|
45
|
+
this.startPoint = null;
|
|
46
|
+
this.startElement = null;
|
|
47
|
+
this.activeHandle = null;
|
|
48
|
+
this.currentPosition = null;
|
|
49
|
+
this.activeVertexIndex = null;
|
|
50
|
+
this.startVertices = [];
|
|
51
|
+
this.currentVertices = [];
|
|
52
|
+
this.currentVertices = config.vertices || [];
|
|
53
|
+
}
|
|
54
|
+
updateConfig(config) {
|
|
55
|
+
this.config = { ...this.config, ...config };
|
|
56
|
+
this.currentVertices = config.vertices || [];
|
|
57
|
+
}
|
|
58
|
+
startDrag(clientX, clientY) {
|
|
59
|
+
this.state = "dragging";
|
|
60
|
+
this.startPoint = { x: clientX, y: clientY };
|
|
61
|
+
this.startElement = { ...this.config.element };
|
|
62
|
+
this.currentPosition = { ...this.config.element };
|
|
63
|
+
this.onUpdate({
|
|
64
|
+
state: "start",
|
|
65
|
+
transformData: {
|
|
66
|
+
type: "move",
|
|
67
|
+
changes: {
|
|
68
|
+
rect: this.startElement
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
startResize(handle, clientX, clientY) {
|
|
74
|
+
this.state = "resizing";
|
|
75
|
+
this.activeHandle = handle;
|
|
76
|
+
this.startPoint = { x: clientX, y: clientY };
|
|
77
|
+
this.startElement = { ...this.config.element };
|
|
78
|
+
this.currentPosition = { ...this.config.element };
|
|
79
|
+
this.onUpdate({
|
|
80
|
+
state: "start",
|
|
81
|
+
transformData: {
|
|
82
|
+
type: "resize",
|
|
83
|
+
changes: {
|
|
84
|
+
rect: this.startElement
|
|
85
|
+
},
|
|
86
|
+
metadata: {
|
|
87
|
+
handle: this.activeHandle,
|
|
88
|
+
maintainAspectRatio: this.config.maintainAspectRatio
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
startVertexEdit(vertexIndex, clientX, clientY) {
|
|
94
|
+
this.currentVertices = [...this.config.vertices ?? this.currentVertices];
|
|
95
|
+
if (vertexIndex < 0 || vertexIndex >= this.currentVertices.length) return;
|
|
96
|
+
this.state = "vertex-editing";
|
|
97
|
+
this.activeVertexIndex = vertexIndex;
|
|
98
|
+
this.startPoint = { x: clientX, y: clientY };
|
|
99
|
+
this.startVertices = [...this.currentVertices];
|
|
100
|
+
this.onUpdate({
|
|
101
|
+
state: "start",
|
|
102
|
+
transformData: {
|
|
103
|
+
type: "vertex-edit",
|
|
104
|
+
changes: {
|
|
105
|
+
vertices: this.startVertices
|
|
106
|
+
},
|
|
107
|
+
metadata: {
|
|
108
|
+
vertexIndex
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
move(clientX, clientY) {
|
|
114
|
+
if (this.state === "idle" || !this.startPoint) return;
|
|
115
|
+
if (this.state === "dragging" && this.startElement) {
|
|
116
|
+
const delta = this.calculateDelta(clientX, clientY);
|
|
117
|
+
const position = this.calculateDragPosition(delta);
|
|
118
|
+
this.currentPosition = position;
|
|
119
|
+
this.onUpdate({
|
|
120
|
+
state: "move",
|
|
121
|
+
transformData: {
|
|
122
|
+
type: "move",
|
|
123
|
+
changes: {
|
|
124
|
+
rect: position
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
} else if (this.state === "resizing" && this.activeHandle && this.startElement) {
|
|
129
|
+
const delta = this.calculateDelta(clientX, clientY);
|
|
130
|
+
const position = this.calculateResizePosition(delta, this.activeHandle);
|
|
131
|
+
this.currentPosition = position;
|
|
132
|
+
this.onUpdate({
|
|
133
|
+
state: "move",
|
|
134
|
+
transformData: {
|
|
135
|
+
type: "resize",
|
|
136
|
+
changes: {
|
|
137
|
+
rect: position
|
|
138
|
+
},
|
|
139
|
+
metadata: {
|
|
140
|
+
handle: this.activeHandle,
|
|
141
|
+
maintainAspectRatio: this.config.maintainAspectRatio
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
} else if (this.state === "vertex-editing" && this.activeVertexIndex !== null) {
|
|
146
|
+
const vertices = this.calculateVertexPosition(clientX, clientY);
|
|
147
|
+
this.currentVertices = vertices;
|
|
148
|
+
this.onUpdate({
|
|
149
|
+
state: "move",
|
|
150
|
+
transformData: {
|
|
151
|
+
type: "vertex-edit",
|
|
152
|
+
changes: {
|
|
153
|
+
vertices
|
|
154
|
+
},
|
|
155
|
+
metadata: {
|
|
156
|
+
vertexIndex: this.activeVertexIndex
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
end() {
|
|
163
|
+
if (this.state === "idle") return;
|
|
164
|
+
const wasState = this.state;
|
|
165
|
+
const handle = this.activeHandle;
|
|
166
|
+
const vertexIndex = this.activeVertexIndex;
|
|
167
|
+
if (wasState === "vertex-editing") {
|
|
168
|
+
this.onUpdate({
|
|
169
|
+
state: "end",
|
|
170
|
+
transformData: {
|
|
171
|
+
type: "vertex-edit",
|
|
172
|
+
changes: {
|
|
173
|
+
vertices: this.currentVertices
|
|
174
|
+
},
|
|
175
|
+
metadata: {
|
|
176
|
+
vertexIndex: vertexIndex || void 0
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
} else {
|
|
181
|
+
const finalPosition = this.getCurrentPosition();
|
|
182
|
+
this.onUpdate({
|
|
183
|
+
state: "end",
|
|
184
|
+
transformData: {
|
|
185
|
+
type: wasState === "dragging" ? "move" : "resize",
|
|
186
|
+
changes: {
|
|
187
|
+
rect: finalPosition
|
|
188
|
+
},
|
|
189
|
+
metadata: wasState === "dragging" ? void 0 : {
|
|
190
|
+
handle: handle || void 0,
|
|
191
|
+
maintainAspectRatio: this.config.maintainAspectRatio
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
this.reset();
|
|
197
|
+
}
|
|
198
|
+
cancel() {
|
|
199
|
+
if (this.state === "idle") return;
|
|
200
|
+
if (this.state === "vertex-editing") {
|
|
201
|
+
this.onUpdate({
|
|
202
|
+
state: "end",
|
|
203
|
+
transformData: {
|
|
204
|
+
type: "vertex-edit",
|
|
205
|
+
changes: {
|
|
206
|
+
vertices: this.startVertices
|
|
207
|
+
},
|
|
208
|
+
metadata: {
|
|
209
|
+
vertexIndex: this.activeVertexIndex || void 0
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
} else if (this.startElement) {
|
|
214
|
+
this.onUpdate({
|
|
215
|
+
state: "end",
|
|
216
|
+
transformData: {
|
|
217
|
+
type: this.state === "dragging" ? "move" : "resize",
|
|
218
|
+
changes: {
|
|
219
|
+
rect: this.startElement
|
|
220
|
+
},
|
|
221
|
+
metadata: this.state === "dragging" ? void 0 : {
|
|
222
|
+
handle: this.activeHandle || void 0,
|
|
223
|
+
maintainAspectRatio: this.config.maintainAspectRatio
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
this.reset();
|
|
229
|
+
}
|
|
230
|
+
reset() {
|
|
231
|
+
this.state = "idle";
|
|
232
|
+
this.startPoint = null;
|
|
233
|
+
this.startElement = null;
|
|
234
|
+
this.activeHandle = null;
|
|
235
|
+
this.currentPosition = null;
|
|
236
|
+
this.activeVertexIndex = null;
|
|
237
|
+
this.startVertices = [];
|
|
238
|
+
}
|
|
239
|
+
getCurrentPosition() {
|
|
240
|
+
return this.currentPosition || this.config.element;
|
|
241
|
+
}
|
|
242
|
+
calculateDelta(clientX, clientY) {
|
|
243
|
+
if (!this.startPoint) return { x: 0, y: 0 };
|
|
244
|
+
const rawDelta = {
|
|
245
|
+
x: clientX - this.startPoint.x,
|
|
246
|
+
y: clientY - this.startPoint.y
|
|
247
|
+
};
|
|
248
|
+
return this.transformDelta(rawDelta);
|
|
249
|
+
}
|
|
250
|
+
transformDelta(delta) {
|
|
251
|
+
const { pageRotation = 0, scale = 1 } = this.config;
|
|
252
|
+
const rad = pageRotation * Math.PI / 2;
|
|
253
|
+
const cos = Math.cos(rad);
|
|
254
|
+
const sin = Math.sin(rad);
|
|
255
|
+
const scaledX = delta.x / scale;
|
|
256
|
+
const scaledY = delta.y / scale;
|
|
257
|
+
return {
|
|
258
|
+
x: cos * scaledX + sin * scaledY,
|
|
259
|
+
y: -sin * scaledX + cos * scaledY
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
clampPoint(p) {
|
|
263
|
+
var _a;
|
|
264
|
+
const bbox = (_a = this.config.constraints) == null ? void 0 : _a.boundingBox;
|
|
265
|
+
if (!bbox) return p;
|
|
266
|
+
return {
|
|
267
|
+
x: Math.max(0, Math.min(p.x, bbox.width)),
|
|
268
|
+
y: Math.max(0, Math.min(p.y, bbox.height))
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
calculateVertexPosition(clientX, clientY) {
|
|
272
|
+
if (this.activeVertexIndex === null) return this.startVertices;
|
|
273
|
+
const delta = this.calculateDelta(clientX, clientY);
|
|
274
|
+
const newVertices = [...this.startVertices];
|
|
275
|
+
const currentVertex = newVertices[this.activeVertexIndex];
|
|
276
|
+
const moved = {
|
|
277
|
+
x: currentVertex.x + delta.x,
|
|
278
|
+
y: currentVertex.y + delta.y
|
|
279
|
+
};
|
|
280
|
+
newVertices[this.activeVertexIndex] = this.clampPoint(moved);
|
|
281
|
+
return newVertices;
|
|
282
|
+
}
|
|
283
|
+
calculateDragPosition(delta) {
|
|
284
|
+
if (!this.startElement) return this.config.element;
|
|
285
|
+
const position = {
|
|
286
|
+
origin: {
|
|
287
|
+
x: this.startElement.origin.x + delta.x,
|
|
288
|
+
y: this.startElement.origin.y + delta.y
|
|
289
|
+
},
|
|
290
|
+
size: {
|
|
291
|
+
width: this.startElement.size.width,
|
|
292
|
+
height: this.startElement.size.height
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
return this.applyConstraints(position);
|
|
296
|
+
}
|
|
297
|
+
calculateResizePosition(delta, handle) {
|
|
298
|
+
var _a;
|
|
299
|
+
if (!this.startElement) return this.config.element;
|
|
300
|
+
let {
|
|
301
|
+
origin: { x, y },
|
|
302
|
+
size: { width, height }
|
|
303
|
+
} = this.startElement;
|
|
304
|
+
switch (handle) {
|
|
305
|
+
case "se":
|
|
306
|
+
width += delta.x;
|
|
307
|
+
height += delta.y;
|
|
308
|
+
break;
|
|
309
|
+
case "sw":
|
|
310
|
+
x += delta.x;
|
|
311
|
+
width -= delta.x;
|
|
312
|
+
height += delta.y;
|
|
313
|
+
break;
|
|
314
|
+
case "ne":
|
|
315
|
+
width += delta.x;
|
|
316
|
+
y += delta.y;
|
|
317
|
+
height -= delta.y;
|
|
318
|
+
break;
|
|
319
|
+
case "nw":
|
|
320
|
+
x += delta.x;
|
|
321
|
+
width -= delta.x;
|
|
322
|
+
y += delta.y;
|
|
323
|
+
height -= delta.y;
|
|
324
|
+
break;
|
|
325
|
+
case "n":
|
|
326
|
+
y += delta.y;
|
|
327
|
+
height -= delta.y;
|
|
328
|
+
break;
|
|
329
|
+
case "s":
|
|
330
|
+
height += delta.y;
|
|
331
|
+
break;
|
|
332
|
+
case "e":
|
|
333
|
+
width += delta.x;
|
|
334
|
+
break;
|
|
335
|
+
case "w":
|
|
336
|
+
x += delta.x;
|
|
337
|
+
width -= delta.x;
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
if (this.config.maintainAspectRatio && this.startElement) {
|
|
341
|
+
const aspectRatio = this.startElement.size.width / this.startElement.size.height;
|
|
342
|
+
if (["n", "s", "e", "w"].includes(handle)) {
|
|
343
|
+
if (handle === "n" || handle === "s") {
|
|
344
|
+
const newWidth = height * aspectRatio;
|
|
345
|
+
const widthDiff = newWidth - width;
|
|
346
|
+
width = newWidth;
|
|
347
|
+
x -= widthDiff / 2;
|
|
348
|
+
} else {
|
|
349
|
+
const newHeight = width / aspectRatio;
|
|
350
|
+
const heightDiff = newHeight - height;
|
|
351
|
+
height = newHeight;
|
|
352
|
+
if (handle === "w") {
|
|
353
|
+
x = this.startElement.origin.x + this.startElement.size.width - width;
|
|
354
|
+
}
|
|
355
|
+
y -= heightDiff / 2;
|
|
356
|
+
}
|
|
357
|
+
} else {
|
|
358
|
+
const widthChange = Math.abs(width - this.startElement.size.width);
|
|
359
|
+
const heightChange = Math.abs(height - this.startElement.size.height);
|
|
360
|
+
if (widthChange > heightChange) {
|
|
361
|
+
height = width / aspectRatio;
|
|
362
|
+
} else {
|
|
363
|
+
width = height * aspectRatio;
|
|
364
|
+
}
|
|
365
|
+
if (handle.includes("w")) {
|
|
366
|
+
x = this.startElement.origin.x + this.startElement.size.width - width;
|
|
367
|
+
}
|
|
368
|
+
if (handle.includes("n")) {
|
|
369
|
+
y = this.startElement.origin.y + this.startElement.size.height - height;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
const bbox = (_a = this.config.constraints) == null ? void 0 : _a.boundingBox;
|
|
374
|
+
if (bbox) {
|
|
375
|
+
switch (handle) {
|
|
376
|
+
case "e":
|
|
377
|
+
width = Math.min(width, bbox.width - x);
|
|
378
|
+
break;
|
|
379
|
+
case "s":
|
|
380
|
+
height = Math.min(height, bbox.height - y);
|
|
381
|
+
break;
|
|
382
|
+
case "se":
|
|
383
|
+
width = Math.min(width, bbox.width - x);
|
|
384
|
+
height = Math.min(height, bbox.height - y);
|
|
385
|
+
break;
|
|
386
|
+
case "w":
|
|
387
|
+
if (x < 0) {
|
|
388
|
+
width += x;
|
|
389
|
+
x = 0;
|
|
390
|
+
}
|
|
391
|
+
break;
|
|
392
|
+
case "n":
|
|
393
|
+
if (y < 0) {
|
|
394
|
+
height += y;
|
|
395
|
+
y = 0;
|
|
396
|
+
}
|
|
397
|
+
break;
|
|
398
|
+
case "sw":
|
|
399
|
+
if (x < 0) {
|
|
400
|
+
width += x;
|
|
401
|
+
x = 0;
|
|
402
|
+
}
|
|
403
|
+
height = Math.min(height, bbox.height - y);
|
|
404
|
+
break;
|
|
405
|
+
case "nw":
|
|
406
|
+
if (x < 0) {
|
|
407
|
+
width += x;
|
|
408
|
+
x = 0;
|
|
409
|
+
}
|
|
410
|
+
if (y < 0) {
|
|
411
|
+
height += y;
|
|
412
|
+
y = 0;
|
|
413
|
+
}
|
|
414
|
+
break;
|
|
415
|
+
case "ne":
|
|
416
|
+
width = Math.min(width, bbox.width - x);
|
|
417
|
+
if (y < 0) {
|
|
418
|
+
height += y;
|
|
419
|
+
y = 0;
|
|
420
|
+
}
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return this.applyConstraints({ origin: { x, y }, size: { width, height } });
|
|
425
|
+
}
|
|
426
|
+
applyConstraints(position) {
|
|
427
|
+
const { constraints } = this.config;
|
|
428
|
+
if (!constraints) return position;
|
|
429
|
+
let {
|
|
430
|
+
origin: { x, y },
|
|
431
|
+
size: { width, height }
|
|
432
|
+
} = position;
|
|
433
|
+
width = Math.max(constraints.minWidth || 1, width);
|
|
434
|
+
height = Math.max(constraints.minHeight || 1, height);
|
|
435
|
+
if (constraints.maxWidth) width = Math.min(constraints.maxWidth, width);
|
|
436
|
+
if (constraints.maxHeight) height = Math.min(constraints.maxHeight, height);
|
|
437
|
+
if (constraints.boundingBox) {
|
|
438
|
+
x = Math.max(0, Math.min(x, constraints.boundingBox.width - width));
|
|
439
|
+
y = Math.max(0, Math.min(y, constraints.boundingBox.height - height));
|
|
440
|
+
}
|
|
441
|
+
return { origin: { x, y }, size: { width, height } };
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
function useDragResize(options) {
|
|
445
|
+
const controller = ref(null);
|
|
446
|
+
const { onUpdate, enabled = true, ...config } = options;
|
|
447
|
+
if (!controller.value) {
|
|
448
|
+
controller.value = new DragResizeController(config, (event) => onUpdate == null ? void 0 : onUpdate(event));
|
|
449
|
+
}
|
|
450
|
+
watch(
|
|
451
|
+
() => ({
|
|
452
|
+
element: config.element,
|
|
453
|
+
constraints: config.constraints,
|
|
454
|
+
maintainAspectRatio: config.maintainAspectRatio,
|
|
455
|
+
pageRotation: config.pageRotation,
|
|
456
|
+
scale: config.scale
|
|
457
|
+
}),
|
|
458
|
+
(newConfig) => {
|
|
459
|
+
var _a;
|
|
460
|
+
(_a = controller.value) == null ? void 0 : _a.updateConfig(newConfig);
|
|
461
|
+
},
|
|
462
|
+
{ deep: true }
|
|
463
|
+
);
|
|
464
|
+
onUnmounted(() => {
|
|
465
|
+
controller.value = null;
|
|
466
|
+
});
|
|
467
|
+
const handleDragStart = (e) => {
|
|
468
|
+
var _a;
|
|
469
|
+
if (!enabled) return;
|
|
470
|
+
e.preventDefault();
|
|
471
|
+
e.stopPropagation();
|
|
472
|
+
(_a = controller.value) == null ? void 0 : _a.startDrag(e.clientX, e.clientY);
|
|
473
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
474
|
+
};
|
|
475
|
+
const handleMove = (e) => {
|
|
476
|
+
var _a;
|
|
477
|
+
(_a = controller.value) == null ? void 0 : _a.move(e.clientX, e.clientY);
|
|
478
|
+
};
|
|
479
|
+
const handleEnd = (e) => {
|
|
480
|
+
var _a, _b, _c;
|
|
481
|
+
(_a = controller.value) == null ? void 0 : _a.end();
|
|
482
|
+
(_c = (_b = e.currentTarget).releasePointerCapture) == null ? void 0 : _c.call(_b, e.pointerId);
|
|
483
|
+
};
|
|
484
|
+
const handleCancel = (e) => {
|
|
485
|
+
var _a, _b, _c;
|
|
486
|
+
(_a = controller.value) == null ? void 0 : _a.cancel();
|
|
487
|
+
(_c = (_b = e.currentTarget).releasePointerCapture) == null ? void 0 : _c.call(_b, e.pointerId);
|
|
488
|
+
};
|
|
489
|
+
const createResizeProps = (handle) => ({
|
|
490
|
+
onPointerdown: (e) => {
|
|
491
|
+
var _a;
|
|
492
|
+
if (!enabled) return;
|
|
493
|
+
e.preventDefault();
|
|
494
|
+
e.stopPropagation();
|
|
495
|
+
(_a = controller.value) == null ? void 0 : _a.startResize(handle, e.clientX, e.clientY);
|
|
496
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
497
|
+
},
|
|
498
|
+
onPointermove: handleMove,
|
|
499
|
+
onPointerup: handleEnd,
|
|
500
|
+
onPointercancel: handleCancel
|
|
501
|
+
});
|
|
502
|
+
const dragProps = computed(
|
|
503
|
+
() => enabled ? {
|
|
504
|
+
onPointerdown: handleDragStart,
|
|
505
|
+
onPointermove: handleMove,
|
|
506
|
+
onPointerup: handleEnd,
|
|
507
|
+
onPointercancel: handleCancel
|
|
508
|
+
} : {}
|
|
509
|
+
);
|
|
510
|
+
return {
|
|
511
|
+
dragProps,
|
|
512
|
+
createResizeProps
|
|
513
|
+
};
|
|
514
|
+
}
|
|
40
515
|
export {
|
|
41
|
-
_sfc_main as CounterRotate
|
|
516
|
+
_sfc_main as CounterRotate,
|
|
517
|
+
useDragResize
|
|
42
518
|
};
|
|
43
519
|
//# sourceMappingURL=index.js.map
|
package/dist/vue/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/vue/components/counter-rotate-container.vue"],"sourcesContent":["<template>\n <slot :menu-wrapper-props=\"menuWrapperProps\" :matrix=\"matrix\" :rect=\"adjustedRect\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, type CSSProperties } from 'vue';\nimport type { Rect, Rotation } from '@embedpdf/models';\nimport { getCounterRotation } from '@embedpdf/utils';\n\ninterface CounterRotateProps {\n rect: Rect;\n rotation: Rotation;\n}\n\nconst props = defineProps<CounterRotateProps>();\n\nconst { matrix, width, height } = getCounterRotation(props.rect, props.rotation);\n\nconst menuWrapperProps = computed(() => ({\n style: {\n position: 'absolute',\n left: `${props.rect.origin.x}px`,\n top: `${props.rect.origin.y}px`,\n transform: matrix,\n transformOrigin: '0 0',\n width: `${width}px`,\n height: `${height}px`,\n pointerEvents: 'none',\n zIndex: 3,\n } as CSSProperties,\n onPointerDown: (e: PointerEvent) => e.stopPropagation(),\n onTouchStart: (e: TouchEvent) => e.stopPropagation(),\n}));\n\nconst adjustedRect = computed(() => ({\n origin: { x: props.rect.origin.x, y: props.rect.origin.y },\n size: { width, height },\n}));\n</script>\n"],"names":["_renderSlot","_unref"],"mappings":";;;;;;;;;AAcA,UAAM,QAAQ;AAER,UAAA,EAAE,QAAQ,OAAO,WAAW,mBAAmB,MAAM,MAAM,MAAM,QAAQ;AAEzE,UAAA,mBAAmB,SAAS,OAAO;AAAA,MACvC,OAAO;AAAA,QACL,UAAU;AAAA,QACV,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC;AAAA,QAC5B,KAAK,GAAG,MAAM,KAAK,OAAO,CAAC;AAAA,QAC3B,WAAW;AAAA,QACX,iBAAiB;AAAA,QACjB,OAAO,GAAG,KAAK;AAAA,QACf,QAAQ,GAAG,MAAM;AAAA,QACjB,eAAe;AAAA,QACf,QAAQ;AAAA,MACV;AAAA,MACA,eAAe,CAAC,MAAoB,EAAE,gBAAgB;AAAA,MACtD,cAAc,CAAC,MAAkB,EAAE,gBAAgB;AAAA,IAAA,EACnD;AAEI,UAAA,eAAe,SAAS,OAAO;AAAA,MACnC,QAAQ,EAAE,GAAG,MAAM,KAAK,OAAO,GAAG,GAAG,MAAM,KAAK,OAAO,EAAE;AAAA,MACzD,MAAM,EAAE,OAAO,OAAO;AAAA,IAAA,EACtB;;AApCA,aAAAA,WAAqF,KAAA,QAAA,WAAA;AAAA,QAA9E,kBAAoB,iBAAgB;AAAA,QAAG,QAAQC,MAAM,MAAA;AAAA,QAAG,MAAM,aAAY;AAAA,MAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/vue/components/counter-rotate-container.vue","../../src/shared/plugin-interaction-primitives/drag-resize-controller.ts","../../src/vue/hooks/use-drag-resize.ts"],"sourcesContent":["<template>\n <slot :menu-wrapper-props=\"menuWrapperProps\" :matrix=\"matrix\" :rect=\"adjustedRect\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, type CSSProperties } from 'vue';\nimport type { Rect, Rotation } from '@embedpdf/models';\nimport { getCounterRotation } from '@embedpdf/utils';\n\ninterface CounterRotateProps {\n rect: Rect;\n rotation: Rotation;\n}\n\nconst props = defineProps<CounterRotateProps>();\n\nconst { matrix, width, height } = getCounterRotation(props.rect, props.rotation);\n\nconst menuWrapperProps = computed(() => ({\n style: {\n position: 'absolute',\n left: `${props.rect.origin.x}px`,\n top: `${props.rect.origin.y}px`,\n transform: matrix,\n transformOrigin: '0 0',\n width: `${width}px`,\n height: `${height}px`,\n pointerEvents: 'none',\n zIndex: 3,\n } as CSSProperties,\n onPointerDown: (e: PointerEvent) => e.stopPropagation(),\n onTouchStart: (e: TouchEvent) => e.stopPropagation(),\n}));\n\nconst adjustedRect = computed(() => ({\n origin: { x: props.rect.origin.x, y: props.rect.origin.y },\n size: { width, height },\n}));\n</script>\n","import { Position, Rect } from '@embedpdf/models';\n\nexport interface DragResizeConfig {\n element: Rect;\n vertices?: Position[];\n constraints?: {\n minWidth?: number;\n minHeight?: number;\n maxWidth?: number;\n maxHeight?: number;\n boundingBox?: { width: number; height: number }; // page bounds\n };\n maintainAspectRatio?: boolean;\n pageRotation?: number;\n scale?: number;\n}\n\nexport type InteractionState = 'idle' | 'dragging' | 'resizing' | 'vertex-editing';\nexport type ResizeHandle = 'nw' | 'ne' | 'sw' | 'se' | 'n' | 'e' | 's' | 'w';\n\nexport interface TransformData {\n type: 'move' | 'resize' | 'vertex-edit';\n changes: {\n rect?: Rect;\n vertices?: Position[];\n };\n metadata?: {\n handle?: ResizeHandle;\n vertexIndex?: number;\n maintainAspectRatio?: boolean;\n };\n}\n\nexport interface InteractionEvent {\n state: 'start' | 'move' | 'end';\n transformData?: TransformData;\n}\n\n/**\n * Pure geometric controller that manages drag/resize/vertex-edit logic.\n */\nexport class DragResizeController {\n private state: InteractionState = 'idle';\n private startPoint: Position | null = null;\n private startElement: Rect | null = null;\n private activeHandle: ResizeHandle | null = null;\n private currentPosition: Rect | null = null;\n\n // Vertex editing state - pure geometric\n private activeVertexIndex: number | null = null;\n private startVertices: Position[] = [];\n private currentVertices: Position[] = [];\n\n constructor(\n private config: DragResizeConfig,\n private onUpdate: (event: InteractionEvent) => void,\n ) {\n this.currentVertices = config.vertices || [];\n }\n\n updateConfig(config: Partial<DragResizeConfig>) {\n this.config = { ...this.config, ...config };\n this.currentVertices = config.vertices || [];\n }\n\n startDrag(clientX: number, clientY: number) {\n this.state = 'dragging';\n this.startPoint = { x: clientX, y: clientY };\n this.startElement = { ...this.config.element };\n this.currentPosition = { ...this.config.element };\n\n this.onUpdate({\n state: 'start',\n transformData: {\n type: 'move',\n changes: {\n rect: this.startElement,\n },\n },\n });\n }\n\n startResize(handle: ResizeHandle, clientX: number, clientY: number) {\n this.state = 'resizing';\n this.activeHandle = handle;\n this.startPoint = { x: clientX, y: clientY };\n this.startElement = { ...this.config.element };\n this.currentPosition = { ...this.config.element };\n\n this.onUpdate({\n state: 'start',\n transformData: {\n type: 'resize',\n changes: {\n rect: this.startElement,\n },\n metadata: {\n handle: this.activeHandle,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n }\n\n startVertexEdit(vertexIndex: number, clientX: number, clientY: number) {\n // Refresh vertices from latest config before validating index\n this.currentVertices = [...(this.config.vertices ?? this.currentVertices)];\n if (vertexIndex < 0 || vertexIndex >= this.currentVertices.length) return;\n\n this.state = 'vertex-editing';\n this.activeVertexIndex = vertexIndex;\n this.startPoint = { x: clientX, y: clientY };\n this.startVertices = [...this.currentVertices];\n\n this.onUpdate({\n state: 'start',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices: this.startVertices,\n },\n metadata: {\n vertexIndex,\n },\n },\n });\n }\n\n move(clientX: number, clientY: number) {\n if (this.state === 'idle' || !this.startPoint) return;\n\n if (this.state === 'dragging' && this.startElement) {\n const delta = this.calculateDelta(clientX, clientY);\n const position = this.calculateDragPosition(delta);\n this.currentPosition = position;\n\n this.onUpdate({\n state: 'move',\n transformData: {\n type: 'move',\n changes: {\n rect: position,\n },\n },\n });\n } else if (this.state === 'resizing' && this.activeHandle && this.startElement) {\n const delta = this.calculateDelta(clientX, clientY);\n const position = this.calculateResizePosition(delta, this.activeHandle);\n this.currentPosition = position;\n\n this.onUpdate({\n state: 'move',\n transformData: {\n type: 'resize',\n changes: {\n rect: position,\n },\n metadata: {\n handle: this.activeHandle,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n } else if (this.state === 'vertex-editing' && this.activeVertexIndex !== null) {\n const vertices = this.calculateVertexPosition(clientX, clientY);\n this.currentVertices = vertices;\n\n this.onUpdate({\n state: 'move',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices,\n },\n metadata: {\n vertexIndex: this.activeVertexIndex,\n },\n },\n });\n }\n }\n\n end() {\n if (this.state === 'idle') return;\n\n const wasState = this.state;\n const handle = this.activeHandle;\n const vertexIndex = this.activeVertexIndex;\n\n if (wasState === 'vertex-editing') {\n this.onUpdate({\n state: 'end',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices: this.currentVertices,\n },\n metadata: {\n vertexIndex: vertexIndex || undefined,\n },\n },\n });\n } else {\n const finalPosition = this.getCurrentPosition();\n this.onUpdate({\n state: 'end',\n transformData: {\n type: wasState === 'dragging' ? 'move' : 'resize',\n changes: {\n rect: finalPosition,\n },\n metadata:\n wasState === 'dragging'\n ? undefined\n : {\n handle: handle || undefined,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n }\n\n this.reset();\n }\n\n cancel() {\n if (this.state === 'idle') return;\n\n if (this.state === 'vertex-editing') {\n this.onUpdate({\n state: 'end',\n transformData: {\n type: 'vertex-edit',\n changes: {\n vertices: this.startVertices,\n },\n metadata: {\n vertexIndex: this.activeVertexIndex || undefined,\n },\n },\n });\n } else if (this.startElement) {\n this.onUpdate({\n state: 'end',\n transformData: {\n type: this.state === 'dragging' ? 'move' : 'resize',\n changes: {\n rect: this.startElement,\n },\n metadata:\n this.state === 'dragging'\n ? undefined\n : {\n handle: this.activeHandle || undefined,\n maintainAspectRatio: this.config.maintainAspectRatio,\n },\n },\n });\n }\n\n this.reset();\n }\n\n private reset() {\n this.state = 'idle';\n this.startPoint = null;\n this.startElement = null;\n this.activeHandle = null;\n this.currentPosition = null;\n this.activeVertexIndex = null;\n this.startVertices = [];\n }\n\n private getCurrentPosition() {\n return this.currentPosition || this.config.element;\n }\n\n private calculateDelta(clientX: number, clientY: number): Position {\n if (!this.startPoint) return { x: 0, y: 0 };\n\n const rawDelta: Position = {\n x: clientX - this.startPoint.x,\n y: clientY - this.startPoint.y,\n };\n\n return this.transformDelta(rawDelta);\n }\n\n private transformDelta(delta: Position): Position {\n const { pageRotation = 0, scale = 1 } = this.config;\n\n const rad = (pageRotation * Math.PI) / 2;\n const cos = Math.cos(rad);\n const sin = Math.sin(rad);\n\n const scaledX = delta.x / scale;\n const scaledY = delta.y / scale;\n\n return {\n x: cos * scaledX + sin * scaledY,\n y: -sin * scaledX + cos * scaledY,\n };\n }\n\n private clampPoint(p: Position): Position {\n const bbox = this.config.constraints?.boundingBox;\n if (!bbox) return p;\n return {\n x: Math.max(0, Math.min(p.x, bbox.width)),\n y: Math.max(0, Math.min(p.y, bbox.height)),\n };\n }\n\n private calculateVertexPosition(clientX: number, clientY: number): Position[] {\n if (this.activeVertexIndex === null) return this.startVertices;\n\n const delta = this.calculateDelta(clientX, clientY);\n const newVertices = [...this.startVertices];\n const currentVertex = newVertices[this.activeVertexIndex];\n\n const moved = {\n x: currentVertex.x + delta.x,\n y: currentVertex.y + delta.y,\n };\n newVertices[this.activeVertexIndex] = this.clampPoint(moved);\n\n return newVertices;\n }\n\n private calculateDragPosition(delta: Position): Rect {\n if (!this.startElement) return this.config.element;\n\n const position: Rect = {\n origin: {\n x: this.startElement.origin.x + delta.x,\n y: this.startElement.origin.y + delta.y,\n },\n size: {\n width: this.startElement.size.width,\n height: this.startElement.size.height,\n },\n };\n\n return this.applyConstraints(position);\n }\n\n private calculateResizePosition(delta: Position, handle: ResizeHandle): Rect {\n if (!this.startElement) return this.config.element;\n\n let {\n origin: { x, y },\n size: { width, height },\n } = this.startElement;\n\n switch (handle) {\n case 'se':\n width += delta.x;\n height += delta.y;\n break;\n case 'sw':\n x += delta.x;\n width -= delta.x;\n height += delta.y;\n break;\n case 'ne':\n width += delta.x;\n y += delta.y;\n height -= delta.y;\n break;\n case 'nw':\n x += delta.x;\n width -= delta.x;\n y += delta.y;\n height -= delta.y;\n break;\n case 'n':\n y += delta.y;\n height -= delta.y;\n break;\n case 's':\n height += delta.y;\n break;\n case 'e':\n width += delta.x;\n break;\n case 'w':\n x += delta.x;\n width -= delta.x;\n break;\n }\n\n // Maintain aspect ratio if needed\n if (this.config.maintainAspectRatio && this.startElement) {\n const aspectRatio = this.startElement.size.width / this.startElement.size.height;\n\n if (['n', 's', 'e', 'w'].includes(handle)) {\n if (handle === 'n' || handle === 's') {\n const newWidth = height * aspectRatio;\n const widthDiff = newWidth - width;\n width = newWidth;\n x -= widthDiff / 2;\n } else {\n const newHeight = width / aspectRatio;\n const heightDiff = newHeight - height;\n height = newHeight;\n if (handle === 'w') {\n x = this.startElement.origin.x + this.startElement.size.width - width;\n }\n y -= heightDiff / 2;\n }\n } else {\n const widthChange = Math.abs(width - this.startElement.size.width);\n const heightChange = Math.abs(height - this.startElement.size.height);\n if (widthChange > heightChange) {\n height = width / aspectRatio;\n } else {\n width = height * aspectRatio;\n }\n if (handle.includes('w')) {\n x = this.startElement.origin.x + this.startElement.size.width - width;\n }\n if (handle.includes('n')) {\n y = this.startElement.origin.y + this.startElement.size.height - height;\n }\n }\n }\n\n // Handle-aware bounding box clamping to avoid shifting opposite edge\n const bbox = this.config.constraints?.boundingBox;\n if (bbox) {\n switch (handle) {\n case 'e':\n width = Math.min(width, bbox.width - x);\n break;\n case 's':\n height = Math.min(height, bbox.height - y);\n break;\n case 'se':\n width = Math.min(width, bbox.width - x);\n height = Math.min(height, bbox.height - y);\n break;\n case 'w':\n if (x < 0) {\n width += x;\n x = 0;\n }\n break;\n case 'n':\n if (y < 0) {\n height += y;\n y = 0;\n }\n break;\n case 'sw':\n if (x < 0) {\n width += x;\n x = 0;\n }\n height = Math.min(height, bbox.height - y);\n break;\n case 'nw':\n if (x < 0) {\n width += x;\n x = 0;\n }\n if (y < 0) {\n height += y;\n y = 0;\n }\n break;\n case 'ne':\n width = Math.min(width, bbox.width - x);\n if (y < 0) {\n height += y;\n y = 0;\n }\n break;\n }\n }\n\n return this.applyConstraints({ origin: { x, y }, size: { width, height } });\n }\n\n private applyConstraints(position: Rect): Rect {\n const { constraints } = this.config;\n if (!constraints) return position;\n\n let {\n origin: { x, y },\n size: { width, height },\n } = position;\n\n // Apply size constraints\n width = Math.max(constraints.minWidth || 1, width);\n height = Math.max(constraints.minHeight || 1, height);\n\n if (constraints.maxWidth) width = Math.min(constraints.maxWidth, width);\n if (constraints.maxHeight) height = Math.min(constraints.maxHeight, height);\n\n // Apply bounding box constraints\n if (constraints.boundingBox) {\n x = Math.max(0, Math.min(x, constraints.boundingBox.width - width));\n y = Math.max(0, Math.min(y, constraints.boundingBox.height - height));\n }\n\n return { origin: { x, y }, size: { width, height } };\n }\n}\n","import { ref, watch, computed, onUnmounted } from 'vue';\nimport {\n DragResizeController,\n DragResizeConfig,\n InteractionEvent,\n ResizeHandle,\n} from '../../shared/plugin-interaction-primitives';\n\nexport interface UseDragResizeOptions extends DragResizeConfig {\n onUpdate?: (event: InteractionEvent) => void;\n enabled?: boolean;\n}\n\nexport function useDragResize(options: UseDragResizeOptions) {\n const controller = ref<DragResizeController | null>(null);\n\n // Extract reactive options\n const { onUpdate, enabled = true, ...config } = options;\n\n // Initialize controller\n if (!controller.value) {\n controller.value = new DragResizeController(config, (event) => onUpdate?.(event));\n }\n\n // Watch for config changes\n watch(\n () => ({\n element: config.element,\n constraints: config.constraints,\n maintainAspectRatio: config.maintainAspectRatio,\n pageRotation: config.pageRotation,\n scale: config.scale,\n }),\n (newConfig) => {\n controller.value?.updateConfig(newConfig);\n },\n { deep: true },\n );\n\n // Cleanup on unmount\n onUnmounted(() => {\n controller.value = null;\n });\n\n // Drag handlers\n const handleDragStart = (e: PointerEvent) => {\n if (!enabled) return;\n e.preventDefault();\n e.stopPropagation();\n controller.value?.startDrag(e.clientX, e.clientY);\n (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);\n };\n\n const handleMove = (e: PointerEvent) => {\n controller.value?.move(e.clientX, e.clientY);\n };\n\n const handleEnd = (e: PointerEvent) => {\n controller.value?.end();\n (e.currentTarget as HTMLElement).releasePointerCapture?.(e.pointerId);\n };\n\n const handleCancel = (e: PointerEvent) => {\n controller.value?.cancel();\n (e.currentTarget as HTMLElement).releasePointerCapture?.(e.pointerId);\n };\n\n // Create resize handler factory\n const createResizeProps = (handle: ResizeHandle) => ({\n onPointerdown: (e: PointerEvent) => {\n if (!enabled) return;\n e.preventDefault();\n e.stopPropagation();\n controller.value?.startResize(handle, e.clientX, e.clientY);\n (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);\n },\n onPointermove: handleMove,\n onPointerup: handleEnd,\n onPointercancel: handleCancel,\n });\n\n // Computed drag props\n const dragProps = computed(() =>\n enabled\n ? {\n onPointerdown: handleDragStart,\n onPointermove: handleMove,\n onPointerup: handleEnd,\n onPointercancel: handleCancel,\n }\n : {},\n );\n\n return {\n dragProps,\n createResizeProps,\n };\n}\n"],"names":["_renderSlot","_unref"],"mappings":";;;;;;;;;AAcA,UAAM,QAAQ;AAER,UAAA,EAAE,QAAQ,OAAO,WAAW,mBAAmB,MAAM,MAAM,MAAM,QAAQ;AAEzE,UAAA,mBAAmB,SAAS,OAAO;AAAA,MACvC,OAAO;AAAA,QACL,UAAU;AAAA,QACV,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC;AAAA,QAC5B,KAAK,GAAG,MAAM,KAAK,OAAO,CAAC;AAAA,QAC3B,WAAW;AAAA,QACX,iBAAiB;AAAA,QACjB,OAAO,GAAG,KAAK;AAAA,QACf,QAAQ,GAAG,MAAM;AAAA,QACjB,eAAe;AAAA,QACf,QAAQ;AAAA,MACV;AAAA,MACA,eAAe,CAAC,MAAoB,EAAE,gBAAgB;AAAA,MACtD,cAAc,CAAC,MAAkB,EAAE,gBAAgB;AAAA,IAAA,EACnD;AAEI,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,UAAI,CAAC,QAAS;AACd,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,uBAAW,UAAX,mBAAkB,YAAY,QAAQ,EAAE,SAAS,EAAE;AAClD,QAAE,cAA8B,kBAAkB,EAAE,SAAS;AAAA,IAChE;AAAA,IACA,eAAe;AAAA,IACf,aAAa;AAAA,IACb,iBAAiB;AAAA,EAAA;AAInB,QAAM,YAAY;AAAA,IAAS,MACzB,UACI;AAAA,MACE,eAAe;AAAA,MACf,eAAe;AAAA,MACf,aAAa;AAAA,MACb,iBAAiB;AAAA,IAAA,IAEnB,CAAA;AAAA,EACN;AAEO,SAAA;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared utility helpers (geometry, tasks, logging, PDF primitives) that underpin every package in the EmbedPDF ecosystem.",
|
|
6
6
|
"type": "module",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"typescript": "^5.0.0",
|
|
49
49
|
"@types/react": "^18.2.0",
|
|
50
|
-
"@embedpdf/models": "1.
|
|
50
|
+
"@embedpdf/models": "1.2.0",
|
|
51
51
|
"@embedpdf/build": "1.0.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|