Scale animation track editor line widths on hiDPI displays

This commit is contained in:
Hugo Locurcio 2019-04-15 14:11:13 +02:00
parent dab8f8c953
commit c0959f00a0
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C
1 changed files with 19 additions and 19 deletions

View File

@ -936,7 +936,7 @@ void AnimationTimelineEdit::_notification(int p_what) {
if (frame != prev_frame && i >= prev_frame_ofs) { if (frame != prev_frame && i >= prev_frame_ofs) {
draw_line(Point2(get_name_limit() + i, 0), Point2(get_name_limit() + i, h), linecolor); draw_line(Point2(get_name_limit() + i, 0), Point2(get_name_limit() + i, h), linecolor, Math::round(EDSCALE));
draw_string(font, Point2(get_name_limit() + i + 3 * EDSCALE, (h - font->get_height()) / 2 + font->get_ascent()).floor(), itos(frame), sub ? color_time_dec : color_time_sec, zoomw - i); draw_string(font, Point2(get_name_limit() + i + 3 * EDSCALE, (h - font->get_height()) / 2 + font->get_ascent()).floor(), itos(frame), sub ? color_time_dec : color_time_sec, zoomw - i);
prev_frame_ofs = i + font->get_string_size(itos(frame)).x + 5 * EDSCALE; prev_frame_ofs = i + font->get_string_size(itos(frame)).x + 5 * EDSCALE;
@ -957,13 +957,13 @@ void AnimationTimelineEdit::_notification(int p_what) {
if ((sc / step) != (prev_sc / step) || (prev_sc < 0 && sc >= 0)) { if ((sc / step) != (prev_sc / step) || (prev_sc < 0 && sc >= 0)) {
int scd = sc < 0 ? prev_sc : sc; int scd = sc < 0 ? prev_sc : sc;
draw_line(Point2(get_name_limit() + i, 0), Point2(get_name_limit() + i, h), linecolor); draw_line(Point2(get_name_limit() + i, 0), Point2(get_name_limit() + i, h), linecolor, Math::round(EDSCALE));
draw_string(font, Point2(get_name_limit() + i + 3, (h - font->get_height()) / 2 + font->get_ascent()).floor(), String::num((scd - (scd % step)) / double(SC_ADJ), decimals), sub ? color_time_dec : color_time_sec, zoomw - i); draw_string(font, Point2(get_name_limit() + i + 3, (h - font->get_height()) / 2 + font->get_ascent()).floor(), String::num((scd - (scd % step)) / double(SC_ADJ), decimals), sub ? color_time_dec : color_time_sec, zoomw - i);
} }
} }
} }
draw_line(Vector2(0, get_size().height), get_size(), linecolor); draw_line(Vector2(0, get_size().height), get_size(), linecolor, Math::round(EDSCALE));
} }
} }
@ -1041,7 +1041,7 @@ void AnimationTimelineEdit::_play_position_draw() {
if (px >= get_name_limit() && px < (play_position->get_size().width - get_buttons_width())) { if (px >= get_name_limit() && px < (play_position->get_size().width - get_buttons_width())) {
Color color = get_color("accent_color", "Editor"); Color color = get_color("accent_color", "Editor");
play_position->draw_line(Point2(px, 0), Point2(px, h), color); play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(EDSCALE));
} }
} }
@ -1310,7 +1310,7 @@ void AnimationTrackEdit::_notification(int p_what) {
string_pos = string_pos.floor(); string_pos = string_pos.floor();
draw_string(font, string_pos, text, text_color, limit - ofs - hsep); draw_string(font, string_pos, text, text_color, limit - ofs - hsep);
draw_line(Point2(limit, 0), Point2(limit, get_size().height), linecolor); draw_line(Point2(limit, 0), Point2(limit, get_size().height), linecolor, Math::round(EDSCALE));
} }
// KEYFAMES // // KEYFAMES //
@ -1370,7 +1370,7 @@ void AnimationTrackEdit::_notification(int p_what) {
Ref<Texture> down_icon = get_icon("select_arrow", "Tree"); Ref<Texture> down_icon = get_icon("select_arrow", "Tree");
draw_line(Point2(ofs, 0), Point2(ofs, get_size().height), linecolor); draw_line(Point2(ofs, 0), Point2(ofs, get_size().height), linecolor, Math::round(EDSCALE));
ofs += hsep; ofs += hsep;
{ {
@ -1417,7 +1417,7 @@ void AnimationTrackEdit::_notification(int p_what) {
} }
ofs += down_icon->get_width(); ofs += down_icon->get_width();
draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor); draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor, Math::round(EDSCALE));
ofs += hsep; ofs += hsep;
} }
@ -1450,7 +1450,7 @@ void AnimationTrackEdit::_notification(int p_what) {
} }
ofs += down_icon->get_width(); ofs += down_icon->get_width();
draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor); draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor, Math::round(EDSCALE));
ofs += hsep; ofs += hsep;
} }
@ -1483,7 +1483,7 @@ void AnimationTrackEdit::_notification(int p_what) {
} }
ofs += down_icon->get_width(); ofs += down_icon->get_width();
draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor); draw_line(Point2(ofs + hsep * 0.5, 0), Point2(ofs + hsep * 0.5, get_size().height), linecolor, Math::round(EDSCALE));
ofs += hsep; ofs += hsep;
} }
@ -1501,17 +1501,17 @@ void AnimationTrackEdit::_notification(int p_what) {
} }
if (in_group) { if (in_group) {
draw_line(Vector2(timeline->get_name_limit(), get_size().height), get_size(), linecolor); draw_line(Vector2(timeline->get_name_limit(), get_size().height), get_size(), linecolor, Math::round(EDSCALE));
} else { } else {
draw_line(Vector2(0, get_size().height), get_size(), linecolor); draw_line(Vector2(0, get_size().height), get_size(), linecolor, Math::round(EDSCALE));
} }
if (dropping_at != 0) { if (dropping_at != 0) {
Color drop_color = get_color("accent_color", "Editor"); Color drop_color = get_color("accent_color", "Editor");
if (dropping_at < 0) { if (dropping_at < 0) {
draw_line(Vector2(0, 0), Vector2(get_size().width, 0), drop_color); draw_line(Vector2(0, 0), Vector2(get_size().width, 0), drop_color, Math::round(EDSCALE));
} else { } else {
draw_line(Vector2(0, get_size().height), get_size(), drop_color); draw_line(Vector2(0, get_size().height), get_size(), drop_color, Math::round(EDSCALE));
} }
} }
} }
@ -1560,7 +1560,7 @@ void AnimationTrackEdit::draw_key_link(int p_index, float p_pixels_sec, int p_x,
int from_x = MAX(p_x, p_clip_left); int from_x = MAX(p_x, p_clip_left);
int to_x = MIN(p_next_x, p_clip_right); int to_x = MIN(p_next_x, p_clip_right);
draw_line(Point2(from_x + 1, get_size().height / 2), Point2(to_x, get_size().height / 2), color, 2); draw_line(Point2(from_x + 1, get_size().height / 2), Point2(to_x, get_size().height / 2), color, Math::round(2 * EDSCALE));
} }
void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) { void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) {
@ -1740,7 +1740,7 @@ void AnimationTrackEdit::_play_position_draw() {
if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) { if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) {
Color color = get_color("accent_color", "Editor"); Color color = get_color("accent_color", "Editor");
play_position->draw_line(Point2(px, 0), Point2(px, h), color); play_position->draw_line(Point2(px, 0), Point2(px, h), color, Math::round(EDSCALE));
} }
} }
@ -2443,9 +2443,9 @@ void AnimationTrackEditGroup::_notification(int p_what) {
Color linecolor = color; Color linecolor = color;
linecolor.a = 0.2; linecolor.a = 0.2;
draw_line(Point2(), Point2(get_size().width, 0), linecolor); draw_line(Point2(), Point2(get_size().width, 0), linecolor, Math::round(EDSCALE));
draw_line(Point2(timeline->get_name_limit(), 0), Point2(timeline->get_name_limit(), get_size().height), linecolor); draw_line(Point2(timeline->get_name_limit(), 0), Point2(timeline->get_name_limit(), get_size().height), linecolor, Math::round(EDSCALE));
draw_line(Point2(get_size().width - timeline->get_buttons_width(), 0), Point2(get_size().width - timeline->get_buttons_width(), get_size().height), linecolor); draw_line(Point2(get_size().width - timeline->get_buttons_width(), 0), Point2(get_size().width - timeline->get_buttons_width(), get_size().height), linecolor, Math::round(EDSCALE));
int ofs = 0; int ofs = 0;
draw_texture(icon, Point2(ofs, int(get_size().height - icon->get_height()) / 2)); draw_texture(icon, Point2(ofs, int(get_size().height - icon->get_height()) / 2));
@ -2456,7 +2456,7 @@ void AnimationTrackEditGroup::_notification(int p_what) {
if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) { if (px >= timeline->get_name_limit() && px < (get_size().width - timeline->get_buttons_width())) {
Color accent = get_color("accent_color", "Editor"); Color accent = get_color("accent_color", "Editor");
draw_line(Point2(px, 0), Point2(px, get_size().height), accent); draw_line(Point2(px, 0), Point2(px, get_size().height), accent, Math::round(EDSCALE));
} }
} }
} }