code: function wrapTree(t) {
      var wt = {
        t: t,
        prelim: 0,
        mod: 0, 
        shift: 0, 
        change: 0,
        msel: 0,
        mser: 0,
      };
      t.x = 0;
      t.y = 0;
      if (size) {
        wt.x_size = 1;
        wt.y_size = 1;
      }
      else if (typeof nodeSize == "object") {  // fixed array
        wt.x_size = nodeSize[0];
        wt.y_size = nodeSize[1];
      }
      else {  // use nodeSize function
        var ns = nodeSize(t);
        wt.x_size = ns[0];
        wt.y_size = ns[1];
      }
      if (setNodeSizes) {
        t.x_size = wt.x_size;
        t.y_size = wt.y_size;
      }
  
      var children = [];
      var num_children = t.children ? t.children.length : 0;
      for (var i = 0; i < num_children; ++i) {
        children.push(wrapTree(t.children[i]));
      }
      wt.children = children;
      wt.num_children = num_children;
  
      return wt;
    }
docs: Every node in the tree is wrapped in an object that holds data used during the algorithm