 
 				rescaleTimer = null
 				queueRescale = (scale) ->
-					console.log 'call to queueRescale'
+					# console.log 'call to queueRescale'
 					return if rescaleTimer? or layoutTimer? or elementTimer?
-					console.log 'adding to rescale queue'
+					# console.log 'adding to rescale queue'
 					rescaleTimer = setTimeout () ->
 						doRescale scale
 						rescaleTimer = null
 					, 0
 
 				doRescale = (scale) ->
-					console.log 'doRescale', scale
+					# console.log 'doRescale', scale
 					return unless scale?
 					origposition = angular.copy scope.position
 					# console.log 'origposition', origposition
 					layoutReady.promise.then (parentSize) ->
 						[h, w] = parentSize
-						console.log 'in promise', h, w
+						# console.log 'in promise', h, w
 						ctrl.setScale(scale, h, w).then () ->
-							console.log 'in setscale then', scale, h, w
+							# console.log 'in setscale then', scale, h, w
 							scope.$evalAsync () ->
 								if spinnerTimer
 									clearTimeout spinnerTimer


				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 () ->
