Fix scrolling to bottom panel selected button.
Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com>
This commit is contained in:
@ -100,6 +100,15 @@ void EditorBottomPanel::_update_disabled_buttons() {
|
|||||||
right_button->set_disabled(h_scroll->get_value() + h_scroll->get_page() == h_scroll->get_max());
|
right_button->set_disabled(h_scroll->get_value() + h_scroll->get_page() == h_scroll->get_max());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditorBottomPanel::_ensure_control_visible(ObjectID p_id) {
|
||||||
|
Control *c = ObjectDB::get_instance<Control>(p_id);
|
||||||
|
if (!c) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
button_scroll->ensure_control_visible(c);
|
||||||
|
}
|
||||||
|
|
||||||
void EditorBottomPanel::_switch_to_item(bool p_visible, int p_idx, bool p_ignore_lock) {
|
void EditorBottomPanel::_switch_to_item(bool p_visible, int p_idx, bool p_ignore_lock) {
|
||||||
ERR_FAIL_INDEX(p_idx, items.size());
|
ERR_FAIL_INDEX(p_idx, items.size());
|
||||||
|
|
||||||
@ -134,7 +143,7 @@ void EditorBottomPanel::_switch_to_item(bool p_visible, int p_idx, bool p_ignore
|
|||||||
if (expand_button->is_pressed()) {
|
if (expand_button->is_pressed()) {
|
||||||
EditorNode::get_top_split()->hide();
|
EditorNode::get_top_split()->hide();
|
||||||
}
|
}
|
||||||
callable_mp(button_scroll, &ScrollContainer::ensure_control_visible).call_deferred(items[p_idx].button);
|
callable_mp(this, &EditorBottomPanel::_ensure_control_visible).call_deferred(items[p_idx].button->get_instance_id());
|
||||||
} else {
|
} else {
|
||||||
add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("BottomPanel"), EditorStringName(EditorStyles)));
|
add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("BottomPanel"), EditorStringName(EditorStyles)));
|
||||||
items[p_idx].button->set_pressed_no_signal(false);
|
items[p_idx].button->set_pressed_no_signal(false);
|
||||||
|
|||||||
@ -69,6 +69,7 @@ class EditorBottomPanel : public PanelContainer {
|
|||||||
void _scroll(bool p_right);
|
void _scroll(bool p_right);
|
||||||
void _update_scroll_buttons();
|
void _update_scroll_buttons();
|
||||||
void _update_disabled_buttons();
|
void _update_disabled_buttons();
|
||||||
|
void _ensure_control_visible(ObjectID p_id);
|
||||||
|
|
||||||
bool _button_drag_hover(const Vector2 &, const Variant &, Button *p_button, Control *p_control);
|
bool _button_drag_hover(const Vector2 &, const Variant &, Button *p_button, Control *p_control);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user