 			@buttonDown = false 
 			$(@target).css("cursor", "auto")
 
+		lockMouse : =>
+			@lock = true
+
+		unlockMouse : =>
+			@lock = false
+
 		attachEventHandler : (type, func) ->
 			if @target.addEventListener
 				@target.addEventListener type, func, false

			@attachEventHandler "mousemove", @mouseMoved
			@attachEventHandler "mouseup", @mouseUp
			@attachEventHandler "mousedown", @mouseDown
		
		###
		#Binds a function as callback when X-Position was changed

			
			{ lastPosition, changedCallback } = @

			unless @locked 
				if @buttonDown
					distX = -(evt.pageX - lastPosition.x)
					distY =   evt.pageY - lastPosition.y
					changedCallback.x distX/SLOWDOWN_FACTOR if distX isnt 0
					changedCallback.y distY/SLOWDOWN_FACTOR if distY isnt 0

				@lastPosition =
					x : evt.pageX
					y : evt.pageY
			else
				if @buttonDown	
					distX = evt.movementX
					distY = evt.movementY
					changedCallback.x distX/SLOWDOWN_FACTOR if distX isnt 0
					changedCallback.y distY/SLOWDOWN_FACTOR if distY isnt 0

		mouseDown : =>
			$(@target).css("cursor", "none")
