 						ctrl.setPdfPosition(scope.pages[first.page], position)
 
 				scope.$on '$destroy', () ->
-					console.log 'handle pdfng directive destroy'
+					# console.log 'handle pdfng directive destroy'
 					clearTimeout elementTimer if elementTimer?
 					clearTimeout layoutTimer if layoutTimer?
 					clearTimeout rescaleTimer if rescaleTimer?


				layoutTimer = null
				queueLayout = () ->
					console.log 'call to queue layout'
					return if layoutTimer?
					console.log 'added to queue layoyt'
					layoutReady = $q.defer()
					layoutTimer = setTimeout () ->
						console.log 'calling update layout'
						updateLayout()
						console.log 'setting layout timer to null'
						layoutTimer = null
					, 0

				queueLayout()

				scope.$on 'layout:pdf:view', (e, args) ->
					console.log 'pdf view change', element, e, args
					queueLayout()

				scope.$on 'layout:main:resize', () ->
					console.log 'GOT LAYOUT-MAIN-RESIZE EVENT'
					queueLayout()

				scope.$on 'layout:pdf:resize', () ->
					# FIXME we get this event twice
					# also we need to start a new layout when we get it
					console.log 'GOT LAYOUT-PDF-RESIZE EVENT'
					queueLayout()

				scope.$on 'pdf:error', (event, error) ->

							element.innerHeight(),
							element.innerWidth()
						]
						# console.log 'resolving layoutReady with', scope.parentSize
						$timeout () ->
							if not spinnerTimer?
								spinnerTimer = setTimeout () ->
