|
@@ -25,7 +25,7 @@ define [
|
|
|
# $scope.pages = []
|
|
# $scope.pages = []
|
|
|
|
|
|
|
|
$scope.document.destroy() if $scope.document?
|
|
$scope.document.destroy() if $scope.document?
|
|
|
-
|
|
|
|
|
|
|
+ scope.loadCount = scope.loadCount? ? scope.loadCount + 1 : 1
|
|
|
# TODO need a proper url manipulation library to add to query string
|
|
# TODO need a proper url manipulation library to add to query string
|
|
|
$scope.document = new PDFRenderer($scope.pdfSrc + '&pdfng=true' , {
|
|
$scope.document = new PDFRenderer($scope.pdfSrc + '&pdfng=true' , {
|
|
|
scale: 1,
|
|
scale: 1,
|
|
@@ -293,6 +293,16 @@ define [
|
|
|
]
|
|
]
|
|
|
#scope.$apply()
|
|
#scope.$apply()
|
|
|
|
|
|
|
|
|
|
+ scope.$on 'pdf:error', (event, error) ->
|
|
|
|
|
+ return if error == 'cancelled'
|
|
|
|
|
+ # check if too many retries or file is missing
|
|
|
|
|
+ if scope.loadCount > 3 || error.match(/^Missing PDF/i)
|
|
|
|
|
+ scope.$emit 'pdf:error:display'
|
|
|
|
|
+ return
|
|
|
|
|
+ ctrl.load()
|
|
|
|
|
+ # trigger a redraw
|
|
|
|
|
+ scope.scale = angular.copy (scope.scale)
|
|
|
|
|
+
|
|
|
element.on 'scroll', () ->
|
|
element.on 'scroll', () ->
|
|
|
#console.log 'scroll event', element.scrollTop(), 'adjusting?', scope.adjustingScroll
|
|
#console.log 'scroll event', element.scrollTop(), 'adjusting?', scope.adjustingScroll
|
|
|
if scope.adjustingScroll
|
|
if scope.adjustingScroll
|
|
@@ -317,6 +327,7 @@ define [
|
|
|
scope.$watch 'pdfSrc', (newVal, oldVal) ->
|
|
scope.$watch 'pdfSrc', (newVal, oldVal) ->
|
|
|
# console.log 'loading pdf', newVal, oldVal
|
|
# console.log 'loading pdf', newVal, oldVal
|
|
|
return unless newVal?
|
|
return unless newVal?
|
|
|
|
|
+ scope.loadCount = 0; # new pdf, so reset load count
|
|
|
ctrl.load()
|
|
ctrl.load()
|
|
|
# trigger a redraw
|
|
# trigger a redraw
|
|
|
scope.scale = angular.copy (scope.scale)
|
|
scope.scale = angular.copy (scope.scale)
|