src/optimized-d3-cloud.js
// Use mask-based collision detection.
Use mask-based collision detection.
Use mask - based collision detection .
function cloudCollide(tag, board, sw) {
  sw >>= 5;
  let sprite = tag.sprite,
    w = tag.width >> 5,
    lx = tag.x - (w << 4),
    sx = lx & 0x7f,
    msx = 32 - sx,
    h = tag.y1 - tag.y0,
    x = (tag.y + tag.y0) * sw + (lx >> 5),
    last;
  for (let j = 0; j < h; j++) {
    last = 0;
    for (let i = 0; i <= w; i++) {
      if (
        ((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) &
        board[x + i]
      )
        return true;
    }
    x += sw;
  }
  return false;
}
function cloudCollide ( tag , board , sw ) { sw >>= 5 ; let sprite = tag . sprite , w = tag . width >> 5 , lx = tag . x - ( w << 4 ) , sx = lx & 0x7f , msx = 32 - sx , h = tag . y1 - tag . y0 , x = ( tag . y + tag . y0 ) * sw + ( lx >> 5 ) , last ; for ( let j = 0 ; j < h ; j ++ ) { last = 0 ; for ( let i = 0 ; i <= w ; i ++ ) { if ( ( ( last << msx ) | ( i < w ? ( last = sprite [ j * w + i ] ) >>> sx : 0 ) ) & board [ x + i ] ) return true ; } x += sw ; } return false ; }
Use mask-based collision detection.
Use mask - based collision detection .