// Funciona semelhante ao ProcessTouchPress
        protected void ProcessMousePress(MouseButtonEventData data)
        {
            if (interactableList.isEmpty)
            {
                return;
            }
            var pointerEvent = data.buttonData;
            // O objeto selecionado é aquele que está focado, ja que a posição do mouse não importa.
            var currentOverGo = interactableList.focusedGo; //eventSystem.firstSelectedGameObject;//pointerEvent.pointerCurrentRaycast.gameObject;

            if (!currentOverGo)
            {
                return;
            }
            // PointerDown notification
            if (data.PressedThisFrame())
            {
                PressMouseButton(pointerEvent, currentOverGo);
            }

            // PointerUp notification
            if (data.ReleasedThisFrame())
            {
                ReleaseMouseButton(pointerEvent, currentOverGo);
            }
        }
Exemplo n.º 2
0
        private void FakeTouches()
        {
            MouseState           mousePointerEventData = GetMousePointerEventData(0);
            MouseButtonEventData eventData             = mousePointerEventData.GetButtonState(PointerEventData.InputButton.Left).eventData;

            if (eventData.PressedThisFrame())
            {
                eventData.buttonData.delta = Vector2.zero;
            }
            ProcessTouchPress(eventData.buttonData, eventData.PressedThisFrame(), eventData.ReleasedThisFrame());
            if (Input.GetMouseButton(0))
            {
                ProcessMove(eventData.buttonData);
                ProcessDrag(eventData.buttonData);
            }
        }
        private void ProcessMousePress(MouseButtonEventData data)
        {
            var pointerEvent  = data.buttonData;
            var currentOverGo = pointerEvent.pointerCurrentRaycast.gameObject;

            // PointerDown notification
            if (data.PressedThisFrame())
            {
                // search for the control that will receive the press
                // if we can't find a press handler set the press
                // handler to be what would receive a click.
                var newPressed = ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.pointerDownHandler);

                // didnt find a press handler... search for a click handler
                if (newPressed == null)
                {
                    newPressed = ExecuteEvents.GetEventHandler <IPointerClickHandler>(currentOverGo);
                }

                pointerEvent.pointerPress    = newPressed;
                pointerEvent.rawPointerPress = currentOverGo;

                // Save the drag handler as well
                pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler <IDragHandler>(currentOverGo);

                if (pointerEvent.pointerDrag != null)
                {
                    ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag);
                }
            }

            // PointerUp notification
            if (data.ReleasedThisFrame())
            {
                ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler);

                // see if we mouse up on the same element that we clicked on...
                var pointerUpHandler = ExecuteEvents.GetEventHandler <IPointerClickHandler>(currentOverGo);

                // PointerClick and Drop events
                if (pointerEvent.pointerPress == pointerUpHandler)
                {
                    ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerClickHandler);
                }
                else if (pointerEvent.pointerDrag != null)
                {
                    ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.dropHandler);
                }

                pointerEvent.pointerPress    = null;
                pointerEvent.rawPointerPress = null;

                if (pointerEvent.pointerDrag != null)
                {
                    ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.endDragHandler);
                }

                pointerEvent.pointerDrag = null;
            }
        }
        private GestureEventData MouseToTouch(MouseButtonEventData data)
        {
            GestureEventData gestureData = new GestureEventData(eventSystem)
            {
                pointer  = data.buttonData,
                pressed  = data.PressedThisFrame(),
                released = data.ReleasedThisFrame()
            };

            return(gestureData);
        }
Exemplo n.º 5
0
        private void ProcessPointerPress(MouseButtonEventData inputEvent)
        {
            PointerEventData pointerEvent  = inputEvent.buttonData;
            GameObject       currentOverGo = pointerEvent.pointerCurrentRaycast.gameObject;

            if (inputEvent.PressedThisFrame())
            {
                ProcessPointerPressed(pointerEvent, currentOverGo);
            }

            if (inputEvent.ReleasedThisFrame())
            {
                ProcessPointerReleased(pointerEvent, currentOverGo);
            }
        }
        public override void Process()
        {
            // Try to get pointer for this input module
            pointerEventData = new PointerEventData(EventSystem.current);
            GetPointerData(kMouseLeftId, out pointerEventData, true);

            pointerEventData.Reset();
            pointerEventData.delta       = Vector2.zero;
            pointerEventData.position    = new Vector2(Screen.width * 0.5f, Screen.height * 0.5f);
            pointerEventData.scrollDelta = Vector2.zero;
            pointerEventData.button      = PointerEventData.InputButton.Left;

            // Raycast pointer to canvas
            m_RaycastResultCache.Clear();
            eventSystem.RaycastAll(pointerEventData, m_RaycastResultCache);
            pointerEventData.pointerCurrentRaycast = FindFirstRaycast(m_RaycastResultCache);
            PointerHitCanvas = m_RaycastResultCache.Count > 0;
            UpdatePointerWorldPosition();

            // Process presses & events
            mouseState.SetButtonState(PointerEventData.InputButton.Left, GetPressState(), pointerEventData);
            MouseButtonEventData buttonState = mouseState.GetButtonState(PointerEventData.InputButton.Left).eventData;

            if (buttonState.PressedThisFrame())
            {
                ButtonPress(buttonState.buttonData);
            }

            if (buttonState.ReleasedThisFrame())
            {
                ButtonRelease(buttonState.buttonData);
            }

            ProcessMove(buttonState.buttonData);

            if (buttonHeld)
            {
                ProcessDrag(buttonState.buttonData);
            }
        }
        /// <summary>
        /// Process the current mouse press.
        /// </summary>
        private void ProcessMousePress(MouseButtonEventData data)
        {
            var pointerEvent = data.buttonData;
            var currentOverGo = pointerEvent.pointerCurrentRaycast.gameObject;

            // PointerDown notification
            if(data.PressedThisFrame()) {
                pointerEvent.eligibleForClick = true;
                pointerEvent.delta = Vector2.zero;
                pointerEvent.dragging = false;
                pointerEvent.useDragThreshold = true;
                pointerEvent.pressPosition = pointerEvent.position;
                pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast;

                DeselectIfSelectionChanged(currentOverGo, pointerEvent);

                // search for the control that will receive the press
                // if we can't find a press handler set the press
                // handler to be what would receive a click.
                var newPressed = ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.pointerDownHandler);

                // didnt find a press handler... search for a click handler
                if(newPressed == null)
                    newPressed = ExecuteEvents.GetEventHandler<IPointerClickHandler>(currentOverGo);

                // Debug.Log("Pressed: " + newPressed);

                float time = Time.unscaledTime;

                if(newPressed == pointerEvent.lastPress) {
                    var diffTime = time - pointerEvent.clickTime;
                    if(diffTime < 0.3f)
                        ++pointerEvent.clickCount;
                    else
                        pointerEvent.clickCount = 1;

                    pointerEvent.clickTime = time;
                } else {
                    pointerEvent.clickCount = 1;
                }

                pointerEvent.pointerPress = newPressed;
                pointerEvent.rawPointerPress = currentOverGo;

                pointerEvent.clickTime = time;

                // Save the drag handler as well
                pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler<IDragHandler>(currentOverGo);

                if(pointerEvent.pointerDrag != null)
                    ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag);
            }

            // PointerUp notification
            if(data.ReleasedThisFrame()) {
                // Debug.Log("Executing pressup on: " + pointer.pointerPress);
                ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler);

                // Debug.Log("KeyCode: " + pointer.eventData.keyCode);

                // see if we mouse up on the same element that we clicked on...
                var pointerUpHandler = ExecuteEvents.GetEventHandler<IPointerClickHandler>(currentOverGo);

                // PointerClick and Drop events
                if(pointerEvent.pointerPress == pointerUpHandler && pointerEvent.eligibleForClick) {
                    ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerClickHandler);
                } else if(pointerEvent.pointerDrag != null) {
                    ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.dropHandler);
                }

                pointerEvent.eligibleForClick = false;
                pointerEvent.pointerPress = null;
                pointerEvent.rawPointerPress = null;

                if(pointerEvent.pointerDrag != null && pointerEvent.dragging)
                    ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.endDragHandler);

                pointerEvent.dragging = false;
                pointerEvent.pointerDrag = null;

                // redo pointer enter / exit to refresh state
                // so that if we moused over somethign that ignored it before
                // due to having pressed on something else
                // it now gets it.
                if(currentOverGo != pointerEvent.pointerEnter) {
                    HandlePointerExitAndEnter(pointerEvent, null);
                    HandlePointerExitAndEnter(pointerEvent, currentOverGo);
                }
            }
        }
Exemplo n.º 8
0
    /// <summary>
    /// Calculate and process any mouse button state changes.
    /// </summary>
    protected void ProcessMousePress(MouseButtonEventData data)
    {
        var pointerEvent  = data.buttonData;
        var currentOverGo = pointerEvent.pointerCurrentRaycast.gameObject;

        // PointerDown notification
        if (data.PressedThisFrame())
        {
            pointerEvent.eligibleForClick    = true;
            pointerEvent.delta               = Vector2.zero;
            pointerEvent.dragging            = false;
            pointerEvent.useDragThreshold    = true;
            pointerEvent.pressPosition       = pointerEvent.position;
            pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast;

            //DeselectIfSelectionChanged(currentOverGo, pointerEvent);

            // search for the control that will receive the press
            // if we can't find a press handler set the press
            // handler to be what would receive a click.
            var newPressed = ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.pointerDownHandler);

            // didnt find a press handler... search for a click handler
            if (newPressed == null)
            {
                newPressed = ExecuteEvents.GetEventHandler <IPointerClickHandler>(currentOverGo);
            }

            // Debug.Log("Pressed: " + newPressed);

            float time = Time.unscaledTime;

            if (newPressed == pointerEvent.lastPress)
            {
                var diffTime = time - pointerEvent.clickTime;
                if (diffTime < 0.3f)
                {
                    ++pointerEvent.clickCount;
                }
                else
                {
                    pointerEvent.clickCount = 1;
                }

                pointerEvent.clickTime = time;
            }
            else
            {
                pointerEvent.clickCount = 1;
            }

            pointerEvent.pointerPress    = newPressed;
            pointerEvent.rawPointerPress = currentOverGo;

            pointerEvent.clickTime = time;

            // Save the drag handler as well
            pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler <IDragHandler>(currentOverGo);

            if (pointerEvent.pointerDrag != null)
            {
                ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag);
            }

            m_InputPointerEvent = pointerEvent;
        }

        // PointerUp notification
        if (data.ReleasedThisFrame())
        {
            ReleaseMouse(pointerEvent, currentOverGo);
        }
    }
