Loading
Implement MouseWheel Lua event for UI
Closes #9214 (closed)
Description
There is currently no direct way to listen for a mouse wheel event on UI elements - breaking the linear logic of listening for direct events on UI.
This implements a mouseWheel event for Lua UIs that avoids using the MyGUI event delegate and instead uses SDL's mouse wheel event supporting both vertical and horizontal scrolling. The event table provides the cursor's current pixel position and the delta scroll for the X and Y axes.
Lua docs have been updated to reflect this change.
Checklist
- I have read the CONTRIBUTING guidelines
- My code builds and runs locally
- My code passes CI on my fork
- I have included steps to replicate/confirm the changes below
- I have attached necessary supporting files or assets
Steps to Test/Replicate
Add the below to a Widget UI's events table:
events = {
mouseWheel = async:callback(function(wheelEvent, l)
print(wheelEvent.position)
print(wheelEvent.delta)
end)
}Edited by Cole Green