mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
add a progress event in the pdfng viewer
This commit is contained in:
parent
2a66651ec9
commit
c3569dd45f
3 changed files with 12 additions and 1 deletions
|
@ -147,6 +147,12 @@ define [
|
|||
for event in attrs.resizeOn.split(",")
|
||||
scope.$on event, (e) ->
|
||||
#console.log 'got a resize event', event, e
|
||||
#
|
||||
|
||||
scope.$on 'progress', (event, progress) ->
|
||||
scope.$apply () ->
|
||||
console.log 'progress', progress.loaded, progress.total, progress
|
||||
scope.progress = Math.floor(progress.loaded/progress.total*100)
|
||||
|
||||
template: """
|
||||
<div data-pdf-viewer class="pdfjs-viewer" pdf-src='pdfSrc' position='position' scale='scale' highlights='highlights' please-jump-to='pleaseJumpTo'></div>
|
||||
|
@ -190,6 +196,9 @@ define [
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="progress-thin" ng-show="loading">
|
||||
<div class="progress-bar" ng-style="{ 'width': progress + '%' }"></div>
|
||||
</div>
|
||||
"""
|
||||
}
|
||||
]
|
||||
|
|
|
@ -12,7 +12,7 @@ define [
|
|||
PDFJS.disableAutoFetch = true
|
||||
PDFJS.disableFontFace = true
|
||||
@scale = @options.scale || 1
|
||||
@document = $q.when(PDFJS.getDocument @url)
|
||||
@document = $q.when(PDFJS.getDocument @url, null, null, @options.progressCallback)
|
||||
@navigateFn = @options.navigateFn
|
||||
@spinner = new pdfSpinner
|
||||
@resetState()
|
||||
|
|
|
@ -30,6 +30,8 @@ define [
|
|||
# this function captures clicks on the annotation links
|
||||
$scope.navigateTo = ref
|
||||
$scope.$apply()
|
||||
progressCallback: (progress) ->
|
||||
$scope.$emit 'progress', progress
|
||||
})
|
||||
|
||||
# we will have all the main information needed to start display
|
||||
|
|
Loading…
Reference in a new issue