index.js
function() {
      if (bodiesCount === 0) return true; // TODO: This will never fire 'stable'

      var lastMove = physicsSimulator.step();

      // Save the movement in case if someone wants to query it in the step
      // callback.
      api.lastMove = lastMove;

      // Allow listeners to perform low-level actions after nodes are updated.
      api.fire('step');

      var ratio = lastMove/bodiesCount;
      var isStableNow = ratio <= 0.01; // TODO: The number is somewhat arbitrary...

      if (wasStable !== isStableNow) {
        wasStable = isStableNow;
        onStableChanged(isStableNow);
      }

      return isStableNow;
    }
function() {
      if (bodiesCount === 0) return true; // TODO: This will never fire 'stable'

      var lastMove = physicsSimulator.step();

      // Save the movement in case if someone wants to query it in the step
      // callback.
      api.lastMove = lastMove;

      // Allow listeners to perform low-level actions after nodes are updated.
      api.fire('step');

      var ratio = lastMove/bodiesCount;
      var isStableNow = ratio <= 0.01; // TODO: The number is somewhat arbitrary...

      if (wasStable !== isStableNow) {
        wasStable = isStableNow;
        onStableChanged(isStableNow);
      }

      return isStableNow;
    }
function ( ) { if ( bodiesCount === 0 ) return true ; // TODO: This will never fire 'stable' var lastMove = physicsSimulator . step ( ) ; // Save the movement in case if someone wants to query it in the step // callback. api . lastMove = lastMove ; // Allow listeners to perform low-level actions after nodes are updated. api . fire ( 'step' ) ; var ratio = lastMove / bodiesCount ; var isStableNow = ratio <= 0.01 ; // TODO: The number is somewhat arbitrary... if ( wasStable !== isStableNow ) { wasStable = isStableNow ; onStableChanged ( isStableNow ) ; } return isStableNow ; }
Performs one step of iterative layout algorithm

@returns {boolean} true if the system should be considered stable; False otherwise.
The system is stable if no further call to `step()` can improve the layout.
Performs one step of iterative layout algorithm