示例#1
0
 public void InvokePointerDown(Vector2 pointerPosition)
 {
     if (PointerDown != null)
     {
         PointerDown.Invoke(this, new PointerGraphicalElementEventArgs(pointerPosition));
     }
 }
示例#2
0
 void IPointerDownHandler.OnPointerDown(PointerEventData eventData)
 {
     if (!IsMute)
     {
         PointerDown?.Invoke();
     }
 }
示例#3
0
        private bool GetMouseInput()
        {
            if (Input.GetMouseButtonDown(0))
            {
                _startPressPos = Input.mousePosition;
                _currPressPos  = _startPressPos;
                _isSwipeEnded  = false;
                TouchBegan?.Invoke(_startPressPos);
            }
            else if (Input.GetMouseButtonUp(0))
            {
                _endPressPos  = Input.mousePosition;
                _isSwipeEnded = true;
                TouchEnd?.Invoke(_endPressPos);

                return(true);
            }
            else if (Input.GetMouseButton(0))
            {
                _lastPressPos = _currPressPos;
                _currPressPos = Input.mousePosition;
                PointerDown?.Invoke(_currPressPos);

                return(true);
            }

            return(false);
        }
示例#4
0
 public void OnPointerDown(PointerEventData eventData)
 {
     if (preventCameraControl && _cameraControl)
     {
         _noControlFunctionCached       = _cameraControl.NoCtrlCondition;
         _cameraControl.NoCtrlCondition = () => true;
     }
     _pointerDownCalled   = true;
     _cachedDragPosition  = toDrag.position;
     _cachedMousePosition = Input.mousePosition;
     PointerDown?.Invoke(eventData);
 }
示例#5
0
        private void OnPointerDown(EventSystemData Data)
        {
            if (!Enabled)
            {
                return;
            }

            PointerDown?.Invoke(Data.Location);
            IsDrag_           = true;
            IsClick_          = true;
            PreviousDownTime_ = Time.realtimeSinceStartup;
        }
示例#6
0
    public void OnPointerDown(PointerEventData eventData)
    {
        if (eventData.pointerCurrentRaycast.gameObject.tag != "Brick")
        {
            return;
        }

        pointerDown = true;
        int index = eventData.pointerCurrentRaycast.gameObject.transform.GetSiblingIndex();

        PointerDown?.Invoke(index);
    }
示例#7
0
        private void Element_MouseDown(object sender, MouseButtonEventArgs args)
        {
            var id       = GetMouseButton(args);
            var buttons  = GetMouseButtons(args);
            var position = GetPosition(args);

            if (FirstMouseButton == 0)
            {
                FirstMouseButton = id;
            }

            PointerDown?.Invoke(this, new PointerEventArgs(CurrentTime, position, PointerId.FromMouse(id), buttons));
        }
示例#8
0
        private void UpdatePointerState(bool state)
        {
            if (IsPointerDown == state)
            {
                return;
            }

            IsPointerDown = state;
            PointerEventData ev = new PointerEventData(null);

            if (IsPointerDown)
            {
                if (_driveColliders)
                {
                    foreach (IPointerDownHandler down in _downHandlers)
                    {
                        down.OnPointerDown(ev);
                    }
                    foreach (IMouseDownHandler down in _mouseDownHandlers)
                    {
                        down.OnMouseDown();
                    }
                    //TODO - does Click mean it needs both a down + up?
                    foreach (IPointerClickHandler click in _clickHandlers)
                    {
                        click.OnPointerClick(ev);
                    }
                }
                PointerDown.Invoke(this, ev);
            }
            else
            {
                if (_driveColliders)
                {
                    foreach (IPointerUpHandler up in _upHandlers)
                    {
                        up.OnPointerUp(ev);
                    }
                    foreach (IMouseUpHandler up in _mouseUpHandlers)
                    {
                        up.OnMouseUp();
                    }
                }
                PointerUp.Invoke(this, ev);
            }
        }
        public void ReadTouch()
        {
            var touchPosition = _touchDevice.ReadTouchPoints();
            int pressure      = _touchDevice.Pressure;

            if (pressure > 5)
            {
                if (!_penPressed)
                {
                    _penPressed = true;
                    var _ = _dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                        PointerDown?.Invoke(this, new PointerEventArgs()
                        {
                            Position = touchPosition, Pressure = pressure
                        });
                    });
                }
                else
                {
                    var _ = _dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                        PointerMoved?.Invoke(this, new PointerEventArgs()
                        {
                            Position = touchPosition, Pressure = pressure
                        });
                    });
                }
            }
            else if (pressure < 2 && _penPressed == true)
            {
                _penPressed = false;
                var _ = _dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    PointerUp?.Invoke(this, new PointerEventArgs()
                    {
                        Position = touchPosition
                    });
                });
            }
        }
示例#10
0
        private bool GetTouchInput()
        {
            if (Input.touches.Length > 0)
            {
                var touch = Input.GetTouch(0);
                switch (touch.phase)
                {
                case TouchPhase.Began:
                    _startPressPos = touch.position;
                    _currPressPos  = _startPressPos;
                    _isSwipeEnded  = false;
                    TouchBegan?.Invoke(touch.position);

                    break;

                case TouchPhase.Ended:
                case TouchPhase.Canceled:
                    _endPressPos  = touch.position;
                    _isSwipeEnded = true;

                    TouchEnd?.Invoke(touch.position);

                    return(true);

                case TouchPhase.Moved:
                case TouchPhase.Stationary:
                    _lastPressPos = _currPressPos;
                    _currPressPos = touch.position;

                    PointerDown?.Invoke(touch.position);

                    return(true);
                }
            }

            return(false);
        }
示例#11
0
 public virtual void OnPointerDown(PointerEventData eventData)
 {
     _pointersCount++;
     PointerDown.SafeInvoke(eventData);
 }
示例#12
0
 public void OnPointerDown(PointerEventData eventData)
 {
     OnDrag(eventData);
     PointerDown?.Invoke();
 }
示例#13
0
 public void OnPointerDown(PointerEventData eventData)
 {
     PointerDown?.Invoke(eventData.position);
 }
示例#14
0
        public void OnPointerDown(PointerEventData eventData)
        {
            Debug.Log($"On pointer down: {_buttonIndex}");

            PointerDown?.Invoke(eventData, this);
        }
示例#15
0
 public virtual void OnPointerDown(PointerEventData eventData)
 {
     m_IsPressed = true;
     PointerDown?.Invoke(this, eventData);
     ForwardToParents <IPointerDownHandler>((parent) => parent.OnPointerDown(eventData));
 }
示例#16
0
 public void OnPointerDown(PointerEventData eventData)
 {
     IsDragging = true;
     PointerDown.SafeInvoke(_mainCamera.ScreenToWorldPoint(eventData.position));
 }
示例#17
0
 protected virtual void OnPointerDown(object sender, PointerButtonEventArgs e)
 {
     PointerDown?.Invoke(sender, e);
 }
示例#18
0
文件: Timeline.cs 项目: Bodix/Toolkit
        public void OnPointerDown(PointerEventData eventData)
        {
            IsUsing = true;

            PointerDown?.Invoke();
        }
示例#19
0
 public virtual void OnPointerDown(PointerEventData eventData)
 {
     PointerDown.SafeInvoke(eventData);
 }
示例#20
0
 public override void OnPointerDown(PointerEventData eventData)
 {
     base.OnPointerDown(eventData);
     PointerDown?.Invoke();
 }