mirror of https://github.com/godotengine/godot
Merge pull request #100456 from Sauermann/proposal-hovered-connection-highlight
Highlight hovered `GraphEdit` connection by widening the line
This commit is contained in:
commit
075567a5b3
|
|
@ -551,6 +551,9 @@
|
|||
<theme_item name="selection_stroke" data_type="color" type="Color" default="Color(1, 1, 1, 0.8)">
|
||||
The outline color of the selection rectangle.
|
||||
</theme_item>
|
||||
<theme_item name="connection_hover_thickness" data_type="constant" type="int" default="0">
|
||||
Widen the line of the connection when the mouse is hovering over it by a percentage factor. A value of [code]0[/code] disables the highlight. A value of [code]100[/code] doubles the line width.
|
||||
</theme_item>
|
||||
<theme_item name="port_hotzone_inner_extent" data_type="constant" type="int" default="22">
|
||||
The horizontal range within which a port can be grabbed (inner side).
|
||||
</theme_item>
|
||||
|
|
|
|||
|
|
@ -1563,6 +1563,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
|
|||
p_theme->set_color("activity", "GraphEdit", p_config.dark_theme ? Color(1, 1, 1) : Color(0, 0, 0));
|
||||
|
||||
p_theme->set_color("connection_hover_tint_color", "GraphEdit", p_config.dark_theme ? Color(0, 0, 0, 0.3) : Color(1, 1, 1, 0.3));
|
||||
p_theme->set_constant("connection_hover_thickness", "GraphEdit", 0);
|
||||
p_theme->set_color("connection_valid_target_tint_color", "GraphEdit", p_config.dark_theme ? Color(1, 1, 1, 0.4) : Color(0, 0, 0, 0.4));
|
||||
p_theme->set_color("connection_rim_color", "GraphEdit", p_config.tree_panel_style->get_bg_color());
|
||||
|
||||
|
|
|
|||
|
|
@ -1457,6 +1457,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);
|
||||
|
|
@ -2846,6 +2850,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);
|
||||
|
|
|
|||
|
|
@ -275,6 +275,7 @@ private:
|
|||
|
||||
Color activity_color;
|
||||
Color connection_hover_tint_color;
|
||||
int connection_hover_thickness;
|
||||
Color connection_valid_target_tint_color;
|
||||
Color connection_rim_color;
|
||||
|
||||
|
|
|
|||
|
|
@ -1257,6 +1257,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
|
|||
theme->set_color("selection_stroke", "GraphEdit", Color(1, 1, 1, 0.8));
|
||||
theme->set_color("activity", "GraphEdit", Color(1, 1, 1));
|
||||
theme->set_color("connection_hover_tint_color", "GraphEdit", Color(0, 0, 0, 0.3));
|
||||
theme->set_constant("connection_hover_thickness", "GraphEdit", 0);
|
||||
theme->set_color("connection_valid_target_tint_color", "GraphEdit", Color(1, 1, 1, 0.4));
|
||||
theme->set_color("connection_rim_color", "GraphEdit", style_normal_color);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue