Пример #1
0
        private void FingerSet(LeanFinger finger)
        {
            // ignore?
            if (MaxLines > 0 && fingerDatas.Count >= MaxLines)
            {
                return;
            }

            if (IgnoreStartedOverGui == true && finger.StartedOverGui == true)
            {
                return;
            }

            if (IgnoreIsOverGui == true && finger.IsOverGui == true)
            {
                return;
            }

            if (RequiredSelectable != null && RequiredSelectable.IsSelectedBy(finger) == false)
            {
                return;
            }

            // Get data for this finger
            var fingerData = LeanFingerData.FindOrCreate(ref fingerDatas, finger);

            // Create line?
            if (fingerData.Line == null)
            {
                fingerData.Line = Instantiate(LinePrefab);
            }

            // Write line data
            WritePositions(fingerData.Line, fingerData.Finger);
        }
Пример #2
0
        private void FingerSet(LeanFinger finger)
        {
            // ignore?
            if (MaxLines > 0 && links.Count >= MaxLines)
            {
                return;
            }

            if (IgnoreStartedOverGui == true && finger.StartedOverGui == true)
            {
                return;
            }

            if (IgnoreIsOverGui == true && finger.IsOverGui == true)
            {
                return;
            }

            if (RequiredSelectable != null && RequiredSelectable.IsSelectedBy(finger) == false)
            {
                return;
            }

            // Get link for this finger and write positions
            var link = FindLink(finger, true);

            if (link != null && link.Line != null)
            {
                WritePositions(link.Line, link.Finger);
            }
        }
Пример #3
0
        private void HandleFingerSwipe(LeanFinger finger)
        {
            // Make sure this finger was manually added
            if (fingers != null && fingers.Remove(finger) == true)
            {
                if (IgnoreIsOverGui == true && finger.IsOverGui == true)
                {
                    return;
                }

                if (RequiredSelectable != null && RequiredSelectable.IsSelectedBy(finger) == false)
                {
                    return;
                }

                HandleFingerSwipe(finger, finger.StartScreenPosition, finger.ScreenPosition);
            }
        }
Пример #4
0
        private void HandleFingerSwipe(LeanFinger finger)
        {
            if (IgnoreStartedOverGui == true && finger.StartedOverGui == true)
            {
                return;
            }

            if (IgnoreIsOverGui == true && finger.IsOverGui == true)
            {
                return;
            }

            if (RequiredSelectable != null && RequiredSelectable.IsSelectedBy(finger) == false)
            {
                return;
            }

            HandleFingerSwipe(finger, finger.StartScreenPosition, finger.ScreenPosition);
        }
Пример #5
0
        private bool TestFinger(LeanFinger finger, Vector2 screenFrom, Vector2 screenTo)
        {
            if (IgnoreIsOverGui == true && finger.IsOverGui == true)
            {
                return(false);
            }

            if (RequiredSelectable != null && RequiredSelectable.IsSelectedBy(finger) == false)
            {
                return(false);
            }

            if (Check == CheckType.Default && finger.Age >= LeanTouch.CurrentTapThreshold)
            {
                return(false);
            }

            return(AngleIsValid(screenTo - screenFrom));
        }
        private bool TestFinger(LeanFinger finger, ref Vector2 screenFrom, ref Vector2 screenTo)
        {
            if (IgnoreStartedOverGui == true && finger.StartedOverGui == true)
            {
                return(false);
            }

            if (IgnoreIsOverGui == true && finger.IsOverGui == true)
            {
                return(false);
            }

            if (RequiredSelectable != null && RequiredSelectable.IsSelectedBy(finger) == false)
            {
                return(false);
            }

            if (finger.Age >= LeanTouch.CurrentTapThreshold)
            {
                return(false);
            }

            var scalingFactor = LeanTouch.ScalingFactor;
            var sqrThreshold  = LeanTouch.CurrentSwipeThreshold / scalingFactor; sqrThreshold *= sqrThreshold;

            screenTo = finger.ScreenPosition;

            for (var i = finger.Snapshots.Count - 1; i >= 0; i--)
            {
                screenFrom = finger.Snapshots[i].ScreenPosition;

                var screenDelta = screenTo - screenFrom;

                // Valid distance and angle?
                if (screenDelta.sqrMagnitude >= sqrThreshold && AngleIsValid(screenDelta) == true)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #7
0
        private void FingerSwipe(LeanFinger finger)
        {
            // Ignore?
            if (IgnoreStartedOverGui == true && finger.StartedOverGui == true)
            {
                return;
            }

            if (IgnoreIsOverGui == true && finger.IsOverGui == true)
            {
                return;
            }

            if (RequiredSelectable != null && RequiredSelectable.IsSelectedBy(finger) == false)
            {
                return;
            }

            // Perform final swipe check and fire event
            CheckSwipe(finger, finger.SwipeScreenDelta);
        }