 						console.log 'in promise', h, w
 						ctrl.setScale(scale, h, w).then () ->
 							console.log 'in setscale then', scale, h, w
-							spinner.remove(element)
 							scope.$evalAsync () ->
+								if spinnerTimer
+									clearTimeout spinnerTimer
+								else
+									spinner.remove(element)
 								ctrl.redraw(origposition)
 								$timeout renderVisiblePages
 
-				scope.$on 'layout:pdf:view', (e, args) ->
-					console.log 'pdf view change', element, e, args
-					layoutReady = $q.defer()
-
 				elementTimer = null
+				spinnerTimer = null
 				updateLayout = () ->
 					# if element is zero-sized keep checking until it is ready
 					console.log 'checking element ready', element.height(), element.width()

				scope.$on '$destroy', () ->
					console.log 'handle pdfng directive destroy'
					clearTimeout elementTimer if elementTimer?
		}
	]

						extra.push scope.pages[lastVisiblePageIdx + 2]
					return visiblePages.concat extra

				rescaleTimer = null
				queueRescale = (scale) ->
					console.log 'call to queueRescale'
					return if rescaleTimer? or layoutTimer? or elementTimer?
					console.log 'adding to rescale queue'
					rescaleTimer = setTimeout () ->
						doRescale scale
						rescaleTimer = null
					, 0

				doRescale = (scale) ->
					console.log 'doRescale', scale
					return unless scale?
