make default tab actually work

This commit is contained in:
yugecin 2016-12-11 16:36:29 +01:00
parent 7096201521
commit 0e06ab6249

View File

@ -98,7 +98,12 @@ public class OptionsOverlay {
float tabY = Fonts.XLARGE.getLineHeight() + Fonts.DEFAULT.getLineHeight() + height * 0.015f - (tabImage.getHeight() / 2f); float tabY = Fonts.XLARGE.getLineHeight() + Fonts.DEFAULT.getLineHeight() + height * 0.015f - (tabImage.getHeight() / 2f);
int tabOffset = Math.min(tabImage.getWidth(), width / tabs.length); int tabOffset = Math.min(tabImage.getWidth(), width / tabs.length);
maxScrollOffset = Fonts.MEDIUM.getLineHeight() * 2 * tabs.length; maxScrollOffset = Fonts.MEDIUM.getLineHeight() * 2 * tabs.length;
scrollOffset = 0;
for (OptionTab tab : tabs) { for (OptionTab tab : tabs) {
if (defaultSelectedTabIndex-- > 0) {
scrollOffset += Fonts.MEDIUM.getLineHeight() * 2;
scrollOffset += tab.options.length * optionHeight;
}
maxScrollOffset += tab.options.length * optionHeight; maxScrollOffset += tab.options.length * optionHeight;
tab.button = new MenuButton(tabImage, tabX, tabY); tab.button = new MenuButton(tabImage, tabX, tabY);
tabX += tabOffset; tabX += tabOffset;