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

Method collideAll

src/gridstack-engine.ts:200–204  ·  view source on GitHub ↗

* Return all nodes that intercept/collide with the given node or area. * Similar to collide() but returns all colliding nodes instead of just the first. * * @param skip the node to skip in collision detection * @param area the area to check for collisions (defaults to skip node's area)

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

Source from the content-addressed store, hash-verified

198 * console.log('Colliding with', allCollisions.length, 'nodes');
199 */
200 public collideAll(skip: GridStackNode, area = skip, skip2?: GridStackNode): GridStackNode[] {
201 const skipId = skip._id;
202 const skip2Id = skip2?._id;
203 return this.nodes.filter(n => n._id !== skipId && n._id !== skip2Id && Utils.isIntercepted(n, area));
204 }
205
206 /** does a pixel coverage collision based on where we started, returning the node that has the most coverage that is >50% mid line */
207 protected directionCollideCoverage(node: GridStackNode, o: GridStackMoveOpts, collides: GridStackNode[]): GridStackNode | undefined {

Callers 1

moveNodeMethod · 0.95

Calls 1

isInterceptedMethod · 0.80

Tested by

no test coverage detected