.filter((droppable: DroppableDimension) => { const isWithinDroppable = isWithin( getSafeClipped(droppable)[axis.start], getSafeClipped(droppable)[axis.end] ); return isWithinDroppable(pageBorderBoxCenter[axis.line]); });
.sort((a: DroppableDimension, b: DroppableDimension) => { const first: number = getSafeClipped(a)[axis.crossAxisStart]; const second: number = getSafeClipped(b)[axis.crossAxisStart]; if (isMovingForward) { return first - second; } return second - first; })
return candidates.sort((a: DroppableDimension, b: DroppableDimension): number => { const first = closest(pageBorderBoxCenter, getCorners(getSafeClipped(a))); const second = closest(pageBorderBoxCenter, getCorners(getSafeClipped(b))); // if the distances are not equal - choose the shortest if (first !== second) { return first - second; } // They both have the same distance - // choose the one that is first on the main axis return getSafeClipped(a)[axis.start] - getSafeClipped(b)[axis.start]; })[0];
.filter((droppable: DroppableDimension): boolean => { const targetClipped: Rect = getSafeClipped(droppable); if (isMovingForward) { // is the droppable in front of the source on the cross axis? return sourceClipped[axis.crossAxisEnd] <= targetClipped[axis.crossAxisStart]; } // is the droppable behind the source on the cross axis? return targetClipped[axis.crossAxisEnd] <= sourceClipped[axis.crossAxisStart]; })
.filter((droppable: DroppableDimension): boolean => { const targetClipped: Rect = getSafeClipped(droppable); const isBetweenDestinationClipped = isWithin( targetClipped[axis.start], targetClipped[axis.end] ); return isBetweenSourceClipped(targetClipped[axis.start]) || isBetweenSourceClipped(targetClipped[axis.end]) || isBetweenDestinationClipped(sourceClipped[axis.start]) || isBetweenDestinationClipped(sourceClipped[axis.end]); })
return contains.sort((a: DroppableDimension, b: DroppableDimension): number => ( getSafeClipped(a)[axis.start] - getSafeClipped(b)[axis.start] ))[0];
.filter((droppable: DroppableDimension, index: number, array: DroppableDimension[]): boolean => getSafeClipped(droppable)[axis.crossAxisStart] === getSafeClipped(array[0])[axis.crossAxisStart]