mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 06:05:30 -05:00
add loadedCallback to pdfng, detects when pdf is fully loaded
This commit is contained in:
parent
953821959d
commit
5e06043fcb
2 changed files with 5 additions and 1 deletions
|
@ -19,6 +19,9 @@ define [
|
||||||
@navigateFn = @options.navigateFn
|
@navigateFn = @options.navigateFn
|
||||||
@spinner = new pdfSpinner
|
@spinner = new pdfSpinner
|
||||||
@resetState()
|
@resetState()
|
||||||
|
@document.then (pdfDocument) =>
|
||||||
|
pdfDocument.getDownloadInfo().then () =>
|
||||||
|
@options.loadedCallback()
|
||||||
|
|
||||||
resetState: () ->
|
resetState: () ->
|
||||||
@page = []
|
@page = []
|
||||||
|
|
|
@ -35,6 +35,8 @@ define [
|
||||||
$scope.$apply()
|
$scope.$apply()
|
||||||
progressCallback: (progress) ->
|
progressCallback: (progress) ->
|
||||||
$scope.$emit 'progress', progress
|
$scope.$emit 'progress', progress
|
||||||
|
loadedCallback: () ->
|
||||||
|
$scope.$emit 'loaded'
|
||||||
})
|
})
|
||||||
|
|
||||||
# we will have all the main information needed to start display
|
# we will have all the main information needed to start display
|
||||||
|
@ -51,7 +53,6 @@ define [
|
||||||
]
|
]
|
||||||
# console.log 'resolved q.all, page size is', result
|
# console.log 'resolved q.all, page size is', result
|
||||||
$scope.numPages = result.numPages
|
$scope.numPages = result.numPages
|
||||||
$scope.$emit "loaded"
|
|
||||||
|
|
||||||
@setScale = (scale, containerHeight, containerWidth) ->
|
@setScale = (scale, containerHeight, containerWidth) ->
|
||||||
$scope.loaded.then () ->
|
$scope.loaded.then () ->
|
||||||
|
|
Loading…
Reference in a new issue