Fix ontab keeping scroll

This commit is contained in:
altalk23 2023-09-08 15:49:25 +03:00
parent b3d444a0f3
commit e68c0d7fcd

View file

@ -669,7 +669,7 @@ void ModListLayer::onTab(CCObject* pSender) {
if (pSender) { if (pSender) {
g_tab = static_cast<ModListType>(pSender->getTag()); g_tab = static_cast<ModListType>(pSender->getTag());
} }
this->reloadList(); this->reloadList(false);
auto toggleTab = [this](CCMenuItemToggler* member) -> void { auto toggleTab = [this](CCMenuItemToggler* member) -> void {
auto isSelected = member->getTag() == static_cast<int>(g_tab); auto isSelected = member->getTag() == static_cast<int>(g_tab);
@ -681,7 +681,7 @@ void ModListLayer::onTab(CCObject* pSender) {
targetMenu->addChild(member); targetMenu->addChild(member);
member->release(); member->release();
} }
if (isSelected) if (isSelected && m_tabsGradientStencil)
m_tabsGradientStencil->setPosition(member->m_onButton->convertToWorldSpace({0.f, -1.f})); m_tabsGradientStencil->setPosition(member->m_onButton->convertToWorldSpace({0.f, -1.f}));
}; };