Example #1
0
    void OnTouchStart(TouchInformation _pTouchInfo)
    {
        if (mCurrentPinch != null)
        {
            mCurrentPinch.mTouchTwo      = _pTouchInfo;
            mCurrentPinch.mStartDistance = mCurrentPinch.GetCurrentDistance();
            mPinchGestures.Add(mCurrentPinch);

            try
            {
                if (OnPinchStart != null)
                {
                    OnPinchStart(mCurrentPinch);
                }
            } catch (Exception e)
            {
                Debug.LogException(e);
            }

            mCurrentPinch = null;
        }
        else
        {
            mCurrentPinch           = new PinchGestureEvent();
            mCurrentPinch.mTouchOne = _pTouchInfo;
        }
    }
Example #2
0
    void OnTouchEnd(TouchInformation _pTouchInfo)
    {
        if (mCurrentPinch == null)
        {
            return;
        }

        if (mCurrentPinch.mTouchOne == _pTouchInfo)
        {
            mCurrentPinch = null;
            return;
        }

        foreach (var p in mPinchGestures)
        {
            if (p.mTouchOne == _pTouchInfo || p.mTouchTwo == _pTouchInfo)
            {
                mPinchGestures.Remove(p);
                p.mIsDead = true;
                try
                {
                    if (OnPinchEnd != null)
                    {
                        OnPinchEnd(p);
                    }
                }catch (Exception e)
                {
                    Debug.LogException(e);
                }
                break;
            }
        }
    }