summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorvolzhs <volzhs@gmail.com>2016-10-05 01:10:49 +0900
committervolzhs <volzhs@gmail.com>2016-10-05 01:10:49 +0900
commit83278a1ac41b5595e3d96f74ad0c2ce73d41835e (patch)
treea58dacff97eb1e40eeadb00998335e961708b513 /scene/gui
parent78d97b060a6873a454e710380cb9ef1bde5e4c65 (diff)
Fix GraphEdit grab random node when delete or deselect by clicking empty space
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/graph_edit.cpp10
-rw-r--r--scene/gui/graph_node.cpp1
2 files changed, 7 insertions, 4 deletions
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 0de6add8cb..4eecabd10c 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -912,18 +912,20 @@ void GraphEdit::_input_event(const InputEvent& p_ev) {
if (b.button_index==BUTTON_LEFT && b.pressed) {
GraphNode *gn = NULL;
+ GraphNode *gn_selected = NULL;
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;
- Rect2 r = gn->get_rect();
+ Rect2 r = gn_selected->get_rect();
r.size*=zoom;
if (r.has_point(get_local_mouse_pos()))
+ gn = gn_selected;
break;
}
}
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index da298a795a..38e2e06ac5 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -788,4 +788,5 @@ GraphNode::GraphNode() {
comment=false;
resizeable=false;
resizing=false;
+ selected=false;
}