src/optimized-d3-cloud.js
// Allows to calculate a subset of data instead of all of the words at once
Allows to calculate a subset of data instead of all of the words at once
Allows to calculate a subset of data instead of all of the words at once
function multiStep(from, to) {
      for (let i = from; i < to; i += 1) {
        const d = data[i];
        d.x = (size[0] * (random() + 0.5)) >> 1;
        d.y = (size[1] * (random() + 0.5)) >> 1;
        cloudSprite(contextAndRatio, d, data, i);
        if (d.hasText && place(board, d, bounds)) {
          tags.push(d);
          event.call('word', cloud, d);
          if (bounds) cloudBounds(bounds, d);
          else
            bounds = [
              { x: d.x + d.x0, y: d.y + d.y0 },
              { x: d.x + d.x1, y: d.y + d.y1 },
            ];
          d.x -= size[0] >> 1;
          d.y -= size[1] >> 1;
        }
      }
    }
function multiStep ( from , to ) { for ( let i = from ; i < to ; i += 1 ) { const d = data [ i ] ; d . x = ( size [ 0 ] * ( random ( ) + 0.5 ) ) >> 1 ; d . y = ( size [ 1 ] * ( random ( ) + 0.5 ) ) >> 1 ; cloudSprite ( contextAndRatio , d , data , i ) ; if ( d . hasText && place ( board , d , bounds ) ) { tags . push ( d ) ; event . call ( 'word' , cloud , d ) ; if ( bounds ) cloudBounds ( bounds , d ) ; else bounds = [ { x : d . x + d . x0 , y : d . y + d . y0 } , { x : d . x + d . x1 , y : d . y + d . y1 } , ] ; d . x -= size [ 0 ] >> 1 ; d . y -= size [ 1 ] >> 1 ; } } }
Allows to calculate a subset of data instead of all of the words at once
Allows to calculate a subset of data instead of all of the words at once
// Temporary hack