Пример #1
0
        public void OnEndDrag(PointerEventData eventData)
        {
            //Drag值超出伐值,不能再响应click
            if (_canClick && BelongedForm != null && BelongedForm.ChangeScreenValueToForm(Vector2.Distance(eventData.position, _downPosition)) > _clickAreaValue)
            {
                _canClick = false;
            }

            //派发事件
            if (onDragEnd != null)
            {
                onDragEnd.Invoke(eventData);
            }
            //冒泡
            if (BelongedListView != null && BelongedListView.m_scrollRect != null)
            {
                BelongedListView.m_scrollRect.OnEndDrag(eventData);
            }
            if (DragNext != null)
            {
                DragNext.OnEndDrag(eventData);
            }
            //clear输入状态
            ClearInputStatus();
        }
Пример #2
0
        public void OnDrag(PointerEventData eventData)
        {
            //Drag值超出伐值,不能再响应click
            if (_canClick && BelongedForm != null && BelongedForm.ChangeScreenValueToForm(Vector2.Distance(eventData.position, _downPosition)) > _clickAreaValue)
            {
                _canClick = false;
            }
            //Drag值超出伐值,不能再响应click
            if (Vector2.SqrMagnitude(eventData.position - _downPosition) > 1200)
            {
                _canClick = false;
            }

            //派发事件
            if (onDrag != null)
            {
                onDrag.Invoke(eventData);
            }
            //冒泡
            if (BelongedListView != null && BelongedListView.m_scrollRect != null)
            {
                BelongedListView.m_scrollRect.OnDrag(eventData);
            }
            //
            if (DragNext != null)
            {
                DragNext.OnDrag(eventData);
            }
        }