     markRightX = Math.max @startingPoint, @toCanvasXPoint(e)
 
 
+    markLeftX = (Math.max markLeftX, (@closestXBelow || markLeftX))
+    markRightX = (Math.min markRightX, (@closestXAbove || markRightX))
+
     width = (Math.min (Math.max (Math.abs markRightX - markLeftX), @minWidth()), @maxWidth())
+
 
     @element.style.left = markLeftX + "px"
     @element.style.width = width + "px"

    else if e.target.className is "mark"
      @moving = true
      @pointerOffset = (@toCanvasXPoint(e) - @canvasXMin)

  onMouseUp: (e) =>
    e.preventDefault()

    # 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) ->
