react-beautiful-dnd
Version:
Beautiful, accessible drag and drop for lists with React.js
10 lines (8 loc) • 399 B
JavaScript
// @flow
import type { Position } from '../../../types';
// The amount of pixels that need to move before we consider the movement
// a drag rather than a click.
export const sloppyClickThreshold: number = 5;
export default (original: Position, current: Position): boolean =>
Math.abs(current.x - original.x) >= sloppyClickThreshold ||
Math.abs(current.y - original.y) >= sloppyClickThreshold;