scroll if item selected by menu shortcut is out of screen

This commit is contained in:
Alexander Kromm 2021-07-01 00:46:00 +07:00 committed by Christoph Oelckers
parent 38fcfa5ba9
commit 5cced2721a

View file

@ -218,6 +218,11 @@ class OptionMenu : Menu
break; break;
} }
} }
if (mDesc.mSelectedItem <= mDesc.mScrollTop + mDesc.mScrollPos
|| mDesc.mSelectedItem >= VisBottom)
{
mDesc.mScrollPos = MAX(mDesc.mSelectedItem - mDesc.mScrollTop - 1, 0);
}
} }
return Super.OnUIEvent(ev); return Super.OnUIEvent(ev);
} }