         if mdx*mdx+mdy*mdy < 10*10
           # call it a click
 
-          @merging =
-            node: @selected.node
-            x: pos.x
-            y: pos.y
+          if @selected.node in @nodes
+            @merging =
+              node: @selected.node
+              x: pos.x
+              y: pos.y
 
     @selected = null
 

          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

    if @merging?
      @merging = null

    false

  mousemove: (pos) ->
    if @selected?

    @child1.render(ctx)

  forAll: (fn) ->
    @child0.forAll(fn)
    @child1.forAll(fn)
    fn(this)

  tryAll: (fn) ->
    result = @child0.tryAll(fn)
    if result?
      return result

    result = @child1.tryAll(fn)
    if result?
      return result

    fn(this)

