Orama-Interactive / Pixelorama

Unleash your creativity with Pixelorama, a powerful and accessible open-source pixel art multitool. Whether you want to create sprites, tiles, animations, or just express yourself in the language of pixel art, this software will realize your pixel-perfect dreams with a vast toolbox of features. Available on Windows, Linux, macOS and the Web!
https://orama-interactive.itch.io/pixelorama
MIT License
7.26k stars 390 forks source link

Fix cursor blinking at the edge of canvas #1075

Closed Hamster5295 closed 3 months ago

Hamster5295 commented 3 months ago

What's Wrong?

The cursor would blink at the edge of the painting canvas node at v1.0.1, switching between the state of CROSS and ARROW.

What's the Cause?

The bug is caused by the additional InputEventMouseMotion triggered when calling Input.set_default_cursor_shape(CursorShape) in the function _on_ViewportContainer_mouse_entered() and _on_ViewportContainer_mouse_exited() of the script res://src/UI/ViewportContainer.gd, which leads to both of the functions being called infinitely, changing the cursor shape here and there.

What does this PR do?

This PR substitudes the signals connected to _on_ViewportContainer_mouse_entered() and _on_ViewportContainer_mouse_exited() for the _input(event) callback, in a bid to handle the extra event manually, which fixs the situation mentioned above.

Is it a Stable Bugfix?

The bugfix has been tested on the DockableContainer/Main Canvas/ViewportandVerticalRuler/SubViewportContainer Node, which is the canvas for painting, and seems to work Fine.
However, since I'm not clear about the usage of DockableContainer/Second Canvas, the node which has also attached the script, so Further Testing is Required

OverloadedOrama commented 3 months ago

Unfortunately I had to revert this change because it caused a bug where you couldn't rename layers anymore. Upon further testing the camera's process input is never set to false again, as it should be when the mouse is outside of the canvas, but even when I added a line that does that, it still seemed to cause weird behavior. We need to find another fix for the issue.

Hamster5295 commented 3 months ago

To be honest I can't replicate the bug

That's kinda strange. Note that the blinking might appear to be the cross and the tool icons "getting dimmer" when the cursor is at the edge of the canvas due to visual persistence.
In my case it behaves like this:
1

I'll try to figure out whether it's caused by platform-specific issues.

Unfortunately I had to revert this change because it caused a bug where you couldn't rename layers anymore.

Get it. Sorry for the inconvenience! 😥

Variable-ind commented 3 months ago

To be honest I can't replicate the bug

That's kinda strange. Note that the blinking might appear to be the cross and the tool icons "getting dimmer" when the cursor is at the edge of the canvas due to visual persistence. In my case it behaves like this: 1 1

I'll try to figure out whether it's caused by platform-specific issues.

Unfortunately I had to revert this change because it caused a bug where you couldn't rename layers anymore.

Get it. Sorry for the inconvenience! 😥

Hy I've noticed this bug on Linux as well, it's especially apparent when the ui scale is not 1 and occurs whenever you cross the boundary between 2 panels

https://github.com/user-attachments/assets/b3f94452-0774-4485-84e6-594197a7e458