diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fbb3d6d1d..bfe6fcf177 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index 6477d907b7..6427499283 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -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; diff --git a/apps/openmw/mwgui/race.hpp b/apps/openmw/mwgui/race.hpp index 160999213e..e48ca28162 100644 --- a/apps/openmw/mwgui/race.hpp +++ b/apps/openmw/mwgui/race.hpp @@ -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);