Skip to Content
API훅 API

useDragBlock

type UseDragBlockProps<T extends BlockType> = { containerRef: React.RefObject<HTMLDivElement | null>; scrollOffset: number; workBlocks: T[]; updateWorkBlockCallback: (updatedBlock: T) => void; updateWorkBlocks: (blocks: T[]) => void; collisionOptions?: { enabled?: boolean; mode?: 'rectangle' | 'circle' | 'obb'; }; snapToGridOptions?: { enabled?: boolean; gridSize?: number; }; };

반환

{ draggingBlock: T | null; dragPointerPosition: { x: number; y: number } | null; dragOffset: { x: number; y: number }; handleStartDrag: (e: PointerEvent, block: T) => void; collidedIds: number[]; }

useRotateBlock

type UseRotateBlockProps<T extends BlockType> = { containerRef: React.RefObject<HTMLDivElement | null>; scrollOffset: number; workBlocks: T[]; updateWorkBlockCallback: (updatedBlock: T) => void; updateWorkBlocks: (blocks: T[]) => void; collisionOptions?: { enabled?: boolean; mode?: 'obb' | 'rectangle' | 'circle'; }; };

반환

{ rotatingBlock: T | null; handleStartRotate: (e: PointerEvent, block: T) => void; collidedIds: number[]; }

useBlocksTransition

const { animateBlocksTransition } = useBlocksTransition<T>(updateWorkBlocks);
animateBlocksTransition(prevBlocks: T[], nextBlocks: T[], durationMs = 250)

useSetPointerEvents

useSetPointerEvents({ onPointerMove?: (e: PointerEvent) => void; onPointerUp?: (e: PointerEvent) => void; })
Last updated on