 
       if @inTree(@draggingBlock) and @mainViewOrChildrenContains @draggingBlock, renderPoint
         @draggingBlock.ephemeral = false
-
-        @draggingBlock = null
-        @draggingOffset = null
-        @lastHighlight = null
-
-        @clearDrag()
-        @redrawMain()
+        @endDrag()
 
   # LINE NUMBER GUTTER CODE
   # ================================

      @addMicroUndoOperation new CreateSegmentOperation @lassoSegment

      # Move the cursor to the segment we just created
      @moveCursorTo @lassoSegment.end.next, true

      @redrawMain()



    @dragCover.style.display = 'none'

  # FAILSAFE END DRAG HACK
  # ================================

  hook 'mousedown', 10, ->
    if @draggingBlock?
      @endDrag()

  Editor::endDrag = ->
    @draggingBlock = null
    @draggingOffset = null
    @lastHighlight = null

    @clearDrag()
    @redrawMain()
    return

  # TOUCHSCREEN SUPPORT
  # =================================

