//Drawing public override void Draw(CGRect rect) { if (CurrentPathView != null) { CurrentPathView.Stroke(); } }
public override void TouchesMoved(NSSet touches, UIEvent evt) { base.TouchesMoved(touches, evt); var loc = (touches.AnyObject as UITouch).LocationInView(this); CurrentPathView.AddLineTo(loc); CurrentStroke.Points.Add(new Point(loc.X, loc.Y)); SetNeedsDisplay(); }
public override void TouchesBegan(NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); //System.Diagnostics.Debug.WriteLine("Start touch"); CurrentStroke = new Stroke() { StrokeColor = StrokeColor, Thickness = StrokeThickness }; CurrentPathView.CreateNewPath(CurrentStroke); var loc = (touches.AnyObject as UITouch).LocationInView(this); CurrentPathView.MoveTo(loc); CurrentStroke.Points.Add(new Point(loc.X, loc.Y)); }
public override void TouchesEnded(NSSet touches, UIEvent evt) { base.TouchesEnded(touches, evt); if (!Enabled) { return; } var loc = (touches.AnyObject as UITouch).LocationInView(this); CurrentStroke.Points.Add(new Point(loc.X, loc.Y)); CurrentPathView.AddLineTo(loc); Strokes.Add(CurrentStroke); drawPath(); CurrentPathView.Clear(); SetNeedsDisplay(); }
public void Clear() { Strokes.Clear(); CurrentPathView.Clear(); drawPath(); }