 
   tryAll: (fn) ->
     return fn(this)
+
+  move: (newx, newy) ->
+    # move a node and its children
+    dx = newx - @x
+    dy = newy - @y
+
+    moveFn = (node) ->
+      node.x += dx
+      node.y += dy
+    @forAll(moveFn)
 
   radius: default_node_radius
 


  setPosition: (time) ->
    pos = lerp2d(time/@duration, @origpos, @destpos)
    @node.x = pos.x
    @node.y = pos.y

  isFinished: (time) ->
    time >= @duration


    if @selected?
      s = @selected
      newx = pos.x - s.mx + s.ox
      newy = pos.y - s.my + s.oy

      s.node.move(newx, newy)

    if @merging?
      @merging.x = pos.x
