 
   closestElementIndex
 
+openHihglight = (publication, page, $textLayer, start, end) ->
+  return if start is -1 or end is -1
+
+  [start, end] = normalizeStartEnd start, end
+
+  # TODO: Implement
+
+closeHighlight = (publication, page, $textLayer, start, end) ->
+  hideHiglight $textLayer
+
+  # TODO: Implement
+
 setupTextSelection = (publication, page, $textLayer) ->
   highlightStartPosition = null
   highlightStartIndex = -1
+  highlightEndIndex = -1
 
   $textLayer.mousemove (e) ->
     return if highlightStartIndex is -1
 
     offset = $textLayer.offset()
-    currentPositionIndex = findClosestElement $textLayer,
+    highlightEndIndex = findClosestElement $textLayer,
       left: e.pageX - offset.left
       top: e.pageY - offset.top
 
-    return if currentPositionIndex is -1
-
-    showHighlight $textLayer, highlightStartIndex, currentPositionIndex
+    return if highlightEndIndex is -1
+
+    showHighlight $textLayer, highlightStartIndex, highlightEndIndex
 
   $textLayer.mousedown (e) ->
     offset = $textLayer.offset()


  dims

hideHiglight = ($textLayer) ->
  $textLayer.children().css
    'background-color': 'rgba(0,0,0,0)'


  return if start is -1 or end is -1

  [start, end] = normalizeStartEnd start, end

  $textLayer.children().slice(start, end + 1).css
    'background-color': 'rgba(255,0,0,0.3)'
