MCPcopy
hub / github.com/react-grid-layout/react-grid-layout / getFirstCollision

Function getFirstCollision

src/core/collision.ts:40–51  ·  view source on GitHub ↗
(
  layout: Layout,
  layoutItem: LayoutItem
)

Source from the content-addressed store, hash-verified

38 * @returns The first colliding item, or undefined if none
39 */
40export function getFirstCollision(
41 layout: Layout,
42 layoutItem: LayoutItem
43): LayoutItem | undefined {
44 for (let i = 0; i < layout.length; i++) {
45 const item = layout[i];
46 if (item !== undefined && collides(item, layoutItem)) {
47 return item;
48 }
49 }
50 return undefined;
51}
52
53/**
54 * Find all items in the layout that collide with the given item.

Callers 6

compactItemVerticalFunction · 0.85
compactItemHorizontalFunction · 0.85
correctBoundsFunction · 0.85
compactItemInternalFunction · 0.85

Calls 1

collidesFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…