mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-09 18:34:37 +00:00
Fix not checking bounds in some controller menus
This commit is contained in:
parent
a824993a60
commit
ae676e1d70
4 changed files with 24 additions and 17 deletions
|
|
@ -280,10 +280,10 @@ namespace MWGui
|
|||
mLines[newFocus].mIcon->setControllerFocus(true);
|
||||
|
||||
// Scroll the list to keep the active item in view
|
||||
if (mControllerFocus <= 3)
|
||||
if (newFocus <= 3)
|
||||
mScrollView->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
else
|
||||
mScrollView->setViewOffset(MyGUI::IntPoint(-55 * (mControllerFocus - 3), 0));
|
||||
mScrollView->setViewOffset(MyGUI::IntPoint(-55 * (newFocus - 3), 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,13 +205,16 @@ namespace MWGui
|
|||
}
|
||||
|
||||
// Scroll the list to keep the active item in view
|
||||
int line = mButtons[mControllerFocus].second;
|
||||
if (line <= 5)
|
||||
mList->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
else
|
||||
if (mControllerFocus >= 0 && mControllerFocus < mButtons.size())
|
||||
{
|
||||
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||
mList->setViewOffset(MyGUI::IntPoint(0, -lineHeight * (line - 5)));
|
||||
int line = mButtons[mControllerFocus].second;
|
||||
if (line <= 5)
|
||||
mList->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
else
|
||||
{
|
||||
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||
mList->setViewOffset(MyGUI::IntPoint(0, -lineHeight * (line - 5)));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -247,14 +247,17 @@ namespace MWGui
|
|||
mSpellButtons[mControllerFocus].first->setStateSelected(true);
|
||||
}
|
||||
|
||||
// Scroll the list to keep the active item in view
|
||||
int line = mSpellButtons[mControllerFocus].second;
|
||||
if (line <= 5)
|
||||
mSpellsView->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
else
|
||||
if (mControllerFocus >= 0 && mControllerFocus < mSpellButtons.size())
|
||||
{
|
||||
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||
mSpellsView->setViewOffset(MyGUI::IntPoint(0, -lineHeight * (line - 5)));
|
||||
// Scroll the list to keep the active item in view
|
||||
int line = mSpellButtons[mControllerFocus].second;
|
||||
if (line <= 5)
|
||||
mSpellsView->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
else
|
||||
{
|
||||
const int lineHeight = Settings::gui().mFontSize + 2;
|
||||
mSpellsView->setViewOffset(MyGUI::IntPoint(0, -lineHeight * (line - 5)));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -408,8 +408,6 @@ namespace MWGui
|
|||
if (focused)
|
||||
{
|
||||
focused->onMouseSetFocus(nullptr);
|
||||
if (mControllerTooltip)
|
||||
MWBase::Environment::get().getInputManager()->warpMouseToWidget(focused);
|
||||
|
||||
// Scroll the list to keep the active item in view
|
||||
int line = mButtons[newFocus].second;
|
||||
|
|
@ -420,6 +418,9 @@ namespace MWGui
|
|||
const int lineHeight = focused->getHeight();
|
||||
mScrollView->setViewOffset(MyGUI::IntPoint(0, -lineHeight * (line - 5)));
|
||||
}
|
||||
|
||||
if (mControllerTooltip)
|
||||
MWBase::Environment::get().getInputManager()->warpMouseToWidget(focused);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue