From 181fdce1e9c0b31f3a4ff14e25b2e0fec7108da0 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 6 Sep 2016 19:55:22 -0300 Subject: Better snapping for graph ports, closes #6394 --- scene/gui/graph_edit.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 8b03dbbc2d..0de6add8cb 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -360,7 +360,8 @@ bool GraphEdit::_filter_input(const Point2& p_point) { Ref port =get_icon("port","GraphNode"); - float grab_r=port->get_width()*0.5; + float grab_r_extend = 2.0; + float grab_r=port->get_width()*0.5*grab_r_extend; for(int i=get_child_count()-1;i>=0;i--) { GraphNode *gn=get_child(i)->cast_to(); @@ -379,8 +380,9 @@ bool GraphEdit::_filter_input(const Point2& p_point) { for(int j=0;jget_connection_input_count();j++) { Vector2 pos = gn->get_connection_input_pos(j)+gn->get_pos(); - if (pos.distance_to(p_point) port =get_icon("port","GraphNode"); Vector2 mpos(p_ev.mouse_button.x,p_ev.mouse_button.y); - float grab_r=port->get_width()*0.5; + float grab_r=port->get_width()*0.5*grab_r_extend; for(int i=get_child_count()-1;i>=0;i--) { GraphNode *gn=get_child(i)->cast_to(); @@ -517,7 +521,7 @@ void GraphEdit::_top_layer_input(const InputEvent& p_ev) { Ref port =get_icon("port","GraphNode"); Vector2 mpos(p_ev.mouse_button.x,p_ev.mouse_button.y); - float grab_r=port->get_width()*0.5; + float grab_r=port->get_width()*0.5*grab_r_extend; for(int i=get_child_count()-1;i>=0;i--) { GraphNode *gn=get_child(i)->cast_to(); -- cgit v1.2.3