public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, UIEvent evt) { base.TouchesEnded(touches, evt); var gesture = WritePadAPI.detectGesture(WritePadAPI.GEST_CUT | WritePadAPI.GEST_RETURN, currentStroke); if (!mMoved) { mX++; } AddPixelsXY(mX, mY, true); mCurrStroke = -1; mMoved = false; strokeLen = 0; mPath.AddLineTo(new PointF(mX, mY)); mPathList.Add(mPath); mPath = new UIBezierPath(); mPath.LineWidth = WritePadAPI.DEFAULT_INK_WIDTH; mPath.LineCapStyle = CGLineCap.Round; mPath.LineJoinStyle = CGLineJoin.Round; SetNeedsDisplay(); switch (gesture) { case WritePadAPI.GEST_RETURN: if (OnReturnGesture != null) { mPathList.RemoveAt(mPathList.Count - 1); WritePadAPI.recoDeleteLastStroke(); SetNeedsDisplay(); OnReturnGesture(); } break; case WritePadAPI.GEST_CUT: if (OnCutGesture != null) { mPathList.RemoveAt(mPathList.Count - 1); WritePadAPI.recoDeleteLastStroke(); SetNeedsDisplay(); OnCutGesture(); } break; } }
public override void TouchesEnded(Foundation.NSSet touches, UIEvent evt) { base.TouchesEnded(touches, evt); var gesture = WritePadAPI.detectGesture(WritePadAPI.GEST_CUT | WritePadAPI.GEST_RETURN | WritePadAPI.GEST_UNDO | WritePadAPI.GEST_REDO, currentStroke); if (!mMoved) { mX++; } AddPixelsXY(mX, mY, true); mCurrStroke = -1; mMoved = false; strokeLen = 0; mPath.AddLineTo(new CGPoint(mX, mY)); mPathList.Add(mPath); mPath = new UIBezierPath(); mPath.LineWidth = WritePadAPI.DEFAULT_INK_WIDTH; mPath.LineCapStyle = CGLineCap.Round; mPath.LineJoinStyle = CGLineJoin.Round; SetNeedsDisplay(); switch (gesture) { case WritePadAPI.GEST_RETURN: if (OnReturnGesture != null) { mPathList.RemoveAt(mPathList.Count - 1); WritePadAPI.recoDeleteLastStroke(); SetNeedsDisplay(); OnReturnGesture(); } break; case WritePadAPI.GEST_CUT: if (OnCutGesture != null) { mPathList.RemoveAt(mPathList.Count - 1); WritePadAPI.recoDeleteLastStroke(); SetNeedsDisplay(); OnCutGesture(); } break; case WritePadAPI.GEST_UNDO: if (OnUndoGesture != null) { undoneStroke = mPathList [mPathList.Count - 1]; mPathList.RemoveAt(mPathList.Count - 1); WritePadAPI.recoDeleteLastStroke(); SetNeedsDisplay(); OnUndoGesture(); } break; case WritePadAPI.GEST_REDO: if (OnRedoGesture != null && undoneStroke != null) { mPathList.Add(undoneStroke); UIColor.Blue.SetStroke(); foreach (var aMPathList in mPathList) { aMPathList.Stroke(); } mPath.Stroke(); SetNeedsDisplay(); OnRedoGesture(); } break; } }