Fix GraphEdit connection wire when zoom in/out
This commit is contained in:
parent
12843167ca
commit
6227e38ec6
1 changed files with 6 additions and 5 deletions
|
@ -151,7 +151,7 @@ void GraphEdit::_update_scroll_offset() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
connections_layer->set_pos(-Point2(h_scroll->get_val(),v_scroll->get_val())*zoom);
|
connections_layer->set_pos(-Point2(h_scroll->get_val(),v_scroll->get_val()));
|
||||||
set_block_minimum_size_adjust(false);
|
set_block_minimum_size_adjust(false);
|
||||||
awaiting_scroll_offset_update=false;
|
awaiting_scroll_offset_update=false;
|
||||||
|
|
||||||
|
@ -650,8 +650,8 @@ void GraphEdit::_draw_cos_line(CanvasItem* p_where,const Vector2& p_from, const
|
||||||
cp_offset=MAX(MIN(cp_len-diff,cp_neg_len),-diff*0.5);
|
cp_offset=MAX(MIN(cp_len-diff,cp_neg_len),-diff*0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2 c1 = Vector2(cp_offset,0);
|
Vector2 c1 = Vector2(cp_offset*zoom,0);
|
||||||
Vector2 c2 = Vector2(-cp_offset,0);
|
Vector2 c2 = Vector2(-cp_offset*zoom,0);
|
||||||
|
|
||||||
int lines=0;
|
int lines=0;
|
||||||
_bake_segment2d(p_where,0,1,p_from,c1,p_to,c2,0,3,9,8,p_color,p_to_color,lines);
|
_bake_segment2d(p_where,0,1,p_from,c1,p_to,c2,0,3,9,8,p_color,p_to_color,lines);
|
||||||
|
@ -726,9 +726,9 @@ void GraphEdit::_connections_layer_draw() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2 frompos=gfrom->get_connection_output_pos(E->get().from_port)+gfrom->get_offset();
|
Vector2 frompos=gfrom->get_connection_output_pos(E->get().from_port)+gfrom->get_offset()*zoom;
|
||||||
Color color = gfrom->get_connection_output_color(E->get().from_port);
|
Color color = gfrom->get_connection_output_color(E->get().from_port);
|
||||||
Vector2 topos=gto->get_connection_input_pos(E->get().to_port)+gto->get_offset();
|
Vector2 topos=gto->get_connection_input_pos(E->get().to_port)+gto->get_offset()*zoom;
|
||||||
Color tocolor = gto->get_connection_input_color(E->get().to_port);
|
Color tocolor = gto->get_connection_input_color(E->get().to_port);
|
||||||
_draw_cos_line(connections_layer,frompos,topos,color,tocolor);
|
_draw_cos_line(connections_layer,frompos,topos,color,tocolor);
|
||||||
|
|
||||||
|
@ -1052,6 +1052,7 @@ void GraphEdit::set_zoom(float p_zoom) {
|
||||||
top_layer->update();
|
top_layer->update();
|
||||||
|
|
||||||
_update_scroll();
|
_update_scroll();
|
||||||
|
connections_layer->update();
|
||||||
|
|
||||||
if (is_visible()) {
|
if (is_visible()) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue