* Cache the pixel rectangles for all nodes used for collision detection during drag operations. * This optimization converts grid coordinates to pixel coordinates for faster collision detection. * * @param w width of a single grid cell in pixels * @param h height of a single grid cell in
(w: number, h: number, top: number, right: number, bottom: number, left: number)
| 285 | * @internal This is typically called by GridStack during resize events |
| 286 | */ |
| 287 | public cacheRects(w: number, h: number, top: number, right: number, bottom: number, left: number): GridStackEngine |
| 288 | { |
| 289 | this.nodes.forEach(n => |
| 290 | n._rect = { |
| 291 | y: n.y * h + top, |
| 292 | x: n.x * w + left, |
| 293 | w: n.w * w - left - right, |
| 294 | h: n.h * h - top - bottom |
| 295 | } |
| 296 | ); |
| 297 | return this; |
| 298 | } |
| 299 | |
| 300 | /** |
| 301 | * Attempt to swap the positions of two nodes if they meet swapping criteria. |
no outgoing calls
no test coverage detected