mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
clean up unnecessary redraws
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user