 
 class DrawingTestsViewController : UIViewController {
 
-	var drawingView:DrawingTestView = DrawingTestView(frame: CGRect.zeroRect)
+	private var drawingView:DrawingTestView = DrawingTestView(frame: CGRect.zeroRect)
+	private var currentPanTranslation:CGPoint = CGPoint.zeroPoint
 
 	override func viewDidLoad() {
 

		let controller = DrawingInputController()
		controller.drawing = drawingView.drawing!
		controller.view = drawingView
		controller.viewport = CGRect(x: 0, y: 0, width: 768, height: 1024).rectByInsetting(dx: 100, dy: 100)
		controller.fill = Fill.Brush
		drawingView.controller = controller

		view.addSubview(drawingView)

		var tgr = UITapGestureRecognizer(target: self, action: "eraseDrawing:")
		tgr.numberOfTapsRequired = 2
		tgr.numberOfTouchesRequired = 1
		drawingView.addGestureRecognizer(tgr)

		self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "DEBUG", style: UIBarButtonItemStyle.Plain, target: self, action: "toggleDebugRendering:")

		self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "UNFO", style: UIBarButtonItemStyle.Plain, target: self, action: "undo:")
	}

	override func viewWillLayoutSubviews() {
		drawingView.frame = view.bounds
	}

	dynamic func undo( sender:AnyObject ) {
		drawingView.controller!.undo()
	}

	dynamic func eraseDrawing( sender:AnyObject ) {
		drawingView.drawing!.clear()
		drawingView.setNeedsDisplay()
	}

	dynamic func toggleDebugRendering( sender:AnyObject ) {
		drawingView.drawing!.debugRender = !drawingView.drawing!.debugRender
		drawingView.setNeedsDisplay()
	}

}
		let touch = touches.first as! UITouch
		let location = touch.locationInView(self)
		controller!.touchBegan(location)
		tracking = true
	}

	override func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent) {

		if !tracking {
			return
		}

