Exemplo n.º 1
0
    protected override bool CanBegin(SwipeGesture gesture, FingerGestures.IFingerList touches)
    {
        if (!base.CanBegin(gesture, touches))
        {
            return(false);
        }

        if (touches.GetAverageDistanceFromStart() < 0.5f)
        {
            return(false);
        }

        // all touches must be moving
        if (!touches.AllMoving())
        {
            return(false);
        }

        // if multiple touches, make sure they're all going in roughly the same direction
        if (!touches.MovingInSameDirection(0.35f))
        {
            return(false);
        }

        return(true);
    }
Exemplo n.º 2
0
    protected override bool CanBegin(DragGesture gesture, FingerGestures.IFingerList touches)
    {
        if (!base.CanBegin(gesture, touches))
        {
            return(false);
        }

        // must have moved beyond move tolerance threshold
        if (touches.GetAverageDistanceFromStart() < ToPixels(MoveTolerance))
        {
            return(false);
        }

        // all touches must be moving
        if (!touches.AllMoving())
        {
            return(false);
        }

        // if multiple touches, make sure they're all going in roughly the same direction
        if (RequiredFingerCount >= 2 && ApplySameDirectionConstraint && !touches.MovingInSameDirection(0.35f))
        {
            return(false);
        }

        return(true);
    }
    protected override bool CanBegin(FingerGestures.IFingerList touches)
    {
        if (!base.CanBegin(touches))
        {
            return(false);
        }

        if (touches.GetAverageDistanceFromStart() < 0.5f)
        {
            return(false);
        }

        return(true);
    }
    protected override GestureRecognitionState OnRecognize(LongPressGesture gesture, FingerGestures.IFingerList touches)
    {
        if (touches.Count != RequiredFingerCount)
        {
            return(GestureRecognitionState.Failed);
        }

        if (gesture.ElapsedTime >= Duration)
        {
            return(GestureRecognitionState.Recognized);
        }

        // check if we moved too far from initial position
        if (touches.GetAverageDistanceFromStart() > ToPixels(MoveTolerance))
        {
            return(GestureRecognitionState.Failed);
        }

        return(GestureRecognitionState.InProgress);
    }
    protected override bool CanBegin(DragGesture gesture, FingerGestures.IFingerList touches)
    {
        if (!base.CanBegin(gesture, touches))
        {
            return(false);
        }
        //若是在Ui层上滑动,false
        if (IsPointerOverUIObject())
        {
            return(false);
        }
        // must have moved beyond move tolerance threshold
        if (touches.GetAverageDistanceFromStart() < ToPixels(MoveTolerance))
        {
            return(false);
        }

        // all touches must be moving
        if (!touches.AllMoving())
        {
            return(false);
        }

        // if multiple touches, make sure they're all going in roughly the same direction
        if (RequiredFingerCount >= 2 && ApplySameDirectionConstraint && !touches.MovingInSameDirection(0.35f))
        {
            return(false);
        }
        //判断allPages是否有isActive为true
        foreach (var item in PageMgr.allPages.Values)
        {
            if (item.name == "UIParkPage" || item.name == "UIEntryPage" || item.name == "UIZooPage" || item.name == "UILoading" || item.name == "UIMapPage")
            {
                if (item.isActive() == true)
                {
                    return(false);
                }
            }
        }
        return(true);
    }
    protected override GestureState OnActive(FingerGestures.IFingerList touches)
    {
        if (touches.Count != RequiredFingerCount)
        {
            return(GestureState.Failed);
        }

        if (ElapsedTime >= Duration)
        {
            RaiseOnLongPress();
            return(GestureState.Recognized);
        }

        // check if we moved too far from initial position
        if (touches.GetAverageDistanceFromStart() > MoveTolerance)
        {
            return(GestureState.Failed);
        }

        return(GestureState.InProgress);
    }