react-beautiful-dnd
Version:
A beautiful, accessible drag and drop library for lists with React.js
17 lines (14 loc) • 396 B
JavaScript
// @flow
import type {
Position,
DroppableDimension,
DimensionFragment,
} from '../types';
export default (target: Position, dimension: DroppableDimension): boolean => {
const fragment: DimensionFragment = dimension.page.withMargin;
const { top, right, bottom, left } = fragment;
return target.x >= left &&
target.x <= right &&
target.y >= top &&
target.y <= bottom;
};