Closed TheTacBanana closed 1 year ago
IMO this could be cleaner and more backwards compatible to add a 'button type' to CursorEvent struct and leave the EventType Enum the way it was.
This way, if i want to do something on a left OR right click, i wont have to implement 2 different children in a match statement. I can just check to see if the button type in cursorevent inside of 'MouseDown' is LEFT or RIGHT.
im going to make a PR based on yours with this alternative topology so hold off until we can look at both and compare pls.
okay please see PR #276 it is built off of this one. That PR offers the same functionality, using many of your lines of code but instead of adding new EventTypes it just adds a 'button type' prop to the CursorEvent struct. This way the examples don't even have to change and it doesn't break anyones existing codebases but still offers all the same benefits of being able to detect which mouse button has been pressed.
Definitely a better way of implementing it, not sure why I didn't do that myself. I'm in favor of your PR, much simpler.
Adds the ability to detect Right and Middle click on widgets.
Changes are breaking due to changes of Enum names. But relatively easy to fix existing code.
Existing:
New: