fix maxscrolloffset ignoring option visibility

This commit is contained in:
yugecin 2017-01-30 10:23:48 +01:00
parent e7e3672491
commit 89fcab3acf

View File

@ -345,8 +345,12 @@ public class OptionsOverlay extends OverlayOpsuState {
lineHeight += optionHeight; lineHeight += optionHeight;
if (y > height) { if (y > height) {
render = false; render = false;
maxScrollOffset += (section.options.length - optionIndex - 1) * optionHeight; while (++optionIndex < section.options.length) {
break; option = section.options[optionIndex];
if (option.showCondition() && !option.isFiltered()) {
maxScrollOffset += optionHeight;
}
}
} }
} }
g.setColor(COL_GREY); g.setColor(COL_GREY);
@ -354,9 +358,17 @@ public class OptionsOverlay extends OverlayOpsuState {
} }
// iterate over skipped options to correctly calculate max scroll offset // iterate over skipped options to correctly calculate max scroll offset
for (; sectionIndex < sections.length; sectionIndex++) { for (; sectionIndex < sections.length; sectionIndex++) {
if (sections[sectionIndex].filtered) {
continue;
}
maxScrollOffset += Fonts.LARGE.getLineHeight() * 1.5f; maxScrollOffset += Fonts.LARGE.getLineHeight() * 1.5f;
if (sections[sectionIndex].options != null) { if (sections[sectionIndex].options == null) {
maxScrollOffset += sections[sectionIndex].options.length * optionHeight; continue;
}
for (GameOption option : sections[sectionIndex].options) {
if (option.showCondition() && !option.isFiltered()) {
maxScrollOffset += optionHeight;
}
} }
} }
if (openDropdownMenu != null) { if (openDropdownMenu != null) {