@hello-pangea/dnd
Version:
Beautiful and accessible drag and drop for lists with React
13 lines (10 loc) • 384 B
text/typescript
import type { Rect } from 'css-box-model';
import type { Scrollable, DroppableDimension } from '../../types';
import { offsetRectByPosition } from '../rect';
export default (droppable: DroppableDimension, area: Rect): Rect => {
const frame: Scrollable | null = droppable.frame;
if (!frame) {
return area;
}
return offsetRectByPosition(area, frame.scroll.diff.value);
};