mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
fix getVisiblePages in pdf viewer to allow optimisation
This commit is contained in:
parent
debc3037ae
commit
c8012dc22c
1 changed files with 4 additions and 6 deletions
|
@ -247,14 +247,12 @@ define [
|
||||||
getVisiblePages = () ->
|
getVisiblePages = () ->
|
||||||
top = element[0].scrollTop;
|
top = element[0].scrollTop;
|
||||||
bottom = top + element[0].clientHeight;
|
bottom = top + element[0].clientHeight;
|
||||||
isVisible = (pageElement) ->
|
visiblePages = scope.pages.filter (page) ->
|
||||||
|
pageElement = page.element[0]
|
||||||
pageTop = pageElement.offsetTop
|
pageTop = pageElement.offsetTop
|
||||||
pageBottom = pageTop + pageElement.clientHeight
|
pageBottom = pageTop + pageElement.clientHeight
|
||||||
return pageTop < bottom and pageBottom > top
|
page.visible = pageTop < bottom and pageBottom > top
|
||||||
visiblePages = []
|
return page.visible
|
||||||
for page in scope.pages
|
|
||||||
page.visible = visible = isVisible(page.element[0])
|
|
||||||
visiblePages.push page if visible
|
|
||||||
return visiblePages
|
return visiblePages
|
||||||
|
|
||||||
getExtraPages = (visiblePages) ->
|
getExtraPages = (visiblePages) ->
|
||||||
|
|
Loading…
Reference in a new issue