godot
godot copied to clipboard
Add option to force `_can_drop_data()` call
Before
Cursor drag-drop state updates only if the mouse is moving
https://github.com/godotengine/godot/assets/38570835/410887d4-9097-43be-8345-406ced028c79
After
I fixed this by adding a new method force_can_drop_data_check() that will force the check to re-update the cursor state.
In this example I made a new script and called get_viewport().force_can_drop_data_check() whenever the state of the panel changes.
This is useful if you have custom logic dependent on whether the element can be dropped or not. This previously ran only if you are moving the mouse now you can force the check and keep the mouse still.
NOTE: As you can see the cursor is not moving at all.
https://github.com/godotengine/godot/assets/38570835/a0675575-d25b-458c-8d26-38bf276ee852
I think at least this should be done by Godot instead of asking users to call this method after dropping.
I think at least this should be done by Godot instead of asking users to call this method after dropping.
This is not called after dropping, this just makes the can_drop_data to be called again with the last drag information
Actually you can just use get_viewport().update_mouse_cursor_state() to update the mouse cursor.
Closing because there is already a function that does all the required operations