Allow mouse scrolling in the race preview widget (feature 6925)

check_span
Andrei Kortunov 2 years ago
parent 86a4d530c4
commit 7dd668bf12

@ -203,6 +203,7 @@
Feature #6721: [OpenMW-CS] Add option to open records in new window
Feature #6867: Add a way to localize hardcoded strings in GUI
Feature #6888: Add switch for armor degradation fix.
Feature #6925: Allow to use a mouse wheel to rotate a head in the race selection menu
Task #6078: First person should not clear depth buffer
Task #6161: Refactor Sky to use shaders and be GLES/GL3 friendly
Task #6162: Refactor GUI to use shaders and to be GLES and GL3+ friendly

@ -56,6 +56,8 @@ namespace MWGui
setText("AppearanceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu1", "Appearance"));
getWidget(mPreviewImage, "PreviewImage");
mPreviewImage->eventMouseWheel += MyGUI::newDelegate(this, &RaceDialog::onPreviewScroll);
getWidget(mHeadRotate, "HeadRotate");
mHeadRotate->setScrollRange(1000);
@ -211,6 +213,19 @@ namespace MWGui
eventBack();
}
void RaceDialog::onPreviewScroll(MyGUI::Widget*, int _delta)
{
size_t oldPos = mHeadRotate->getScrollPosition();
size_t maxPos = mHeadRotate->getScrollRange() - 1;
size_t scrollPage = mHeadRotate->getScrollWheelPage();
if (_delta < 0)
mHeadRotate->setScrollPosition(oldPos + std::min(maxPos - oldPos, scrollPage));
else
mHeadRotate->setScrollPosition(oldPos - std::min(oldPos, scrollPage));
onHeadRotate(mHeadRotate, mHeadRotate->getScrollPosition());
}
void RaceDialog::onHeadRotate(MyGUI::ScrollBar* scroll, size_t _position)
{
float angle = (float(_position) / (scroll->getScrollRange()-1) - 0.5f) * osg::PI * 2;

@ -66,6 +66,7 @@ namespace MWGui
EventHandle_WindowBase eventDone;
protected:
void onPreviewScroll(MyGUI::Widget* _sender, int _delta);
void onHeadRotate(MyGUI::ScrollBar* _sender, size_t _position);
void onSelectPreviousGender(MyGUI::Widget* _sender);

Loading…
Cancel
Save