Exemplo n.º 9
0
        protected void ProcessMousePress(MouseButtonEventData data)
        {
            var pointerEvent  = data.buttonData;
            var currentOverGo = pointerEvent.pointerCurrentRaycast.gameObject;

            // PointerDown notification
            if (data.PressedThisFrame())
            {
                pointerEvent.eligibleForClick    = true;
                pointerEvent.delta               = Vector2.zero;
                pointerEvent.dragging            = false;
                pointerEvent.useDragThreshold    = true;
                pointerEvent.pressPosition       = pointerEvent.position;
                pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast;

                DeselectIfSelectionChanged(currentOverGo, pointerEvent);

                var newPressed = ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.pointerDownHandler);

                // didnt find a press handler... search for a click handler
                if ((object)newPressed == null)
                {
                    newPressed = ExecuteEvents.GetEventHandler <IPointerClickHandler> (currentOverGo);
                }

                // Debug.Log("Pressed: " + newPressed);

                var time = Time.unscaledTime;

                if (newPressed == pointerEvent.lastPress)
                {
                    var diffTime = time - pointerEvent.clickTime;
                    if (diffTime < 0.3f)
                    {
                        pointerEvent.clickCount++;
                    }
                    else
                    {
                        pointerEvent.clickCount = 1;
                    }

                    //                    pointerEvent.clickTime = time;
                }
                else
                {
                    pointerEvent.clickCount = 1;
                }

                pointerEvent.pointerPress    = newPressed;
                pointerEvent.rawPointerPress = currentOverGo;

                pointerEvent.clickTime = time;

                // Save the drag handler as well
                pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler <IDragHandler> (currentOverGo);

                if (pointerEvent.pointerDrag != null)
                {
                    ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag);
                }
            }

            // PointerUp notification
            if (data.ReleasedThisFrame())
            {
                // Debug.Log("Executing pressup on: " + pointer.pointerPress);
                ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler);
                var pointerUpHandler = ExecuteEvents.GetEventHandler <IPointerClickHandler> (currentOverGo);
                if (pointerEvent.pointerPress == pointerUpHandler && pointerEvent.eligibleForClick)
                {
                    ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerClickHandler);
                }
                else
                {
                    if (pointerEvent.pointerDrag != null && pointerEvent.dragging)
                    {
                        ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.dropHandler);
                    }
                }

                pointerEvent.eligibleForClick = false;
                pointerEvent.pointerPress     = null;
                pointerEvent.rawPointerPress  = null;

                if (pointerEvent.pointerDrag != null && pointerEvent.dragging)
                {
                    ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.endDragHandler);
                }

                pointerEvent.dragging    = false;
                pointerEvent.pointerDrag = null;

                if (currentOverGo != pointerEvent.pointerEnter)
                {
                    HandlePointerExitAndEnter(pointerEvent, null);
                    HandlePointerExitAndEnter(pointerEvent, currentOverGo);
                }
            }
        }
		private void ProcessMousePress ( MouseButtonEventData data )
		{
			var pointerEvent = data.buttonData;
			var currentOverGo = pointerEvent.pointerCurrentRaycast.gameObject;
			
			// PointerDown notification
			if( data.PressedThisFrame() )
			{
				// search for the control that will receive the press
				// if we can't find a press handler set the press
				// handler to be what would receive a click.
				var newPressed = ExecuteEvents.ExecuteHierarchy( currentOverGo, pointerEvent, ExecuteEvents.pointerDownHandler );
				
				// didnt find a press handler... search for a click handler
				if( newPressed == null )
					newPressed = ExecuteEvents.GetEventHandler<IPointerClickHandler>( currentOverGo );
				
				pointerEvent.pointerPress = newPressed;
				pointerEvent.rawPointerPress = currentOverGo;
				
				// Save the drag handler as well
				pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler<IDragHandler>( currentOverGo );
				
				if( pointerEvent.pointerDrag != null )
					ExecuteEvents.Execute( pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag );
			}
			
			// PointerUp notification
			if( data.ReleasedThisFrame() )
			{
				ExecuteEvents.Execute( pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler );
				
				// see if we mouse up on the same element that we clicked on...
				var pointerUpHandler = ExecuteEvents.GetEventHandler<IPointerClickHandler>( currentOverGo );
				
				// PointerClick and Drop events
				if( pointerEvent.pointerPress == pointerUpHandler )
					ExecuteEvents.Execute( pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerClickHandler );
				else if( pointerEvent.pointerDrag != null )
					ExecuteEvents.ExecuteHierarchy( currentOverGo, pointerEvent, ExecuteEvents.dropHandler );

				pointerEvent.pointerPress = null;
				pointerEvent.rawPointerPress = null;
				
				if( pointerEvent.pointerDrag != null )
					ExecuteEvents.Execute( pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.endDragHandler );

				pointerEvent.pointerDrag = null;
			}
		}
    private void processMousePress(MouseButtonEventData data)
    {
        var pointerEvent  = data.buttonData;
        var currentOverGo = pointerEvent.pointerCurrentRaycast.gameObject;

        if (data.PressedThisFrame())
        {
            pointerEvent.eligibleForClick    = true;
            pointerEvent.delta               = Vector2.zero;
            pointerEvent.dragging            = false;
            pointerEvent.useDragThreshold    = true;
            pointerEvent.pressPosition       = pointerEvent.position;
            pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast;

            DeselectIfSelectionChanged(currentOverGo, pointerEvent);

            var newPressed = ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.pointerDownHandler);
            if (newPressed == null)
            {
                newPressed = ExecuteEvents.GetEventHandler <IPointerClickHandler>(currentOverGo);
            }

            float time = Time.unscaledTime;
            if (newPressed == pointerEvent.lastPress)
            {
                var diffTime = time - pointerEvent.clickTime;
                if (diffTime < 0.3f)
                {
                    pointerEvent.clickCount++;
                }
                else
                {
                    pointerEvent.clickCount = 1;
                }
            }
            else
            {
                pointerEvent.clickCount = 1;
            }

            pointerEvent.pointerPress    = newPressed;
            pointerEvent.rawPointerPress = currentOverGo;
            pointerEvent.clickTime       = time;

            pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler <IDragHandler>(currentOverGo);
            if (pointerEvent.pointerDrag != null)
            {
                ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag);
            }
        }

        if (data.ReleasedThisFrame())
        {
            ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler);

            var pointerUpHandler = ExecuteEvents.GetEventHandler <IPointerClickHandler>(currentOverGo);
            if (pointerEvent.pointerPress == pointerUpHandler && pointerEvent.eligibleForClick)
            {
                ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerClickHandler);
            }
            else if (pointerEvent.pointerDrag != null && pointerEvent.dragging)
            {
                ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.dropHandler);
            }

            pointerEvent.eligibleForClick = false;
            pointerEvent.pointerPress     = null;
            pointerEvent.rawPointerPress  = null;

            if (pointerEvent.pointerDrag != null && pointerEvent.dragging)
            {
                ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.endDragHandler);
            }

            pointerEvent.dragging    = false;
            pointerEvent.pointerDrag = null;

            if (currentOverGo != pointerEvent.pointerEnter)
            {
                HandlePointerExitAndEnter(pointerEvent, null);
                HandlePointerExitAndEnter(pointerEvent, currentOverGo);
            }
        }
    }
Exemplo n.º 12
0
        private void ProcessMouseEventForPC()
        {
            if (m_Disable == true)
            {
                return;
            }

            //----------------------------------

            MouseState mouseData = GetMousePointerEventData();

            bool pressed  = mouseData.AnyPressesThisFrame();
            bool released = mouseData.AnyReleasesThisFrame();

            MouseButtonEventData leftButtonData = mouseData.GetButtonState(PointerEventData.InputButton.Left).eventData;

            if (leftButtonData.PressedThisFrame() == true)
            {
                m_LastPress = leftButtonData.buttonData.pointerCurrentRaycast.gameObject;
//				Debug.LogWarning( "LastPress設定:" + m_LastPress ) ;
            }

            //レイキャスト消失により Relese 状態になった場合の対応
            bool isPressed = Input.GetMouseButton(0);

            if (isPressed != m_IsPressed)
            {
//				if( isPressed == false )
//				{
//					Debug.LogWarning( "直判定で離された:" + leftButtonData.buttonState ) ;
//				}

                if (released == false && isPressed == false)
                {
                    released = true;

                    if (leftButtonData.buttonState == PointerEventData.FramePressState.NotChanged)
                    {
                        leftButtonData.buttonState = PointerEventData.FramePressState.Released;

//						Debug.LogWarning( "LastPress:" + m_LastPress ) ;

                        leftButtonData.buttonData.pointerPress = m_LastPress;
                        m_LastPress = null;
                    }
                }

                m_IsPressed = isPressed;
            }

            // マウスオーバーに関してはマウスが動いていなくても取りたい
            ProcessHoverForPC(leftButtonData.buttonData);

            if (UseMouseForPC(pressed, released, leftButtonData.buttonData) == false)
            {
                // 何のイベントも無い
                return;
            }

            // Process the first mouse button fully
            ProcessMousePress(leftButtonData);                  // デフォルトでは途中でレイキャストが変わった場合のリリースがうまくいかないので改造版を使用する
//			ProcessMove( leftButtonData.buttonData ) ;
            ProcessDrag(leftButtonData.buttonData);

            // Now process right / middle clicks
//			ProcessMousePress( mouseData.GetButtonState( PointerEventData.InputButton.Right ).eventData ) ;
//			ProcessDrag( mouseData.GetButtonState( PointerEventData.InputButton.Right ).eventData.buttonData ) ;
//			ProcessMousePress( mouseData.GetButtonState( PointerEventData.InputButton.Middle ).eventData ) ;
//			ProcessDrag( mouseData.GetButtonState(PointerEventData.InputButton.Middle).eventData.buttonData ) ;

            if (Mathf.Approximately(leftButtonData.buttonData.scrollDelta.sqrMagnitude, 0.0f) == false)
            {
                GameObject scrollHandler = ExecuteEvents.GetEventHandler <IScrollHandler>(leftButtonData.buttonData.pointerCurrentRaycast.gameObject);
                ExecuteEvents.ExecuteHierarchy(scrollHandler, leftButtonData.buttonData, ExecuteEvents.scrollHandler);
            }
        }
        protected void ProcessMousePress (MouseButtonEventData data) {
            var pointerEvent = data.buttonData;
            var currentOverGo = pointerEvent.pointerCurrentRaycast.gameObject;

            // PointerDown notification
            if (data.PressedThisFrame ()) {
                pointerEvent.eligibleForClick = true;
                pointerEvent.delta = Vector2.zero;
                pointerEvent.dragging = false;
                pointerEvent.useDragThreshold = true;
                pointerEvent.pressPosition = pointerEvent.position;
                pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast;

                DeselectIfSelectionChanged (currentOverGo, pointerEvent);

                var newPressed = ExecuteEvents.ExecuteHierarchy (currentOverGo, pointerEvent, ExecuteEvents.pointerDownHandler);

                // didnt find a press handler... search for a click handler
                if ((object) newPressed == null) {
                    newPressed = ExecuteEvents.GetEventHandler<IPointerClickHandler> (currentOverGo);
                }

                // Debug.Log("Pressed: " + newPressed);

                var time = Time.unscaledTime;

                if (newPressed == pointerEvent.lastPress) {
                    var diffTime = time - pointerEvent.clickTime;
                    if (diffTime < 0.3f) {
                        pointerEvent.clickCount++;
                    } else {
                        pointerEvent.clickCount = 1;
                    }

//                    pointerEvent.clickTime = time;
                } else {
                    pointerEvent.clickCount = 1;
                }

                pointerEvent.pointerPress = newPressed;
                pointerEvent.rawPointerPress = currentOverGo;

                pointerEvent.clickTime = time;

                // Save the drag handler as well
                pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler<IDragHandler> (currentOverGo);

                if (pointerEvent.pointerDrag != null) {
                    ExecuteEvents.Execute (pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag);
                }
            }

            // PointerUp notification
            if (data.ReleasedThisFrame ()) {
                // Debug.Log("Executing pressup on: " + pointer.pointerPress);
                ExecuteEvents.Execute (pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler);
                var pointerUpHandler = ExecuteEvents.GetEventHandler<IPointerClickHandler> (currentOverGo);
                if (pointerEvent.pointerPress == pointerUpHandler && pointerEvent.eligibleForClick) {
                    ExecuteEvents.Execute (pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerClickHandler);
                } else {
                    if (pointerEvent.pointerDrag != null && pointerEvent.dragging) {
                        ExecuteEvents.ExecuteHierarchy (currentOverGo, pointerEvent, ExecuteEvents.dropHandler);
                    }
                }

                pointerEvent.eligibleForClick = false;
                pointerEvent.pointerPress = null;
                pointerEvent.rawPointerPress = null;

                if (pointerEvent.pointerDrag != null && pointerEvent.dragging) {
                    ExecuteEvents.Execute (pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.endDragHandler);
                }

                pointerEvent.dragging = false;
                pointerEvent.pointerDrag = null;

                if (currentOverGo != pointerEvent.pointerEnter) {
                    HandlePointerExitAndEnter (pointerEvent, null);
                    HandlePointerExitAndEnter (pointerEvent, currentOverGo);
                }
            }
        }
Exemplo n.º 14
0
        /// <summary>
        ///     Process the current mouse press.
        /// </summary>
        private void ProcessMousePress(MouseButtonEventData data)
        {
            PointerEventData pointerEvent   = data.buttonData;
            DisplayObject    currentOverObj = pointerEvent.pointerCurrentRaycast.displayObject;

            // PointerDown notification
            if (data.PressedThisFrame())
            {
                pointerEvent.eligibleForClick    = true;
                pointerEvent.delta               = Vector2.zero;
                pointerEvent.dragging            = false;
                pointerEvent.useDragThreshold    = true;
                pointerEvent.pressPosition       = pointerEvent.position;
                pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast;

                this.DeselectIfSelectionChanged(currentOverObj, pointerEvent);

                DisplayObject newPressed = ExecuteEvents.ExecuteHierarchy(currentOverObj, pointerEvent,
                                                                          EventTriggerType.PointerDown);

                ExecuteEvents.GetEventHandlerChain(currentOverObj, EventTriggerType.PointerClick, pointerEvent.clicked);

                float time = Time.unscaledTime;

                if (newPressed == pointerEvent.lastDown)
                {
                    float diffTime = time - pointerEvent.clickTime;
                    if (diffTime < 0.3f)
                    {
                        ++pointerEvent.clickCount;
                    }
                    else
                    {
                        pointerEvent.clickCount = 1;
                    }

                    pointerEvent.clickTime = time;
                }
                else
                {
                    pointerEvent.clickCount = 1;
                }

                pointerEvent.pointerClick    = pointerEvent.clicked.Count > 0 ? pointerEvent.clicked[0] : null;
                pointerEvent.pointerDown     = newPressed;
                pointerEvent.rawPointerPress = currentOverObj;

                pointerEvent.clickTime = time;

                // Save the drag handler as well
                pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler(currentOverObj, EventTriggerType.Drag);

                ExecuteEvents.ExecuteHierarchy(pointerEvent.pointerDrag, pointerEvent, EventTriggerType.InitializePotentialDrag);
            }

            // PointerUp notification
            if (data.ReleasedThisFrame())
            {
                ExecuteEvents.ExecuteHierarchy(pointerEvent.pointerDown, pointerEvent, EventTriggerType.PointerUp);

                ExecuteEvents.GetEventHandlerChain(currentOverObj, EventTriggerType.PointerClick, pointerEvent.released);

                // Click events
                if (pointerEvent.eligibleForClick && pointerEvent.clicked.Count > 0)
                {
                    int count = pointerEvent.released.Count;
                    for (int i = 0; i < count; i++)
                    {
                        DisplayObject pointerUpHandler = pointerEvent.released[i];
                        if (pointerEvent.clicked.Contains(pointerUpHandler))
                        {
                            ExecuteEvents.Execute(pointerUpHandler, pointerEvent, EventTriggerType.PointerClick);
                        }
                    }
                }
                // Drop events
                if (pointerEvent.pointerDrag != null && pointerEvent.dragging)
                {
                    ExecuteEvents.ExecuteHierarchy(currentOverObj, pointerEvent, EventTriggerType.Drop);
                }

                pointerEvent.eligibleForClick = false;
                pointerEvent.clicked.Clear();
                pointerEvent.released.Clear();
                pointerEvent.pointerClick    = null;
                pointerEvent.pointerDown     = null;
                pointerEvent.rawPointerPress = null;

                if (pointerEvent.pointerDrag != null && pointerEvent.dragging)
                {
                    ExecuteEvents.ExecuteHierarchy(pointerEvent.pointerDrag, pointerEvent, EventTriggerType.EndDrag);
                }

                pointerEvent.dragging    = false;
                pointerEvent.pointerDrag = null;

                // redo pointer enter / exit to refresh state
                // so that if we moused over somethign that ignored it before
                // due to having pressed on something else
                // it now gets it.
                if (currentOverObj != pointerEvent.pointerEnter)
                {
                    this.HandlePointerExitAndEnter(pointerEvent, null);
                    this.HandlePointerExitAndEnter(pointerEvent, currentOverObj);
                }
            }
        }
Exemplo n.º 15
0
        private void ProcessMousePress(MouseButtonEventData data)
        {
            InputData    pointerEvent   = data.buttonData;
            IInteractive currentOverObj = pointerEvent.currentRaycast.interactive;

            if (data.PressedThisFrame())
            {
                pointerEvent.delta         = Vector2.zero;
                pointerEvent.dragging      = false;
                pointerEvent.pressPosition = pointerEvent.position;

                if (currentOverObj != null && this.pointerHandler != null)
                {
                    this.pointerHandler.Invoke(currentOverObj, PointerType.Down, pointerEvent);
                }

                float time = Time.unscaledTime;
                if (currentOverObj == pointerEvent.lastDown)
                {
                    float diffTime = time - pointerEvent.clickTime;
                    if (diffTime < 0.3f)
                    {
                        ++pointerEvent.clickCount;
                    }
                    else
                    {
                        pointerEvent.clickCount = 1;
                    }

                    pointerEvent.clickTime = time;
                }
                else
                {
                    pointerEvent.clickCount = 1;
                }

                pointerEvent.pointerDown = currentOverObj;
                pointerEvent.pointerDrag = currentOverObj;
                pointerEvent.clickTime   = time;

                if (pointerEvent.pointerDrag != null && this.pointerHandler != null)
                {
                    this.pointerHandler.Invoke(pointerEvent.pointerDrag, PointerType.InitializePotentialDrag, pointerEvent);
                }
            }

            if (data.ReleasedThisFrame())
            {
                if (pointerEvent.pointerDown != null && this.pointerHandler != null)
                {
                    this.pointerHandler.Invoke(pointerEvent.pointerDown, PointerType.Up, pointerEvent);

                    if (pointerEvent.pointerDown == currentOverObj)
                    {
                        this.pointerHandler.Invoke(pointerEvent.pointerDown, PointerType.Click, pointerEvent);
                    }
                }

                if (pointerEvent.pointerDrag != null && pointerEvent.dragging && currentOverObj != null && this.pointerHandler != null)
                {
                    this.pointerHandler.Invoke(currentOverObj, PointerType.Drop, pointerEvent);
                }

                pointerEvent.pointerDown = null;

                if (pointerEvent.pointerDrag != null && pointerEvent.dragging && this.pointerHandler != null)
                {
                    this.pointerHandler.Invoke(pointerEvent.pointerDrag, PointerType.EndDrag, pointerEvent);
                }

                pointerEvent.dragging    = false;
                pointerEvent.pointerDrag = null;

                if (currentOverObj != pointerEvent.pointerEnter)
                {
                    this.HandlePointerExitAndEnter(pointerEvent, null);
                    this.HandlePointerExitAndEnter(pointerEvent, currentOverObj);
                }
            }
        }
        public override void Process()
        {
            if (eventSystem.currentSelectedGameObject != null)
            {
                ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, GetBaseEventData(), ExecuteEvents.updateSelectedHandler);
            }

            PointerEventData eventData;

            GetPointerData(kMouseLeftId, out eventData, true);
            eventData.Reset();
            eventData.scrollDelta = Input.mouseScrollDelta;

            if (graphicRaycaster)
            {
                graphicRaycaster.Raycast(eventData, m_RaycastResultCache);
                eventData.pointerCurrentRaycast = FindFirstRaycast(m_RaycastResultCache);
                m_RaycastResultCache.Clear();
            }

            MouseState mouseState = new MouseState();

            mouseState.SetButtonState(PointerEventData.InputButton.Left, StateForMouseButton(0), eventData);

            MouseButtonEventData buttonData   = mouseState.GetButtonState(PointerEventData.InputButton.Left).eventData;
            PointerEventData     pointerEvent = buttonData.buttonData;
            GameObject           currentGO    = pointerEvent.pointerCurrentRaycast.gameObject;

            // mouse pointer down
            if (buttonData.PressedThisFrame())
            {
                pointerEvent.eligibleForClick    = true;
                pointerEvent.delta               = Vector2.zero;
                pointerEvent.pressPosition       = pointerEvent.position;
                pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast;

                DeselectIfSelectionChanged(currentGO, pointerEvent);

                GameObject pressedGO = ExecuteEvents.ExecuteHierarchy(currentGO, pointerEvent, ExecuteEvents.pointerDownHandler);

                if (pressedGO == null)
                {
                    pressedGO = ExecuteEvents.GetEventHandler <IPointerClickHandler>(currentGO);
                }

                pointerEvent.clickCount      = 1;
                pointerEvent.pointerPress    = pressedGO;
                pointerEvent.rawPointerPress = currentGO;
                pointerEvent.clickTime       = Time.unscaledTime;
            }

            // mouse pointer up
            if (buttonData.ReleasedThisFrame())
            {
                ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler);

                GameObject pointerUpHandler = ExecuteEvents.GetEventHandler <IPointerClickHandler>(currentGO);
                if (pointerEvent.pointerPress == pointerUpHandler && pointerEvent.eligibleForClick)
                {
                    ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerClickHandler);
                }

                if (currentGO != pointerEvent.pointerEnter)
                {
                    HandlePointerExitAndEnter(pointerEvent, null);
                    HandlePointerExitAndEnter(pointerEvent, currentGO);
                }
            }

            // scroll wheel
            if (!Mathf.Approximately(buttonData.buttonData.scrollDelta.sqrMagnitude, 0.0f))
            {
                GameObject scrollHandler = ExecuteEvents.GetEventHandler <IScrollHandler>(buttonData.buttonData.pointerCurrentRaycast.gameObject);
                ExecuteEvents.ExecuteHierarchy(scrollHandler, buttonData.buttonData, ExecuteEvents.scrollHandler);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Calculate and process any mouse button state changes.
        /// </summary>
        protected void ProcessMousePress(MouseButtonEventData data)
        {
            var pointerEvent = data.buttonData;

            float holdTime = Time.unscaledTime;
            // useRaycastObject = holdTime - lastPressedTime >= 0.5f;
            // lastPressedTime = Time.unscaledTime;

            var currentOverGo = useRaycastObject?pointerEvent.pointerCurrentRaycast.gameObject:interactableList.focusedGo;



            // PointerDown notification
            if (data.PressedThisFrame())
            {
                pointerEvent.eligibleForClick    = true;
                pointerEvent.delta               = Vector2.zero;
                pointerEvent.dragging            = false;
                pointerEvent.useDragThreshold    = true;
                pointerEvent.pressPosition       = pointerEvent.position;
                pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast;

                if (useRaycastObject)
                {
                    DeselectIfSelectionChanged(currentOverGo, pointerEvent);
                }

                GameObject newPressed;
                if (useRaycastObject)
                {
                    // search for the control that will receive the press
                    // if we can't find a press handler set the press
                    // handler to be what would receive a click.
                    newPressed = ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.pointerDownHandler);
                }
                else
                {
                    newPressed = ExecuteEvents.GetEventHandler <IPointerDownHandler>(currentOverGo);
                }
                // didnt find a press handler... search for a click handler
                if (newPressed == null)
                {
                    newPressed = ExecuteEvents.GetEventHandler <IPointerClickHandler>(currentOverGo);
                }


                float time = Time.unscaledTime;

                if (newPressed == pointerEvent.lastPress)
                {
                    var diffTime = time - pointerEvent.clickTime;
                    if (diffTime < 0.3f)
                    {
                        ++pointerEvent.clickCount;
                    }
                    else
                    {
                        pointerEvent.clickCount = 1;
                    }

                    pointerEvent.clickTime = time;
                }
                else
                {
                    pointerEvent.clickCount = 1;
                }

                // Caso seja uma interação que o evento evento de "pressionar ocorra"
                // Tem maiores efeitos na responsividade do sistema.
                if (!useRaycastObject && pointerEvent.clickCount >= minClicks)
                {
                    ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.pointerDownHandler);
                }

                pointerEvent.pointerPress    = newPressed;
                pointerEvent.rawPointerPress = currentOverGo;

                pointerEvent.clickTime = time;

                // Save the drag handler as well
                pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler <IDragHandler>(currentOverGo);

                if (pointerEvent.pointerDrag != null)
                {
                    ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag);
                }

                m_InputPointerEvent = pointerEvent;
                holding             = true;
                lastPressedTime     = Time.unscaledTime;
            }
            // PointerUp notification
            if (data.ReleasedThisFrame())
            {
                holding = false;
                moving  = false;
                ReleaseMouse(pointerEvent, currentOverGo);
                dragging = false;
            }
        }
 private GestureEventData MouseToTouch(MouseButtonEventData data)
 {
     GestureEventData gestureData = new GestureEventData(eventSystem)
     {
         pointer = data.buttonData,
         pressed = data.PressedThisFrame(),
         released = data.ReleasedThisFrame()
     };
     return gestureData;
 }
