On_input: position is inaccurate until mouse movement (Issue-4556) (SOLVED)

Hello,

As I was developing a simple virtual stick widget, I noticed that sometimes when just starting up the app, the position would be wrong. After trying to zero in on the issue, I found that the values in action.x, action.y, action.screen_x and action.screen_y do not update until mouse movement occurs. This means that if the cursor starts within the window of the app and then mouse down occurs (without moving the cursor first), the position reported via on_input is inaccurate. In my case, it is consistently inaccurate, I suspect somehow related to my window dimensions (screen_x = 4, screen_y = 751).

I’m running via the default target on Mac OS. Not sure whether this would be an issue for other platforms.

Doesn’t appear to be an issue on iOS simulator - presumably bcz there’s no such thing as a cursor or mouse move :slight_smile:

Thanks. Created Issue-4556. This will likely get fixed in the next version.

1 Like

Solved in 1.2.164

Sorry to revive this old thread, but this happens to me too on my mini m1, but only with action.y and action.screen_y. When the app starts, these positions are off.
In the screenshot below, the mouse is almost in the top left corner of the window (960x540 in this example) - as if the origin is flipped. The y positions stay wrong on mouse down (when mouse hasn’t moved yet) and are only correct once the mouse moves:

Screenshot 2022-11-07 at 09.17.49

I tried on Windows and Linux as well, the positions are correct there.
Another difference I noticed: On the mini m1, the positions continue to be printed out when the mouse is moved outside the window.

1 Like