mirror of https://github.com/godotengine/godot
Merge pull request #114760 from YeldhamDev/tree_range_popup_fix
Fix problems with popup menus for `Tree`'s range items
This commit is contained in:
commit
6b93d6472e
|
|
@ -3253,7 +3253,16 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int
|
|||
if (!c.text.is_empty()) {
|
||||
_update_popup_menu(c);
|
||||
popup_menu->set_size(Size2(col_width, 0));
|
||||
popup_menu->set_position(get_screen_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h) - theme_cache.offset);
|
||||
|
||||
int pos_x = 0;
|
||||
Point2 panel_ofs = theme_cache.panel_style->get_offset();
|
||||
if (is_layout_rtl()) {
|
||||
pos_x = get_size().width - col_ofs - panel_ofs.x - popup_menu->get_size().width;
|
||||
} else {
|
||||
pos_x = col_ofs + panel_ofs.x;
|
||||
}
|
||||
popup_menu->set_position(get_screen_position() + Point2i(pos_x, _get_title_button_height() + y_ofs + item_h + panel_ofs.y) - theme_cache.offset);
|
||||
|
||||
popup_menu->popup();
|
||||
popup_edited_item = p_item;
|
||||
popup_edited_item_col = col;
|
||||
|
|
@ -3503,6 +3512,7 @@ void Tree::value_editor_changed(double p_value) {
|
|||
void Tree::_update_popup_menu(const TreeItem::Cell &p_cell) {
|
||||
if (popup_menu == nullptr) {
|
||||
popup_menu = memnew(PopupMenu);
|
||||
popup_menu->set_shrink_width(false);
|
||||
popup_menu->hide();
|
||||
add_child(popup_menu, false, INTERNAL_MODE_FRONT);
|
||||
popup_menu->connect(SceneStringName(id_pressed), callable_mp(this, &Tree::popup_select));
|
||||
|
|
|
|||
Loading…
Reference in New Issue