Beispiel #1
0
        float GetSwipeThreshold(ISwipeItems swipeItems)
        {
            if (Element == null)
            {
                return(0f);
            }

            double threshold = Element.Threshold;

            if (threshold > 0)
            {
                return((float)threshold);
            }

            float swipeThreshold = 0;

            bool isHorizontal = IsHorizontalSwipe();

            if (swipeItems.Mode == SwipeMode.Reveal)
            {
                if (isHorizontal)
                {
                    foreach (var swipeItem in swipeItems)
                    {
                        if (GetIsVisible(swipeItem))
                        {
                            var swipeItemSize = GetSwipeItemSize(swipeItem);
                            swipeThreshold += (float)swipeItemSize.Width;
                        }
                    }
                }
                else
                {
                    swipeThreshold = GetSwipeItemHeight();
                }
            }
            else
            {
                swipeThreshold = CalculateSwipeThreshold();
            }

            return(ValidateSwipeThreshold(swipeThreshold));
        }
Beispiel #2
0
        double GetSwipeThreshold(ISwipeItems swipeItems)
        {
            if (Element == null)
            {
                return(default(double));
            }

            var threshold = Element.Threshold;

            if (threshold > 0)
            {
                return(threshold);
            }

            double swipeThreshold = 0;
            bool   isHorizontal   = IsHorizontalSwipe();

            if (swipeItems.Mode == SwipeMode.Reveal)
            {
                if (isHorizontal)
                {
                    foreach (var swipeItem in swipeItems)
                    {
                        if (GetIsVisible(swipeItem))
                        {
                            var swipeItemSize = Element.GetSwipeItemSize(swipeItem, _contentView, _swipeDirection);
                            swipeThreshold += swipeItemSize.Width;
                        }
                    }
                }
                else
                {
                    swipeThreshold = Element.GetSwipeItemHeight(_swipeDirection, _contentView);
                }
            }
            else
            {
                swipeThreshold = CalculateSwipeThreshold();
            }

            return(ValidateSwipeThreshold(swipeThreshold));
        }