mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Queue hover update when creating TreeItem
This commit is contained in:
parent
215acd52e8
commit
ac2179c546
2 changed files with 13 additions and 3 deletions
|
@ -4126,6 +4126,8 @@ void Tree::gui_input(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
|
||||
void Tree::_determine_hovered_item() {
|
||||
hovered_update_queued = false;
|
||||
|
||||
Ref<StyleBox> bg = theme_cache.panel_style;
|
||||
bool rtl = is_layout_rtl();
|
||||
|
||||
|
@ -4213,6 +4215,14 @@ void Tree::_determine_hovered_item() {
|
|||
}
|
||||
}
|
||||
|
||||
void Tree::_queue_update_hovered_item() {
|
||||
if (hovered_update_queued) {
|
||||
return;
|
||||
}
|
||||
hovered_update_queued = true;
|
||||
callable_mp(this, &Tree::_determine_hovered_item).call_deferred();
|
||||
}
|
||||
|
||||
bool Tree::edit_selected(bool p_force_edit) {
|
||||
TreeItem *s = get_selected();
|
||||
ERR_FAIL_NULL_V_MSG(s, false, "No item selected.");
|
||||
|
@ -5046,9 +5056,7 @@ TreeItem *Tree::create_item(TreeItem *p_parent, int p_index) {
|
|||
ti = create_item(root, p_index);
|
||||
}
|
||||
}
|
||||
|
||||
_determine_hovered_item();
|
||||
|
||||
_queue_update_hovered_item();
|
||||
queue_accessibility_update();
|
||||
return ti;
|
||||
}
|
||||
|
|
|
@ -733,7 +733,9 @@ private:
|
|||
|
||||
bool enable_auto_tooltip = true;
|
||||
|
||||
bool hovered_update_queued = false;
|
||||
void _determine_hovered_item();
|
||||
void _queue_update_hovered_item();
|
||||
|
||||
int _count_selected_items(TreeItem *p_from) const;
|
||||
bool _is_branch_selected(TreeItem *p_from) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue