Fix mouse wheel on NotificationsScroll (#9451)

* Fix mouse wheel on NotificationsScroll

* Explain why getMouseWheelX is overridden to zero
This commit is contained in:
SomeTroglodyte
2023-05-27 20:32:51 +02:00
committed by GitHub
parent 268d27d1ed
commit c73d5d74d0

View File

@ -110,6 +110,16 @@ class NotificationsScroll(
height = worldScreen.stage.height * inverseScaleFactor
}
/**
* If a Gdx ScrollPane has content larger than its size on both dimensions (if only one axis is
* scrollable, the wheel will always scroll that axis), it will prefer mapping the mouse wheel
* to *horizontal* scrolling, which is not quite the best choice for our notifications.
*
* The intuitive approach might be to change the listener (by overriding [addScrollListener]),
* but luckily this works too.
*/
override fun getMouseWheelX() = 0f
/** Access to hidden "state" - writing it will ensure this is fully visible or hidden and the
* restore button shown as needed - with animation. */
@Suppress("MemberVisibilityCanBePrivate") // API for future use