mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 11:34:15 -05:00
fix offset calculation to match pdflistview
This commit is contained in:
parent
7b4ca6501b
commit
b8377bca7b
1 changed files with 2 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue