summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-08-29 19:04:49 +0200
committerGitHub <noreply@github.com>2016-08-29 19:04:49 +0200
commit01d5163b6f2ed58293288ae1c60dffc820699829 (patch)
tree651892988a7b5e70932b952ab8041976b2f47704
parente51d59ed986374f32b08c57698fb73790b5e5b1d (diff)
parentff22db3b21d2f6c93cdb1e972b2da217573f1ddc (diff)
Merge pull request #6220 from volzhs/issue-5789
Make LineEdit not to cover whole line when rename node
-rw-r--r--scene/gui/tree.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 4a9c09d187..c5beadb750 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1072,11 +1072,21 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2&
if (p_item->cells[i].selected && select_mode!=SELECT_ROW) {
Rect2i r(item_rect.pos,item_rect.size);
+ if (p_item->cells[i].text.size() > 0){
+ float icon_width = p_item->cells[i].get_icon_size().width;
+ r.pos.x += icon_width;
+ r.size.x -= icon_width;
+ }
//r.grow(cache.selected->get_margin(MARGIN_LEFT));
- if (has_focus())
+ if (has_focus()){
cache.selected_focus->draw(ci,r );
- else
+ p_item->set_meta("__focus_rect", Rect2(r.pos,r.size));
+ } else {
cache.selected->draw(ci,r );
+ }
+ if (text_editor->is_visible()){
+ text_editor->set_pos(get_global_pos() + r.pos);
+ }
}
if (p_item->cells[i].custom_bg_color) {
@@ -2481,16 +2491,7 @@ bool Tree::edit_selected() {
if (!s->cells[col].editable)
return false;
- Rect2 rect;
- rect.pos.y = get_item_offset(s) - get_scroll().y;
-
- for(int i=0;i<col;i++) {
-
- rect.pos.x+=get_column_width(i);
- }
-
- rect.size.width=get_column_width(col);
- rect.size.height=compute_item_height(s)+cache.vseparation;
+ Rect2 rect = s->get_meta("__focus_rect");
popup_edited_item=s;
popup_edited_item_col=col;