 
     cell.append('rect')
         .attr('class', 'border')
-        .attr('x', -r / 2)
-        .attr('y', -r / 2)
-        .attr('width', r)
-        .attr('height', r)
+        .attr('x', (node) -> - node.width / 2)
+        .attr('y', (node) -> - node.height / 2)
+        .attr('width', (node) -> node.width)
+        .attr('height', (node) -> node.height)
         .attr('rx', 5)
         .attr('ry', 5)
 

    return children


walk = (state, callback) ->
    callback(state)
    for child in state.children or []
        walk(child, callback)


drawTree = (svg, tree) ->

        .call(force.drag)

    force.on 'tick', ->
        for node in nodes
            if node.children.length > 0
                xMin = d3.min(node.children, (d) -> d.x - d.width / 2) - 5
                xMax = d3.max(node.children, (d) -> d.x + d.width / 2) + 5
                yMin = d3.min(node.children, (d) -> d.y - d.height / 2) - 5
                yMax = d3.max(node.children, (d) -> d.y + d.height / 2) + 5
                node.width = xMax - xMin
                node.height = yMax - yMin
                node.x = xMin + node.width / 2
                node.y = yMin + node.height / 2

        q = d3.geom.quadtree(nodes)

        for i in [0 .. nodes.length - 1]
