growDown method

dynamic growDown(
  1. int width,
  2. int height
)

Implementation

growDown(int width, int height) {
  this.root = {
    'used': true,
    'x': 0,
    'y': 0,
    'width': this.root['width'],
    'height': this.root['height'] + height,
    'down': {
      'x': 0,
      'y': this.root['height'],
      'width': this.root['width'],
      'height': height
    },
    'right': this.root
  };
  var node = this.findNode(this.root, width, height);
  if (node != null)
    return this.splitNode(node, width, height);
  else
    return null;
}