Unity Ui EventSystem.current.RaycastAll(); not working on touchscreen (new input system)

I am using the new input system, and my UI has the OnScreenStick component. FIrst off I’d like to mention that OnStrickScreen Was not working with PlayerInput, so I had to replace that with a script.

In the game, I get the mouse position, or touch position on from the touchscreen, and I pass that to my tank object, so that the tank can turn its turret in the dirrection of the touch.

When the touch/mouse postion is over any ui element tagged “UIClick” the method should return out and not pass the postion to the tank. It functions perfectly whening using the mouse, however, the problem is, when the touch is over the UI, the method does not return out when it is just touched down, and the current mouse position gets passed to the tank, it does not detect any ui element tagged “UIClick” under it. Unless I move/drag the touch, then it does return, but it is already too late by this point. The position of the touch still displays correctly in Debug logs (where the UI is) on the first touch. But EventSystem.current.RaycastAll(); does not return any UI tagged “UIClick” until I drag my fingred over. This results with the tank turning it’s turret on the initial touch of the finger on the ui.

When using the touch screen, OnMouseMoved(InputAction.CallbackContext ctx) gets called for touch0 and touch1 position and start position. It is also assigned to the performed and started delegates of the event.
Here is the code:

    public void OnMouseMoved(InputAction.CallbackContext ctx)
    {
        if (EventSystem.current.IsPointerOverGameObject())
        {
            PointerEventData eventDataCurrentPosition = new PointerEventData(EventSystem.current);
            eventDataCurrentPosition.position = ctx.ReadValue<Vector2>();
            List<RaycastResult> results = new List<RaycastResult>();
            EventSystem.current.RaycastAll(eventDataCurrentPosition, results);
            foreach (RaycastResult result in results)
            {
                if (result.gameObject.CompareTag("UIClick"))
                {
                    Debug.Log("<color=red>GunInputScript:</color> OnMouseMoved: mouse/touch over 
                    UIClick (**OVER UI**), returning!!!");
                    _isPointerOverUI = true;
                    return;
                }
            }
        }
        _mousePos = ctx.ReadValue<Vector2>();
        Debug.Log("<color=#AB1BE8>GunInputScript:</color> OnMouseMoved: CURRENT mouse/touch 
        (**NOT OVER UI**) pos at: " + _mousePos);
        _isPointerOverUI = false;
    }

Does anyone know how to get check if the touch is over the UI correctly?

You need the TouchId for EventSystem.current.IsPointerOverGameObject()