Merge pull request #6705 from volzhs/graphedit
Fix GraphEdit grab random node when delete or deselect by clicking empty space
This commit is contained in:
commit
369865f01a
2 changed files with 7 additions and 4 deletions
|
@ -912,18 +912,20 @@ void GraphEdit::_input_event(const InputEvent& p_ev) {
|
||||||
if (b.button_index==BUTTON_LEFT && b.pressed) {
|
if (b.button_index==BUTTON_LEFT && b.pressed) {
|
||||||
|
|
||||||
GraphNode *gn = NULL;
|
GraphNode *gn = NULL;
|
||||||
|
GraphNode *gn_selected = NULL;
|
||||||
for(int i=get_child_count()-1;i>=0;i--) {
|
for(int i=get_child_count()-1;i>=0;i--) {
|
||||||
|
|
||||||
gn=get_child(i)->cast_to<GraphNode>();
|
gn_selected=get_child(i)->cast_to<GraphNode>();
|
||||||
|
|
||||||
if (gn) {
|
if (gn_selected) {
|
||||||
|
|
||||||
if (gn->is_resizing())
|
if (gn_selected->is_resizing())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Rect2 r = gn->get_rect();
|
Rect2 r = gn_selected->get_rect();
|
||||||
r.size*=zoom;
|
r.size*=zoom;
|
||||||
if (r.has_point(get_local_mouse_pos()))
|
if (r.has_point(get_local_mouse_pos()))
|
||||||
|
gn = gn_selected;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -788,4 +788,5 @@ GraphNode::GraphNode() {
|
||||||
comment=false;
|
comment=false;
|
||||||
resizeable=false;
|
resizeable=false;
|
||||||
resizing=false;
|
resizing=false;
|
||||||
|
selected=false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue