frontend: Further improved behaviour of info box on system selection menu, and fixed alignment issues.

This commit is contained in:
Vas Crabb 2021-10-17 09:34:08 +11:00
parent 14fc0b2a76
commit e1652298a5
2 changed files with 19 additions and 19 deletions

View File

@ -1527,7 +1527,7 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey)
// Infos
if (!rightclose && m_focus == focused_menu::RIGHTBOTTOM)
{
m_topline_datsview -= m_right_visible_lines - 1;
m_topline_datsview -= m_right_visible_lines - 3;
return;
}
@ -1545,7 +1545,7 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey)
// Infos
if (!rightclose && m_focus == focused_menu::RIGHTBOTTOM)
{
m_topline_datsview += m_right_visible_lines - 1;
m_topline_datsview += m_right_visible_lines - 3;
return;
}
@ -1715,9 +1715,9 @@ void menu_select_launch::handle_events(uint32_t flags, event &ev)
else if (hover() == HOVER_UI_LEFT)
ev.iptkey = IPT_UI_LEFT;
else if (hover() == HOVER_DAT_DOWN)
m_topline_datsview += m_right_visible_lines - 1;
m_topline_datsview += m_right_visible_lines - 3;
else if (hover() == HOVER_DAT_UP)
m_topline_datsview -= m_right_visible_lines - 1;
m_topline_datsview -= m_right_visible_lines - 3;
else if (hover() == HOVER_LPANEL_ARROW)
{
if (get_focus() == focused_menu::LEFT)
@ -2850,31 +2850,31 @@ void menu_select_launch::infos_render(float origx1, float origy1, float origx2,
draw_common_arrow(origx1, origy1, origx2, origy2, m_info_view, 0, total - 1, title_size);
int r_visible_lines = floor((origy2 - oy1) / (line_height * text_size));
if (m_total_lines < r_visible_lines)
r_visible_lines = m_total_lines;
m_right_visible_lines = floor((origy2 - oy1) / (line_height * text_size));
if (m_total_lines < m_right_visible_lines)
m_right_visible_lines = m_total_lines;
if (m_topline_datsview < 0)
m_topline_datsview = 0;
if (m_topline_datsview + r_visible_lines >= m_total_lines)
m_topline_datsview = m_total_lines - r_visible_lines;
if ((m_topline_datsview + m_right_visible_lines) >= m_total_lines)
m_topline_datsview = m_total_lines - m_right_visible_lines;
// return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow
m_right_visible_lines = r_visible_lines
- (m_topline_datsview ? 1 : 0)
- ((m_topline_datsview + r_visible_lines < m_total_lines) ? 1 : 0);
// get the number of visible lines, minus 1 for top arrow and 1 for bottom arrow
bool const up_arrow = m_topline_datsview > 0;
bool const down_arrow = (m_topline_datsview + m_right_visible_lines) < m_total_lines;
int const r_visible_lines = m_right_visible_lines - (up_arrow ? 1 : 0) - (down_arrow ? 1 : 0);
if (mouse_in_rect(origx1 + gutter_width, oy1, origx2 - gutter_width, origy2))
set_hover(HOVER_INFO_TEXT);
if (m_topline_datsview) // up arrow
if (up_arrow)
draw_info_arrow(0, origx1, origx2, oy1, line_height, text_size, ud_arrow_width);
if (m_total_lines > (m_topline_datsview + r_visible_lines)) // bottom arrow
draw_info_arrow(1, origx1, origx2, oy1 + (float(r_visible_lines - 1) * line_height), line_height, text_size, ud_arrow_width);
if (down_arrow)
draw_info_arrow(1, origx1, origx2, oy1 + (float(m_right_visible_lines - 1) * line_height * text_size), line_height, text_size, ud_arrow_width);
m_info_layout->emit(
container(),
m_topline_datsview ? (m_topline_datsview + 1) : 0, m_right_visible_lines,
origx1 + gutter_width, oy1 + (m_topline_datsview ? line_height : 0.0f));
m_topline_datsview ? (m_topline_datsview + 1) : 0, r_visible_lines,
origx1 + gutter_width, oy1 + (m_topline_datsview ? (line_height * text_size) : 0.0f));
}

View File

@ -537,7 +537,7 @@ void text_layout::word_wrap()
// find the beginning of the word to wrap
size_t position = last_break;
while ((position + 1) < last_line->character_count() && is_space_character(last_line->character(position).character))
while ((last_line->character_count() > position) && is_space_character(last_line->character(position).character))
position++;
// carry over justification