UNPKG

@atlaskit/pragmatic-drag-and-drop-hitbox

Version:

An optional package for Pragmatic drag and drop that enables the attaching of interaction information to a drop target

33 lines (32 loc) • 1.12 kB
// using a symbol so we can guarantee a key with a unique value export var uniqueKey = Symbol('list-item-instruction'); export var axisLookup = { vertical: { start: 'top', end: 'bottom', size: 'height', point: 'y' }, horizontal: { start: 'left', end: 'right', size: 'width', point: 'x' } }; export function reorder(_ref) { var client = _ref.client, borderBox = _ref.borderBox, axis = _ref.axis; var halfSize = borderBox[axis.size] / 2; // In the top 1/2: reorder-before // On the line: reorder-after to give a slight preference to moving forward if (client[axis.point] < borderBox[axis.start] + halfSize) { return 'reorder-before'; } return 'reorder-after'; } // eslint-disable-next-line @atlaskit/volt-strict-mode/no-re-exports -- Disabled via Volt Codemod. Do not add more exports to this file. export { attachInstruction } from './attach-instruction-2'; // eslint-disable-next-line @atlaskit/volt-strict-mode/no-re-exports -- Disabled via Volt Codemod. Do not add more exports to this file. export { extractInstruction } from './extract-instruction-2';