Beispiel #1
0
        public bool OnTouch(View v, MotionEvent e)
        {
            int x = (int)e.GetX();
            int y = (int)e.GetY();

            Position pos = mViewInfo.GetPosition(x, y);

            switch (e.Action)
            {
            case MotionEventActions.Down:
                mViewInfo.ClearPath();
                mViewInfo.AddToPath(pos);
                Invalidate();
                break;

            case MotionEventActions.Up:
                //CompletePath();
                mViewInfo.ClearPath();
                Invalidate();
                break;

            case MotionEventActions.Move:
                if (mViewInfo.LatestPathEntry == Position.None || pos != mViewInfo.LatestPathEntry)
                {
                    // Add the middle position so we know we actually finished the path
                    mViewInfo.AddToPath(pos);
                    if (pos == TinyTypeLib.Position.Middle)
                    {
                        CompletePath();
                        mViewInfo.ClearPath();
                        mViewInfo.AddToPath(pos);
                    }

                    Invalidate();
                }
                break;
            }

            return(true);
        }