import "core-js/modules/es6.number.constructor";
import _Object$assign from "@babel/runtime-corejs2/core-js/object/assign";
import _inheritsLoose from "../../../inheritsLoose";
import _defineProperty from "@babel/runtime-corejs2/helpers/defineProperty";
import { DLayout } from './layout';
import mx from '../mxgraph';
var mxFastOrganicLayout = mx.mxFastOrganicLayout;
export var DOrganicLayout =
/*#__PURE__*/
function (_DLayout) {
  _inheritsLoose(DOrganicLayout, _DLayout);

  function DOrganicLayout() {
    return _DLayout.apply(this, arguments) || this;
  }

  var _proto = DOrganicLayout.prototype;

  _proto.defaults = function defaults() {
    return _Object$assign({}, _DLayout.prototype.defaults.call(this), {
      // The force constant by which the attractive forces are divided and the replusive forces are multiple by the square of.  The value equates to the average radius there is of free space around each node. 
      forceConstant: 50
    });
  };

  _proto._getLayout = function _getLayout(graph) {
    var _this$get = this.get(),
        forceConstant = _this$get.forceConstant;

    var layout = new mxFastOrganicLayout(graph);
    layout.forceConstant = +forceConstant;
    layout.disableEdgeStyle = false;
    return layout;
  };

  _proto._execute = function _execute(layout, cells, parent, graph) {
    if (!cells.length) return;
    var tmp = parent.cell;
    layout.execute(tmp); // if (graph.getModel().isVertex(tmp)) {
    // graph.updateGroupBounds([tmp], graph.gridSize * 2, true);
    // }
  };

  return DOrganicLayout;
}(DLayout);

_defineProperty(DOrganicLayout, "displayName", 'DOrganicLayout');

_defineProperty(DOrganicLayout, "propTypes", _Object$assign({}, DLayout.propTypes, {
  spacing: [Number, String]
}));