Fixed an issue with incorrect scroll indicators in the Alternative Emulators screen.

This commit is contained in:
Leon Styhre 2022-05-21 19:52:05 +02:00
parent eb47511bbc
commit c1fe919e4d
2 changed files with 9 additions and 2 deletions

View file

@ -220,7 +220,14 @@ void GuiAlternativeEmulators::selectorWindow(SystemData* system)
auto menuPos = s->getMenuPosition();
s->setMenuPosition(glm::vec3 {(s->getSize().x - menuSize.x) / 2.0f, menuPos.y, menuPos.z});
s->refreshList();
// Hack to properly update the window and set the scroll indicators. Why this is required
// is currently a mystery.
auto list = s->getMenu().getList();
list->update(1);
int cursor {list->getCursorId()};
list->setCursor(list->getFirst());
list->moveCursor(cursor);
mWindow->pushGui(s);
}

View file

@ -38,11 +38,11 @@ public:
bool isPassword = false);
void addSaveFunc(const std::function<void()>& func) { mSaveFuncs.push_back(func); }
MenuComponent& getMenu() { return mMenu; }
glm::vec2 getMenuSize() { return mMenu.getSize(); }
void setMenuSize(glm::vec2 size) { mMenu.setSize(size); }
glm::vec3 getMenuPosition() { return mMenu.getPosition(); }
void setMenuPosition(glm::vec3 position) { mMenu.setPosition(glm::round(position)); }
void refreshList() { mMenu.getList()->onSizeChanged(); }
void setNeedsSaving(bool state = true) { mNeedsSaving = state; }
void setNeedsReloadHelpPrompts() { mNeedsReloadHelpPrompts = true; }