Fix "2D Polygon indices are barely visible on bright background" (#38009)
Co-authored-by: Ethan <epruhl102@gmail.com>
This commit is contained in:
parent
0160fea1ce
commit
68b728950a
2 changed files with 11 additions and 7 deletions
|
@ -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);
|
p_overlay->draw_texture(handle, point - handle->get_size() * 0.5, overlay_modulate);
|
||||||
|
|
||||||
if (vertex == hover_point) {
|
if (vertex == hover_point) {
|
||||||
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
|
Ref<Font> font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
|
||||||
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
|
int font_size = 1.3 * get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"));
|
||||||
String num = String::num(vertex.vertex);
|
String num = String::num(vertex.vertex);
|
||||||
Size2 num_size = font->get_string_size(num, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2750,7 +2750,7 @@ void CanvasItemEditor::_draw_guides() {
|
||||||
if (drag_type == DRAG_DOUBLE_GUIDE || drag_type == DRAG_V_GUIDE) {
|
if (drag_type == DRAG_DOUBLE_GUIDE || drag_type == DRAG_V_GUIDE) {
|
||||||
String str = TS->format_number(vformat("%d px", Math::round(xform.affine_inverse().xform(dragged_guide_pos).x)));
|
String str = TS->format_number(vformat("%d px", Math::round(xform.affine_inverse().xform(dragged_guide_pos).x)));
|
||||||
Ref<Font> font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
|
Ref<Font> font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
|
||||||
int font_size = get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"));
|
int font_size = 1.3 * get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"));
|
||||||
Size2 text_size = font->get_string_size(str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size);
|
Size2 text_size = font->get_string_size(str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size);
|
||||||
viewport->draw_string_outline(font, Point2(dragged_guide_pos.x + 10, RULER_WIDTH + text_size.y / 2 + 10), str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, outline_size, outline_color);
|
viewport->draw_string_outline(font, Point2(dragged_guide_pos.x + 10, RULER_WIDTH + text_size.y / 2 + 10), str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, outline_size, outline_color);
|
||||||
viewport->draw_string(font, Point2(dragged_guide_pos.x + 10, RULER_WIDTH + text_size.y / 2 + 10), str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color);
|
viewport->draw_string(font, Point2(dragged_guide_pos.x + 10, RULER_WIDTH + text_size.y / 2 + 10), str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color);
|
||||||
|
@ -2759,7 +2759,7 @@ void CanvasItemEditor::_draw_guides() {
|
||||||
if (drag_type == DRAG_DOUBLE_GUIDE || drag_type == DRAG_H_GUIDE) {
|
if (drag_type == DRAG_DOUBLE_GUIDE || drag_type == DRAG_H_GUIDE) {
|
||||||
String str = TS->format_number(vformat("%d px", Math::round(xform.affine_inverse().xform(dragged_guide_pos).y)));
|
String str = TS->format_number(vformat("%d px", Math::round(xform.affine_inverse().xform(dragged_guide_pos).y)));
|
||||||
Ref<Font> font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
|
Ref<Font> font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
|
||||||
int font_size = get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"));
|
int font_size = 1.3 * get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"));
|
||||||
Size2 text_size = font->get_string_size(str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size);
|
Size2 text_size = font->get_string_size(str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size);
|
||||||
viewport->draw_string_outline(font, Point2(RULER_WIDTH + 10, dragged_guide_pos.y + text_size.y / 2 + 10), str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, outline_size, outline_color);
|
viewport->draw_string_outline(font, Point2(RULER_WIDTH + 10, dragged_guide_pos.y + text_size.y / 2 + 10), str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, outline_size, outline_color);
|
||||||
viewport->draw_string(font, Point2(RULER_WIDTH + 10, dragged_guide_pos.y + text_size.y / 2 + 10), str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color);
|
viewport->draw_string(font, Point2(RULER_WIDTH + 10, dragged_guide_pos.y + text_size.y / 2 + 10), str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, text_color);
|
||||||
|
@ -2961,14 +2961,14 @@ void CanvasItemEditor::_draw_ruler_tool() {
|
||||||
const real_t vertical_angle_rad = Math_PI / 2.0 - horizontal_angle_rad;
|
const real_t vertical_angle_rad = Math_PI / 2.0 - horizontal_angle_rad;
|
||||||
|
|
||||||
Ref<Font> font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
|
Ref<Font> font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
|
||||||
int font_size = get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"));
|
int font_size = 1.3 * get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts"));
|
||||||
Color font_color = get_theme_color(SNAME("font_color"), SNAME("Editor"));
|
Color font_color = get_theme_color(SNAME("font_color"), SNAME("Editor"));
|
||||||
Color font_secondary_color = font_color;
|
Color font_secondary_color = font_color;
|
||||||
font_secondary_color.set_v(font_secondary_color.get_v() > 0.5 ? 0.7 : 0.3);
|
font_secondary_color.set_v(font_secondary_color.get_v() > 0.5 ? 0.7 : 0.3);
|
||||||
Color outline_color = font_color.inverted();
|
Color outline_color = font_color.inverted();
|
||||||
float text_height = font->get_height(font_size);
|
float text_height = font->get_height(font_size);
|
||||||
|
|
||||||
const float outline_size = 2;
|
const float outline_size = 4;
|
||||||
const float text_width = 76;
|
const float text_width = 76;
|
||||||
const float angle_text_width = 54;
|
const float angle_text_width = 54;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue