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 cursor behavior for multiselect in Tree while holding CTRL #71024

Conversation

marzecdawid
Copy link
Contributor

It fixes cursor behaviour for selecting multiple items in Tree while holding CTRL button.
Before:

2023-01-07.13-43-32.mp4

After:

2023-01-07.13-45-51.mp4

The fix in scene/gui/tree.cpp exposed a problem in editor/scene_tree_editor.cpp as every node in the list was selected/deselected each time there was any selection change:

2023-01-07.14-00-48.mp4

So in editor/scene_tree_editor.cpp I fixed it to behave the same as before:

2023-01-07.14-05-38.mp4

I think the _update_selection in scene_tree_editor.cpp should be redesigned to be more dependent on the selection from a Tree, not the opposite way. Or Space button shouldn't be for rename where there is F2 for that, but it is a topic for separete proposal :)

@marzecdawid marzecdawid requested a review from a team as a code owner January 7, 2023 13:15
}

} else {
if (c.selectable) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This section is only a small code readability improvement.

@KoBeWi KoBeWi added this to the 4.0 milestone Jan 7, 2023
@akien-mga akien-mga modified the milestones: 4.0, 4.1 Feb 17, 2023
@marzecdawid marzecdawid force-pushed the better-cursor-behaviour-in-tree-with-ctrl branch from aa5d550 to 9217be2 Compare May 23, 2023 21:27
scene/gui/tree.cpp Outdated Show resolved Hide resolved
@marzecdawid marzecdawid force-pushed the better-cursor-behaviour-in-tree-with-ctrl branch from 9217be2 to 9abbdea Compare June 21, 2023 18:45
@akien-mga akien-mga modified the milestones: 4.1, 4.2 Jun 21, 2023
@YuriSizov YuriSizov added the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Jul 7, 2023
@akien-mga akien-mga changed the title Fix cursor behaviour for multiselect in Tree while holding CTRL Fix cursor behavior for multiselect in Tree while holding CTRL Jul 8, 2023
@akien-mga akien-mga merged commit a12d9df into godotengine:master Jul 8, 2023
13 checks passed
@akien-mga
Copy link
Member

Thanks!

@YuriSizov
Copy link
Contributor

Cherry-picked for 4.1.1.

@YuriSizov YuriSizov removed the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Jul 10, 2023
@lufog
Copy link
Contributor

lufog commented Sep 20, 2023

I believe I have found a regression possibly caused by this PR.

2023-09-20.17-53-21.mp4

Comment on lines +4410 to +4411
selected_item = p_item;
selected_col = p_column;
Copy link
Contributor

@lufog lufog Sep 20, 2023

Choose a reason for hiding this comment

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

If change this to:

selected_item = nullptr;
selected_col = -1;

This will fix the problem, but the frame of the deselected element

image

will break.

@KoBeWi
Copy link
Member

KoBeWi commented Sep 20, 2023

Please open a new issue.

@lufog
Copy link
Contributor

lufog commented Sep 20, 2023

Done #81988

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.

None yet

5 participants