mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-28 06:30:36 -04:00
Tweak how scroll offsets are calculated for smoother scrolling
This commit is contained in:
parent
abe0467915
commit
e349fa248a
@ -944,12 +944,8 @@ 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)
|
|
||||||
mTopicsList->setViewOffset(0);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
for (int i = 0; i < static_cast<int>(index) - 6; i++)
|
for (int i = 6; i < static_cast<int>(index); i++)
|
||||||
{
|
{
|
||||||
const std::string& keyword = mTopicsList->getItemNameAt(i);
|
const std::string& keyword = mTopicsList->getItemNameAt(i);
|
||||||
if (keyword.empty())
|
if (keyword.empty())
|
||||||
@ -960,7 +956,6 @@ namespace MWGui
|
|||||||
mTopicsList->setViewOffset(-offset);
|
mTopicsList->setViewOffset(-offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool DialogueWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
|
bool DialogueWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
|
||||||
{
|
{
|
||||||
|
@ -971,17 +971,12 @@ 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)
|
|
||||||
list->setViewOffset(0);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
for (int i = 0; i < static_cast<int>(mSelectedQuest) - 3; i++)
|
for (int i = 3; i < static_cast<int>(mSelectedQuest); i++)
|
||||||
offset += mButtons[i]->getHeight() + 3;
|
offset += mButtons[i]->getHeight();
|
||||||
list->setViewOffset(-offset);
|
list->setViewOffset(-offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user