Function
getModalPositionResetKey
({
isOpen,
estimatedWidth,
estimatedHeight,
initialPosition,
}: UseModalDragOptions)
Source from the content-addressed store, hash-verified
| 83 | } |
| 84 | |
| 85 | function getModalPositionResetKey({ |
| 86 | isOpen, |
| 87 | estimatedWidth, |
| 88 | estimatedHeight, |
| 89 | initialPosition, |
| 90 | }: UseModalDragOptions): string { |
| 91 | if (!isOpen) return 'closed'; |
| 92 | if (initialPosition) { |
| 93 | return `cursor:${estimatedWidth}:${estimatedHeight}:${initialPosition.x}:${initialPosition.y}`; |
| 94 | } |
| 95 | return `center:${estimatedWidth}:${estimatedHeight}`; |
| 96 | } |
| 97 | |
| 98 | export function useModalDrag({ estimatedWidth, estimatedHeight, isOpen, initialPosition }: UseModalDragOptions) { |
| 99 | const initialEstimatedPosition = isOpen |
Tested by
no test coverage detected