fix getVisiblePages in pdf viewer to allow optimisation

This commit is contained in:
Brian 2015-01-20 20:35:29 +00:00
parent debc3037ae
commit c8012dc22c

View file

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