fix offset calculation to match pdflistview

This commit is contained in:
Brian Gough 2014-11-27 13:46:22 +00:00
parent 7b4ca6501b
commit b8377bca7b

View file

@ -157,6 +157,7 @@ app.controller 'pdfViewerController', ['$scope', '$q', 'PDFRenderer', '$element'
pageTop = $(element).offset().top - $(element).parent().offset().top pageTop = $(element).offset().top - $(element).parent().offset().top
console.log('top of page scroll is', pageTop, 'vs', page.elemTop) console.log('top of page scroll is', pageTop, 'vs', page.elemTop)
console.log('inner height is', $(element).innerHeight()) console.log('inner height is', $(element).innerHeight())
currentScroll = $(element).parent().scrollTop()
offset = position.offset offset = position.offset
# convert offset to pixels # convert offset to pixels
return $scope.document.getPdfViewport(page.pageNum).then (viewport) -> return $scope.document.getPdfViewport(page.pageNum).then (viewport) ->
@ -164,7 +165,7 @@ app.controller 'pdfViewerController', ['$scope', '$q', 'PDFRenderer', '$element'
pageOffset = viewport.convertToViewportPoint(offset.left, offset.top) pageOffset = viewport.convertToViewportPoint(offset.left, offset.top)
console.log 'addition offset =', pageOffset console.log 'addition offset =', pageOffset
console.log 'total', pageTop + pageOffset[1] console.log 'total', pageTop + pageOffset[1]
Math.round(pageTop + pageOffset[1]) ## 10 is margin Math.round(pageTop + pageOffset[1] + currentScroll) ## 10 is margin
@setPdfPosition = (page, position) -> @setPdfPosition = (page, position) ->
console.log 'required pdf Position is', position console.log 'required pdf Position is', position