|
|
@@ -15,9 +15,11 @@ define [
|
|
|
if scope.ui.reviewPanelOpen
|
|
|
PADDING = 8
|
|
|
TOOLBAR_HEIGHT = 38
|
|
|
+ OVERVIEW_TOGGLE_HEIGHT = 57
|
|
|
else
|
|
|
PADDING = 4
|
|
|
TOOLBAR_HEIGHT = 4
|
|
|
+ OVERVIEW_TOGGLE_HEIGHT = 0
|
|
|
|
|
|
entries = []
|
|
|
for el in element.find(".rp-entry-wrapper")
|
|
|
@@ -50,19 +52,6 @@ define [
|
|
|
|
|
|
sl_console.log "focused_entry_index", focused_entry_index
|
|
|
|
|
|
- # As we go backwards, we run the risk of pushing things off the top of the editor.
|
|
|
- # If we go through the entries before and assume they are as pushed together as they
|
|
|
- # could be, we can work out the 'ceiling' that each one can't go through. I.e. the first
|
|
|
- # on can't go beyond the toolbar height, the next one can't go beyond the bottom of the first
|
|
|
- # one at this minimum height, etc.
|
|
|
- heights = (entry.$layout_el.height() for entry in entries_before)
|
|
|
- previousMinTop = TOOLBAR_HEIGHT
|
|
|
- min_tops = []
|
|
|
- for height in heights
|
|
|
- min_tops.push previousMinTop
|
|
|
- previousMinTop += PADDING + height
|
|
|
- min_tops.reverse()
|
|
|
-
|
|
|
positionLayoutEl = ($callout_el, original_top, top) ->
|
|
|
if original_top <= top
|
|
|
$callout_el.removeClass("rp-entry-callout-inverted")
|
|
|
@@ -72,7 +61,7 @@ define [
|
|
|
$callout_el.css(top: top + line_height, height: original_top - top)
|
|
|
|
|
|
# Put the focused entry as close to where it wants to be as possible
|
|
|
- focused_entry_top = Math.max(previousMinTop, focused_entry.scope.entry.screenPos.y)
|
|
|
+ focused_entry_top = focused_entry.scope.entry.screenPos.y
|
|
|
focused_entry.$box_el.css(top: focused_entry_top)
|
|
|
focused_entry.$indicator_el.css(top: focused_entry_top)
|
|
|
positionLayoutEl(focused_entry.$callout_el, focused_entry.scope.entry.screenPos.y, focused_entry_top)
|
|
|
@@ -87,6 +76,8 @@ define [
|
|
|
entry.$indicator_el.css(top: top)
|
|
|
positionLayoutEl(entry.$callout_el, original_top, top)
|
|
|
sl_console.log "ENTRY", {entry: entry.scope.entry, top}
|
|
|
+
|
|
|
+ lastBottom = previousBottom
|
|
|
|
|
|
previousTop = focused_entry_top
|
|
|
entries_before.reverse() # Work through backwards, starting with the one just above
|
|
|
@@ -95,12 +86,22 @@ define [
|
|
|
height = entry.$layout_el.height()
|
|
|
original_bottom = original_top + height
|
|
|
bottom = Math.min(original_bottom, previousTop - PADDING)
|
|
|
- top = Math.max(bottom - height, min_tops[i])
|
|
|
+ top = bottom - height
|
|
|
previousTop = top
|
|
|
entry.$box_el.css(top: top)
|
|
|
entry.$indicator_el.css(top: top)
|
|
|
positionLayoutEl(entry.$callout_el, original_top, top)
|
|
|
sl_console.log "ENTRY", {entry: entry.scope.entry, top}
|
|
|
+
|
|
|
+ lastTop = top
|
|
|
+ if lastTop < TOOLBAR_HEIGHT
|
|
|
+ overflowTop = -lastTop + TOOLBAR_HEIGHT
|
|
|
+ else
|
|
|
+ overflowTop = 0
|
|
|
+ scope.$emit "review-panel:sizes", {
|
|
|
+ overflowTop: overflowTop,
|
|
|
+ height: previousBottom + OVERVIEW_TOGGLE_HEIGHT
|
|
|
+ }
|
|
|
|
|
|
scope.$applyAsync () ->
|
|
|
layout()
|