use progress bar for initial loading

This commit is contained in:
Brian Gough 2016-07-01 17:00:06 +01:00
parent b8f677ac7c
commit eaca616dd3
2 changed files with 5 additions and 3 deletions

View file

@ -82,6 +82,7 @@ define [
scope.$watch "pdfSrc", (url) ->
if url
scope.loading = true
scope.loaded = false
# console.log 'pdfSrc =', url
initializePosition()
flashControls()
@ -95,12 +96,12 @@ define [
# flashControls()
scope.$on "loaded", () ->
scope.loaded = true
scope.progress = 100
scope.$apply()
$timeout () ->
scope.loading = false
delete scope.progress
, 250
, 500
#scope.$watch "highlights", (areas) ->
# console.log 'got HIGHLIGHTS in pdfJS', areas
@ -163,6 +164,7 @@ define [
scope.$on 'progress', (event, progress) ->
scope.$apply () ->
return if scope.loaded
scope.progress = Math.floor(progress.loaded/progress.total*100)
scope.progress = 100 if scope.progress > 100
scope.progress = 0 if scope.progress < 0

View file

@ -41,7 +41,6 @@ define [
$scope.navigateTo = ref
$scope.$apply()
progressCallback: (progress) ->
return if onDemandLoading is true # don't show progress for on-demand page loading
$scope.$emit 'progress', progress
loadedCallback: () ->
$scope.$emit 'loaded'
@ -65,6 +64,7 @@ define [
result.pdfViewport.width
]
# console.log 'resolved q.all, page size is', result
$scope.$emit 'loaded'
$scope.numPages = result.numPages
.catch (error) ->
$scope.$emit 'pdf:error', error