Example #1
0
        private void processTap(AsTouch touch)
        {
            AsTouch            nearbyTap = null;
            float              minSqDist = MULTITAP_DISTANCE * MULTITAP_DISTANCE;
            AsVector <AsTouch> __taps_   = mLastTaps;

            if (__taps_ != null)
            {
                foreach (AsTouch tap in __taps_)
                {
                    float sqDist = AsMath.pow(tap.getGlobalX() - touch.getGlobalX(), 2) + AsMath.pow(tap.getGlobalY() - touch.getGlobalY(), 2);
                    if (sqDist <= minSqDist)
                    {
                        nearbyTap = tap;
                        break;
                    }
                }
            }
            if (nearbyTap != null)
            {
                touch.setTapCount(nearbyTap.getTapCount() + 1);
                mLastTaps.splice(mLastTaps.indexOf(nearbyTap), (uint)(1));
            }
            else
            {
                touch.setTapCount(1);
            }
            mLastTaps.push(touch.clone());
        }