import * as util from '../../util';
import * as math from '../../math';
let defaults = {
fit: true, padding: 30, boundingBox: undefined, animate: false, animationDuration: 500, animationEasing: undefined, animateFilter: function ( node, i ){ return true; }, ready: undefined, stop: undefined, transform: function (node, position ){ return position; } };
function RandomLayout( options ){
this.options = util.extend( {}, defaults, options );
}
RandomLayout.prototype.run = function(){
let options = this.options;
let cy = options.cy;
let eles = options.eles;
let bb = math.makeBoundingBox( options.boundingBox ? options.boundingBox : {
x1: 0, y1: 0, w: cy.width(), h: cy.height()
} );
let getPos = function( node, i ){
return {
x: bb.x1 + Math.round( Math.random() * bb.w ),
y: bb.y1 + Math.round( Math.random() * bb.h )
};
};
eles.nodes().layoutPositions( this, options, getPos );
return this; };
export default RandomLayout;