Highlight hovered GraphEdit connection by widening the line

This change causes the connections to be additionally highlighted by
widening the line with a configurable factor.
This commit is contained in:
Markus Sauermann
2024-12-08 13:22:00 +01:00
parent 4364ed6ccd
commit 0a875ab3bb
5 changed files with 11 additions and 0 deletions

View File

@ -1453,6 +1453,10 @@ void GraphEdit::_update_connections() {
Ref<Gradient> line_gradient = memnew(Gradient);
float line_width = _get_shader_line_width();
if (conn == hovered_connection) {
line_width *= 1.0f + (theme_cache.connection_hover_thickness / 100.0f);
}
conn->_cache.line->set_width(line_width);
line_gradient->set_color(0, from_color);
line_gradient->set_color(1, to_color);
@ -2842,6 +2846,7 @@ void GraphEdit::_bind_methods() {
BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_COLOR, GraphEdit, activity_color, "activity");
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, GraphEdit, connection_hover_tint_color);
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, GraphEdit, connection_hover_thickness);
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, GraphEdit, connection_valid_target_tint_color);
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, GraphEdit, connection_rim_color);
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, GraphEdit, selection_fill);