Pointer events position is different from Input.mousePosition

Hello

I’m trying to do the following: while dragging a UI element, underneath it a market follows in the 3D game world. All I need to do is to get the position from PointerMoveEvent and use it for ray casting via game world camera.

The problem is I don’t know how to do that with evt.position. If I replace it with Input.mousePosition (from legacy input system) then everything works perfectly. But I need it to work with touch input.

What space pointer events are positioned in? How do I adjust it to screen space so I could call camera.
ScreenPointToRay() ?

I managed to make thing work on the device and almost work on device simulator in Editor, by switching back to legacy input system. However, pointer events coordinates in Editor’s device simulator are different (scaled) from the real device.

I don’t know whether the bug lies in UI Toolkit or Device Simulator code.