Exemplo n.º 19
0
        protected void ProcessMousePress(MouseButtonEventData data)
        {
            PointerEventData buttonData  = data.buttonData;
            GameObject       gameObject1 = buttonData.pointerCurrentRaycast.gameObject;

            if (data.PressedThisFrame())
            {
                buttonData.eligibleForClick    = true;
                buttonData.delta               = Vector2.zero;
                buttonData.dragging            = false;
                buttonData.useDragThreshold    = true;
                buttonData.pressPosition       = buttonData.position;
                buttonData.pointerPressRaycast = buttonData.pointerCurrentRaycast;
//				DeselectIfSelectionChanged(gameObject1, buttonData);
                GameObject gameObject2 = ExecuteEvents.ExecuteHierarchy <IPointerDownHandler>(gameObject1, buttonData, ExecuteEvents.pointerDownHandler);
                if (gameObject2 == null)
                {
                    gameObject2 = ExecuteEvents.GetEventHandler <IPointerClickHandler>(gameObject1);
                }
                float unscaledTime = Time.unscaledTime;
                if (gameObject2 == buttonData.lastPress)
                {
                    if (unscaledTime - buttonData.clickTime < 0.300000011920929)
                    {
                        ++buttonData.clickCount;
                    }
                    else
                    {
                        buttonData.clickCount = 1;
                    }
                    buttonData.clickTime = unscaledTime;
                }
                else
                {
                    buttonData.clickCount = 1;
                }
                buttonData.pointerPress    = gameObject2;
                buttonData.rawPointerPress = gameObject1;
                buttonData.clickTime       = unscaledTime;
                buttonData.pointerDrag     = ExecuteEvents.GetEventHandler <IDragHandler>(gameObject1);
                if (buttonData.pointerDrag != null)
                {
                    ExecuteEvents.Execute <IInitializePotentialDragHandler>(buttonData.pointerDrag, buttonData, ExecuteEvents.initializePotentialDrag);
                }
                m_InputPointerEvent = buttonData;
            }
            if (!data.ReleasedThisFrame())
            {
                return;
            }
            ExecuteEvents.Execute <IPointerUpHandler>(buttonData.pointerPress, buttonData, ExecuteEvents.pointerUpHandler);
            GameObject eventHandler = ExecuteEvents.GetEventHandler <IPointerClickHandler>(gameObject1);

            if (buttonData.pointerPress == eventHandler && buttonData.eligibleForClick)
            {
                ExecuteEvents.Execute <IPointerClickHandler>(buttonData.pointerPress, buttonData, ExecuteEvents.pointerClickHandler);
            }
            else if (buttonData.pointerDrag != null && buttonData.dragging)
            {
                ExecuteEvents.ExecuteHierarchy <IDropHandler>(gameObject1, buttonData, ExecuteEvents.dropHandler);
            }
            buttonData.eligibleForClick = false;
            buttonData.pointerPress     = null;
            buttonData.rawPointerPress  = null;
            if (buttonData.pointerDrag != null && buttonData.dragging)
            {
                ExecuteEvents.Execute <IEndDragHandler>(buttonData.pointerDrag, buttonData, ExecuteEvents.endDragHandler);
            }
            buttonData.dragging    = false;
            buttonData.pointerDrag = null;
            if (gameObject1 != buttonData.pointerEnter)
            {
                HandlePointerExitAndEnter(buttonData, null);
                HandlePointerExitAndEnter(buttonData, gameObject1);
            }
            m_InputPointerEvent = buttonData;
        }
