Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Node selection when navigating Tree with Arrow keys #86218

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

TheSofox
Copy link
Contributor

Fixes #12544

Arrow keys change actual selection (not just cursor) when navigating Tree and SceneTreeDock.

@TheSofox TheSofox requested a review from a team as a code owner December 15, 2023 23:16
@TheSofox TheSofox changed the title Fixes Node selection when navigating Tree with Arrow keys Fixes Node selection when navigating Tree with Arrow keys Dec 15, 2023
@AThousandShips AThousandShips changed the title Fixes Node selection when navigating Tree with Arrow keys Fix Node selection when navigating Tree with Arrow keys Dec 16, 2023
@AThousandShips AThousandShips added this to the 4.3 milestone Dec 16, 2023
@TheSofox TheSofox force-pushed the arrow-key-scene-tree-nav branch from 560696c to f894eb1 Compare December 16, 2023 19:53
Copy link
Member

@KoBeWi KoBeWi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

select_single_item() looks more expensive than what was done previously, but I tested with a very big scene and it's not noticeable.

Also using that method might change what signals are emitted in different selection modes, but this could be desirable (and maybe fix other existing issues).

@YuriSizov YuriSizov merged commit b863515 into godotengine:master Dec 20, 2023
@YuriSizov
Copy link
Contributor

Thanks!

selected_item = prev;
emit_signal(SNAME("cell_selected"));

select_single_item(prev, get_root(), selected_col);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is select_single_item used for SELECT_MULTI?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arrow key overrides it. It's exactly what happens in other systems, such as in Windows file explorer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you take a look at #92959? The code currently crashes, and when I fixed the crash, @KoBeWi reported incorrect behavior, that it selects items which are not visible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arrow keys doesn't select objects on the scene hierarchy
5 participants