mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-27 22:20:14 -04:00
Tweak how scroll offsets are calculated for smoother scrolling
This commit is contained in:
parent
abe0467915
commit
e349fa248a
@ -944,21 +944,16 @@ namespace MWGui
|
|||||||
if (focused)
|
if (focused)
|
||||||
{
|
{
|
||||||
// Scroll the side bar to keep the active item in view
|
// Scroll the side bar to keep the active item in view
|
||||||
if (index <= 6)
|
int offset = 0;
|
||||||
mTopicsList->setViewOffset(0);
|
for (int i = 6; i < static_cast<int>(index); i++)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
int offset = 0;
|
const std::string& keyword = mTopicsList->getItemNameAt(i);
|
||||||
for (int i = 0; i < static_cast<int>(index) - 6; i++)
|
if (keyword.empty())
|
||||||
{
|
offset += 18 + sVerticalPadding * 2;
|
||||||
const std::string& keyword = mTopicsList->getItemNameAt(i);
|
else
|
||||||
if (keyword.empty())
|
offset += mTopicsList->getItemWidget(keyword)->getHeight() + sVerticalPadding * 2;
|
||||||
offset += 18 + sVerticalPadding * 2;
|
|
||||||
else
|
|
||||||
offset += mTopicsList->getItemWidget(keyword)->getHeight() + sVerticalPadding * 2;
|
|
||||||
}
|
|
||||||
mTopicsList->setViewOffset(-offset);
|
|
||||||
}
|
}
|
||||||
|
mTopicsList->setViewOffset(-offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -971,15 +971,10 @@ namespace
|
|||||||
|
|
||||||
// Scroll the list to keep the active item in view
|
// Scroll the list to keep the active item in view
|
||||||
Gui::MWList* list = getWidget<Gui::MWList>(mQuestMode ? QuestsList : TopicsList);
|
Gui::MWList* list = getWidget<Gui::MWList>(mQuestMode ? QuestsList : TopicsList);
|
||||||
if (mSelectedQuest <= 3)
|
int offset = 0;
|
||||||
list->setViewOffset(0);
|
for (int i = 3; i < static_cast<int>(mSelectedQuest); i++)
|
||||||
else
|
offset += mButtons[i]->getHeight();
|
||||||
{
|
list->setViewOffset(-offset);
|
||||||
int offset = 0;
|
|
||||||
for (int i = 0; i < static_cast<int>(mSelectedQuest) - 3; i++)
|
|
||||||
offset += mButtons[i]->getHeight() + 3;
|
|
||||||
list->setViewOffset(-offset);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user