Esempio n. 1
0
            /// <summary>
            /// Tries to get the current <see cref="TouchesManager"/> for the given view
            /// </summary>
            public static bool TryGet(UIView view, out TouchesManager manager)
            {
                switch (view)
                {
                case NativeScrollContentPresenter presenter:
                    manager = presenter.TouchesManager;
                    return(true);

                case UIScrollView scrollView:
                    manager = _scrollViews.GetValue(scrollView, sv => new ScrollViewTouchesManager((UIScrollView)sv));
                    return(true);

                case ListViewBase listView:
                    manager = listView.NativePanel.TouchesManager;
                    return(true);

                case UIWebView uiWebView:
                    manager = _scrollViews.GetValue(uiWebView.ScrollView, sv => new ScrollViewTouchesManager((UIScrollView)sv));
                    return(true);

                case WKWebView wkWebView:
                    manager = _scrollViews.GetValue(wkWebView.ScrollView, sv => new ScrollViewTouchesManager((UIScrollView)sv));
                    return(true);

                default:
                    manager = default;
                    return(false);
                }
            }
Esempio n. 2
0
        private void PrepareParentTouchesManagers(ManipulationModes mode, bool canDrag)
        {
            // 1. Make sure to end any pending manipulation
            ReleaseParentTouchesManager();

            // 2. If this control can  Walk the tree to detect all ScrollView and register our self as a manipulation listener
            if (mode != ManipulationModes.System || canDrag)
            {
                _parentsTouchesManager = TouchesManager.GetAllParents(this).ToList();

                foreach (var manager in _parentsTouchesManager)
                {
                    manager.RegisterChildListener();
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Tries to get the current <see cref="TouchesManager"/> for the given view
        /// </summary>
        public static bool TryGet(UIView view, out TouchesManager manager)
        {
            switch (view)
            {
            // Custom managers
            case NativeScrollContentPresenter presenter:
                manager = presenter.TouchesManager;
                return(true);

            case NativeListViewBase listView:
                manager = listView.TouchesManager;
                return(true);

            // Generic manager
            case UIScrollView scrollView:
                manager = _scrollViews.GetValue(scrollView, sv => new ScrollViewTouchesManager((UIScrollView)sv));
                return(true);

            // Redirections to nested native scrollable contents
            case ListViewBase listView:
                manager = listView.NativePanel.TouchesManager;                         // We only propagates the touches manager of the nested native ListView/UICollectionView
                return(true);

#if !__MACCATALYST__
            case UIWebView uiWebView:
                manager = _scrollViews.GetValue(uiWebView.ScrollView, sv => new ScrollViewTouchesManager((UIScrollView)sv));
                return(true);
#endif

            case WKWebView wkWebView:
                manager = _scrollViews.GetValue(wkWebView.ScrollView, sv => new ScrollViewTouchesManager((UIScrollView)sv));
                return(true);

            default:
                manager = default;
                return(false);
            }
        }