       mark.dragging = false
       mark.moving = false
 
+  onMouseUp: (e) =>
+    @onTouchEnd(e)
+
+    if @containsPoints(@canvasGraph.data.x)
+      # console.log @canvasGraph.data.x
+      console.log 'CONTAINS POINTS!' 
+    else
+      console.log 'NO POINTS IN HERE!'
+      marks.remove(@)
+      classifier.notify 'There are no points in the mark.'
+      @canvasGraph.shakeGraph()
+    
     $(document).trigger("mark-change")
 
+  containsPoints: (xValues) =>
+    console.log 'containsPoints()'
+    # console.log 'xValues: ', xValues
+    
+    # console.log 'this (mark): ', @, '[',@dataXMinRel,',',@dataXMaxRel,']'
+    # # console.log 'data: ', data
+    for value in xValues
+      # console.log 'POINT: ', value
+      if value <= @dataXMaxRel and value >= @dataXMinRel
+        return true
+    return false
+
   toCanvasXPoint: (e) -> e.pageX - @canvas.getBoundingClientRect().left - window.scrollX
 
 module?.exports = CanvasGraph: CanvasGraph, Marks: Marks, Mark: Mark


    @element.style.left = markLeftX + "px"
    @element.style.width = width + "px"

    @save(markLeftX, markLeftX+width)

  move: (e) ->

    @closestXBelow = @canvasGraph.marks.closestXBelow(@canvasXMin)
    @closestXAbove = @canvasGraph.marks.closestXAbove(@canvasXMax)

  onTouchEnd: (e) => # for touch devices
    e.preventDefault()
    window.removeEventListener 'mousemove', @onMouseMove
    window.removeEventListener 'mouseup', @onMouseUp
    window.removeEventListener 'touchmove', @onMouseMove
    window.removeEventListener 'touchend', @onTouchEnd
    
    @canvasGraph.marks.add(@) unless (@ in @canvasGraph.marks.all)
    @canvasGraph.marks.remove(@) if e.target.className is "top-bar" or e.target.className is "close-icon"
