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

Method isTouching

src/utils.ts:261–263  ·  view source on GitHub ↗

* Check if two grid positions are touching (edges or corners). * * @param a first position * @param b second position * @returns true if the positions are touching * * @example * const touching = Utils.isTouching( * {x: 0, y: 0, w: 2, h: 1}, * {x: 2, y: 0, w: 1, h: 1}

(a: GridStackPosition, b: GridStackPosition)

Source from the content-addressed store, hash-verified

259 * ); // true - they share an edge
260 */
261 static isTouching(a: GridStackPosition, b: GridStackPosition): boolean {
262 return Utils.isIntercepted(a, {x: b.x-0.5, y: b.y-0.5, w: b.w+1, h: b.h+1})
263 }
264
265 /**
266 * Calculate the overlapping area between two grid positions.

Callers 2

swapMethod · 0.80
utils-spec.tsFile · 0.80

Calls 1

isInterceptedMethod · 0.80

Tested by

no test coverage detected