     else if e.target.className is "mark"
       @moving = true
       @pointerOffset = (@toCanvasXPoint(e) - @canvasXMin)
+
+    @closestXBelow = @canvasGraph.marks.closestXBelow(@canvasXMin)
+    @closestXAbove = @canvasGraph.marks.closestXAbove(@canvasXMax)
 
   onMouseUp: (e) =>
     e.preventDefault()

    markRightX = Math.max @startingPoint, @toCanvasXPoint(e)


    width = (Math.min (Math.max (Math.abs markRightX - markLeftX), @minWidth()), @maxWidth())

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

    # or
    # (allXPoints.reduce (a, b) -> a.concat b).sort (a, b) -> a - b

  closestXBelow: (xCoord) -> (@sortedXCoords().filter (i) -> i < xCoord).pop()

  closestXAbove: (xCoord) -> (@sortedXCoords().filter (i) -> i > xCoord).shift()

class Mark
  constructor: (e, @canvasGraph) ->
