From 863c8b9586527266e30fcdd06b6a19cb4ad0ffd8 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Mon, 8 Dec 2014 15:32:05 +0000 Subject: [PATCH] prevent exception when scrolling during rerender in pdfng --- .../public/coffee/ide/pdfng/directives/pdfViewer.coffee | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee b/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee index ece7c08d6e..d28bddc024 100644 --- a/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee +++ b/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee @@ -137,7 +137,8 @@ define [ if visible # console.log 'found it', topPageIdx else - console.log 'CANNOT FIND TOP PAGE' + # console.log 'CANNOT FIND TOP PAGE' + return # console.log 'top page is', topPage.pageNum, topPage.elemTop, topPage.elemBottom, topPage top = topPage.elemTop @@ -296,7 +297,9 @@ define [ scope.scrollHandlerTimeout = null updateContainer() scope.$apply() - scope.position = ctrl.getPdfPosition() + newPosition = ctrl.getPdfPosition() + if newPosition? + scope.position = newPosition scope.$apply() scope.$watch 'pdfSrc', (newVal, oldVal) ->