manipulator: show full group when navigating labor groups

develop
jj 2012-09-28 18:58:58 +02:00
parent 4a495c2c7f
commit 687657f2da
1 changed files with 11 additions and 0 deletions

@ -662,6 +662,17 @@ void viewscreen_unitlaborsst::feed(set<df::interface_key> *events)
if (sel_column > NUM_COLUMNS - 1) if (sel_column > NUM_COLUMNS - 1)
sel_column = NUM_COLUMNS - 1; sel_column = NUM_COLUMNS - 1;
if (events->count(interface_key::CURSOR_DOWN_Z) || events->count(interface_key::CURSOR_UP_Z))
{
// when moving by group, ensure the whole group is shown onscreen
int endgroup_column = sel_column;
while ((endgroup_column < NUM_COLUMNS-1) && columns[endgroup_column+1].group == columns[sel_column].group)
endgroup_column++;
if (first_column < endgroup_column - col_widths[DISP_COLUMN_LABORS] + 1)
first_column = endgroup_column - col_widths[DISP_COLUMN_LABORS] + 1;
}
if (sel_column < first_column) if (sel_column < first_column)
first_column = sel_column; first_column = sel_column;
if (first_column < sel_column - col_widths[DISP_COLUMN_LABORS] + 1) if (first_column < sel_column - col_widths[DISP_COLUMN_LABORS] + 1)