Exemplo n.º 20
0
        /// <summary>
        /// Process the current mouse press.
        /// </summary>
        private void ProcessMousePress(MouseButtonEventData data)
        {
            var pointerEvent  = data.buttonData;
            var currentOverGo = pointerEvent.pointerCurrentRaycast.gameObject;

            // PointerDown notification
            if (data.PressedThisFrame())
            {
                pointerEvent.eligibleForClick    = true;
                pointerEvent.delta               = Vector2.zero;
                pointerEvent.dragging            = false;
                pointerEvent.useDragThreshold    = true;
                pointerEvent.pressPosition       = pointerEvent.position;
                pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast;

                DeselectIfSelectionChanged(currentOverGo, pointerEvent);

                // search for the control that will receive the press
                // if we can't find a press handler set the press
                // handler to be what would receive a click.
                var newPressed = ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.pointerDownHandler);

                // didnt find a press handler... search for a click handler
                if (newPressed == null)
                {
                    newPressed = ExecuteEvents.GetEventHandler <IPointerClickHandler>(currentOverGo);
                }

                // Debug.Log("Pressed: " + newPressed);

                float time = Time.unscaledTime;

                if (newPressed == pointerEvent.lastPress)
                {
                    var diffTime = time - pointerEvent.clickTime;
                    if (diffTime < 0.3f)
                    {
                        ++pointerEvent.clickCount;
                    }
                    else
                    {
                        pointerEvent.clickCount = 1;
                    }

                    pointerEvent.clickTime = time;
                }
                else
                {
                    pointerEvent.clickCount = 1;
                }

                pointerEvent.pointerPress    = newPressed;
                pointerEvent.rawPointerPress = currentOverGo;

                pointerEvent.clickTime = time;

                // Save the drag handler as well
                pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler <IDragHandler>(currentOverGo);

                if (pointerEvent.pointerDrag != null)
                {
                    ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag);
                }
            }

            // PointerUp notification
            if (data.ReleasedThisFrame())
            {
                // Debug.Log("Executing pressup on: " + pointer.pointerPress);
                ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler);

                // Debug.Log("KeyCode: " + pointer.eventData.keyCode);

                // see if we mouse up on the same element that we clicked on...
                var pointerUpHandler = ExecuteEvents.GetEventHandler <IPointerClickHandler>(currentOverGo);

                // PointerClick and Drop events
                if (pointerEvent.pointerPress == pointerUpHandler && pointerEvent.eligibleForClick)
                {
                    ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerClickHandler);
                }
                else if (pointerEvent.pointerDrag != null)
                {
                    ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.dropHandler);
                }

                pointerEvent.eligibleForClick = false;
                pointerEvent.pointerPress     = null;
                pointerEvent.rawPointerPress  = null;

                if (pointerEvent.pointerDrag != null && pointerEvent.dragging)
                {
                    ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.endDragHandler);
                }

                pointerEvent.dragging    = false;
                pointerEvent.pointerDrag = null;

                // redo pointer enter / exit to refresh state
                // so that if we moused over somethign that ignored it before
                // due to having pressed on something else
                // it now gets it.
                if (currentOverGo != pointerEvent.pointerEnter)
                {
                    HandlePointerExitAndEnter(pointerEvent, null);
                    HandlePointerExitAndEnter(pointerEvent, currentOverGo);
                }
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Process the current mouse press.
        /// </summary>
        protected new void ProcessMousePress(MouseButtonEventData data)
        {
            var pointerEvent  = data.buttonData;
            var currentOverGo = pointerEvent.pointerCurrentRaycast.gameObject;

            // PointerDown notification
            if (data.PressedThisFrame())
            {
                pointerEvent.eligibleForClick    = true;
                pointerEvent.delta               = Vector2.zero;
                pointerEvent.dragging            = false;
                pointerEvent.useDragThreshold    = true;
                pointerEvent.pressPosition       = pointerEvent.position;
                pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast;

                DeselectIfSelectionChanged(currentOverGo, pointerEvent);

                // search for the control that will receive the press
                // if we can't find a press handler set the press
                // handler to be what would receive a click.
                var newPressed = ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.pointerDownHandler);

                // didnt find a press handler... search for a click handler
                if (newPressed == null)
                {
                    newPressed = ExecuteEvents.GetEventHandler <IPointerClickHandler>(currentOverGo);
                }

                float time = Time.unscaledTime;

                if (newPressed == pointerEvent.lastPress)
                {
                    var diffTime = time - pointerEvent.clickTime;
                    if (diffTime < 0.3f)
                    {
                        ++pointerEvent.clickCount;
                    }
                    else
                    {
                        pointerEvent.clickCount = 1;
                    }

                    pointerEvent.clickTime = time;
                }
                else
                {
                    pointerEvent.clickCount = 1;
                }

                pointerEvent.pointerPress    = newPressed;
                pointerEvent.rawPointerPress = currentOverGo;

                pointerEvent.clickTime = time;

                // Save the drag handler as well
                var go = currentOverGo;
                while (go != null && pointerEvent.pointerDrag == null)
                {
                    go = pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler <IDragHandler>(go);

                    if (pointerEvent.pointerDrag != null)
                    {
                        // If it executes the initialice potential drag, but doesnt use it, we release it
                        if (ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, s_ConfirmWantsDragHandler) && !pointerEvent.used)
                        {
                            pointerEvent.pointerDrag = null;
                            go = go.transform.parent != null ? go.transform.parent.gameObject : null;
                        }
                        else
                        {
                            ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag);
                        }
                    }
                }
            }

            // PointerUp notification
            if (data.ReleasedThisFrame())
            {
                ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler);

                PointerClickAndDrop(pointerEvent);

                pointerEvent.eligibleForClick = false;
                pointerEvent.pointerPress     = null;
                pointerEvent.rawPointerPress  = null;

                if (pointerEvent.pointerDrag != null && pointerEvent.dragging)
                {
                    ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.endDragHandler);
                }

                pointerEvent.dragging    = false;
                pointerEvent.pointerDrag = null;

                // redo pointer enter / exit to refresh state
                // so that if we moused over somethign that ignored it before
                // due to having pressed on something else
                // it now gets it.
                if (currentOverGo != pointerEvent.pointerEnter)
                {
                    HandlePointerExitAndEnter(pointerEvent, null);
                    HandlePointerExitAndEnter(pointerEvent, currentOverGo);
                }
            }
        }