           d3.selectAll("#graph line[data-child='#{graphUI.dragged}']").remove()
           # Did we drop it in the trash?
           if intrash(".node[data-id=#{graphUI.dragged}]")
-            console.log "AGH"
             deleteAll = (id)->
               node = graph.node(id)
               if node.children.length > 0

      # Threshold
      threshold = 25 #px
      dist = Math.sqrt((x-startx)*(x-startx) + (y-starty)*(y-starty))
      console.log dist
      if dist < threshold 
        if dragstart
          # Restore everything
          child = graph.node(graphUI.dragged)
          graphUI.drawNodeAt(child.id, child.d3.x, child.d3.y)
          dragstart = false
          $(".node[data-id=#{graphUI.dragged}]").attr 'contenteditable', 'true'
        return
      else
        dragstart = true


      dists = (dist(node) for node in candidates)
      min_dist = Math.min(dists...)
      min_idx = dists.indexOf(min_dist)
      nearest = candidates[min_idx]
      graphUI.dropParent = nearest.id
