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 Tree buttons sometimes displaying incorrect tooltips #64771

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Mickeon
Copy link
Contributor

@Mickeon Mickeon commented Aug 23, 2022

While making #64733 , I noticed an oddity
Before

This happens because Tree's... TreeItem's... Cells... Buttons remain in the same position, regardless of h_scroll, but this has not been accounted for appropriately when fetching the tooltip, resulting in the tooltip only being displayed correctly if the horizontal scroll was all the way to the right.

This has been adjusted, but may require some extra testing because I do not understand the behaviour of Tree buttons & scrolling, should there be more than one column.
After

@KoBeWi
Copy link
Member

KoBeWi commented Dec 12, 2022

Needs rebase.

@Mickeon
Copy link
Contributor Author

Mickeon commented Dec 15, 2022

Rebased.

Comment on lines 5053 to 5055
if (h_scroll->is_visible_in_tree()) {
pos.x += h_scroll->get_value();
//pos.x += h_scroll->get_value();
}
Copy link
Member

Choose a reason for hiding this comment

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

This should be removed if does nothing.

@@ -5062,25 +5062,24 @@ String Tree::get_tooltip(const Point2 &p_pos) const {

if (it) {
const TreeItem::Cell &c = it->cells[col];
int col_width = get_column_width(col);
int col_width = get_size().width - theme_cache.panel_style->get_minimum_size().width - (h_scroll->is_visible_in_tree() ? h_scroll->get_minimum_size().width : 0);
Copy link
Member

Choose a reason for hiding this comment

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

You could change it into conditional code like the one above, for better clarity.

@akien-mga akien-mga modified the milestones: 4.0, 4.x Feb 16, 2023
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

4 participants