MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / collide

Method collide

src/gridstack-engine.ts:182–186  ·  view source on GitHub ↗

* Return the first node that intercepts/collides with the given node or area. * Used for collision detection during drag and drop operations. * * @param skip the node to skip in collision detection (usually the node being moved) * @param area the area to check for collisions (defaults to

(skip: GridStackNode, area = skip, skip2?: GridStackNode)

Source from the content-addressed store, hash-verified

180 * }
181 */
182 public collide(skip: GridStackNode, area = skip, skip2?: GridStackNode): GridStackNode | undefined {
183 const skipId = skip._id;
184 const skip2Id = skip2?._id;
185 return this.nodes.find(n => n._id !== skipId && n._id !== skip2Id && Utils.isIntercepted(n, area));
186 }
187 /**
188 * Return all nodes that intercept/collide with the given node or area.
189 * Similar to collide() but returns all colliding nodes instead of just the first.

Callers 4

_fixCollisionsMethod · 0.95
isAreaEmptyMethod · 0.95
_packNodesMethod · 0.95
_dragOrResizeMethod · 0.80

Calls 2

findMethod · 0.80
isInterceptedMethod · 0.80

Tested by

no test coverage detected