mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Don't let widgets in review panel overlap
This commit is contained in:
parent
2b94c69795
commit
8f9a4882c8
3 changed files with 29 additions and 2 deletions
|
@ -44,8 +44,8 @@ div.full-size(
|
||||||
)
|
)
|
||||||
#review-panel
|
#review-panel
|
||||||
.review-panel-scroller
|
.review-panel-scroller
|
||||||
.review-entry-list
|
.review-entry-list(review-panel-sorted)
|
||||||
.review-entry(ng-repeat="(entry_id, entry) in reviewPanel.entries", ng-style="{'top': entry.screenPos.y}")
|
.review-entry(ng-repeat="(entry_id, entry) in reviewPanel.entries", ng-style="{'top': top}")
|
||||||
{{ entry.content }}
|
{{ entry.content }}
|
||||||
|
|
||||||
.ui-layout-east
|
.ui-layout-east
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
define [
|
define [
|
||||||
"ide/review-panel/controllers/ReviewPanelController"
|
"ide/review-panel/controllers/ReviewPanelController"
|
||||||
|
"ide/review-panel/directives/reviewPanelSorted"
|
||||||
], () ->
|
], () ->
|
|
@ -0,0 +1,26 @@
|
||||||
|
define [
|
||||||
|
"base"
|
||||||
|
], (App) ->
|
||||||
|
console.log "Defingint", "reviePanelSorted"
|
||||||
|
App.directive "reviewPanelSorted", () ->
|
||||||
|
return {
|
||||||
|
link: (scope, element, attrs) ->
|
||||||
|
scope.$watch "reviewPanel.entries", (value) ->
|
||||||
|
return if !value?
|
||||||
|
console.log "reviewPanel.entries updates", entries
|
||||||
|
entries = []
|
||||||
|
for el in element.find(".review-entry")
|
||||||
|
entries.push {
|
||||||
|
el: el
|
||||||
|
scope: angular.element(el).scope()
|
||||||
|
}
|
||||||
|
entries.sort (a,b) -> a.scope.entry.offset - b.scope.entry.offset
|
||||||
|
|
||||||
|
previousBottom = 0
|
||||||
|
for entry in entries
|
||||||
|
height = $(entry.el).height()
|
||||||
|
top = entry.scope.entry.screenPos.y
|
||||||
|
top = Math.max(top, previousBottom + 12)
|
||||||
|
previousBottom = top + height
|
||||||
|
entry.scope.top = top
|
||||||
|
}
|
Loading…
Reference in a new issue