Merge pull request #70902 from Cretezy/2d-polygon-indices-visibility

Fix "2D Polygon indices are barely visible on bright background" (#38009)
This commit is contained in:
Rémi Verschelde 2023-01-07 13:19:33 +01:00
commit 329b85152a
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 11 additions and 7 deletions

View file

@ -569,11 +569,15 @@ void AbstractPolygon2DEditor::forward_canvas_draw_over_viewport(Control *p_overl
p_overlay->draw_texture(handle, point - handle->get_size() * 0.5, overlay_modulate);
if (vertex == hover_point) {
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
Ref<Font> font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
int font_size = 1.3 * get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"));
String num = String::num(vertex.vertex);
Size2 num_size = font->get_string_size(num, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size);
p_overlay->draw_string(font, point - num_size * 0.5, num, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1.0, 1.0, 1.0, 0.5));
const float outline_size = 4;
Color font_color = get_theme_color(SNAME("font_color"), SNAME("Editor"));
Color outline_color = font_color.inverted();
p_overlay->draw_string_outline(font, point - num_size * 0.5, num, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, outline_size, outline_color);
p_overlay->draw_string(font, point - num_size * 0.5, num, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
}
}
}