mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-15 04:14:47 +00:00
clean up unnecessary redraws
This commit is contained in:
parent
7485b564bc
commit
d8e07731e0
3 changed files with 9 additions and 3 deletions
|
@ -50,8 +50,8 @@ define [
|
|||
# pdfListView.listView.pageHeightOffset = 20
|
||||
|
||||
scope.loading = false
|
||||
scope.pleaseJumpTo = {}
|
||||
scope.scale = {}
|
||||
scope.pleaseJumpTo = null
|
||||
scope.scale = null
|
||||
initializedPosition = false
|
||||
initializePosition = () ->
|
||||
return if initializedPosition
|
||||
|
|
|
@ -83,6 +83,8 @@ app.directive 'pdfPage', ['$timeout', 'pdfHighlights', ($timeout, pdfHighlights)
|
|||
})
|
||||
|
||||
scope.$watch 'highlights', (highlights, oldVal) ->
|
||||
return unless highlights?
|
||||
return unless highlights.length > 0
|
||||
console.log 'got highlight watch in pdfPage', scope.page
|
||||
pageHighlights = (h for h in highlights when h.page == scope.page.pageNum)
|
||||
return unless pageHighlights.length
|
||||
|
@ -95,5 +97,8 @@ app.directive 'pdfPage', ['$timeout', 'pdfHighlights', ($timeout, pdfHighlights)
|
|||
highlightsLayer.clearHighlights()
|
||||
, 1000
|
||||
|
||||
scope.$on "$destroy", () ->
|
||||
console.log 'in destroy handler, TODO need to clean up timeout/highlights'
|
||||
|
||||
}
|
||||
]
|
||||
|
|
|
@ -251,7 +251,8 @@ app.directive 'pdfViewer', ['$q', '$timeout', ($q, $timeout) ->
|
|||
console.log 'loading pdf', newVal, oldVal
|
||||
return unless newVal?
|
||||
ctrl.load()
|
||||
doRescale scope.scale
|
||||
# trigger a redraw
|
||||
scope.scale = angular.copy (scope.scale)
|
||||
|
||||
scope.$watch 'scale', (newVal, oldVal) ->
|
||||
# no need to set scale when initialising, done in pdfSrc
|
||||
|
|
Loading…
Reference in a new issue