           if n isnt @merging.node
             @mergeNodes(@merging.node, n)
             @merging = null
-        else
-          @selected =
-            node: n
-            ox: n.x # original location
-            oy: n.y
-            mx: pos.x # mousedown location
-            my: pos.y
-            t: Date.now()
-        true
+
+            return true
 
     if @merging?
       @merging = null
 
-    false
+    # try moving nodes
+    for n in @nodes
+      hit = n.tryAll( (node) ->
+        if node.isHit(pos)
+          node
+        else
+          null
+      )
+
+      if hit?
+        @selected =
+          node: hit
+          ox: hit.x # original location
+          oy: hit.y
+          mx: pos.x # mousedown location
+          my: pos.y
+          t: Date.now()
+        return true
+
+    return false
 
   mousemove: (pos) ->
     if @selected?


    (dx*dx + dy*dy < @radius*@radius)

  radius: 15

class Leaf extends Node

        if mdx*mdx+mdy*mdy < 10*10
          # call it a click

          if @selected.node in @nodes
            @merging =
              node: @selected.node
              x: pos.x
              y: pos.y

    @selected = null

