       # 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'
+      if dist < threshold and not dragstart
         return
       else
         dragstart = true


    # Stop dragging
    $(document).on "mouseup", (e) ->
      console.log "Mouseup!"
      # Remove handler
      $(document).off "mousemove.drag"
      $(".node[data-id=#{graphUI.dragged}]").attr 'contenteditable', 'true'

      graphUI.drawNodeAt(child.id, x-startx, y-starty)

      if intrash(".node[data-id=#{graphUI.dragged}]")
        $(".trashcan").addClass("dragover")
        graphUI.dropParent = null
        $("#graph .edge[data-child=#{child.id}]")
