Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds handling of mouse scrolling using the mouse wheel or touch pad for macOS. Although basic event handling for macOS had been added before in #52, it looks to me like support for this was still missing. I had a look at all other public forks of this library and could not find someone working on this.
So I looked up the API documentation for it [1] and had a look at the existing code for
mouse_move
to make a change that feels consistent with the existing code. There seem to be two kinds of scroll delta values [2] [3] [4], precise and imprecise ones. I expect the precise deltas to be used when a touchpad is used and the imprecise ones if a mouse wheel is use. But I can only test the mouse wheel scenario, as I have a desktop computer and thus no touch pad to test with.If this is something you'd like to merge, feel free to do so. If this code needs to be improved, give me feedback and I will try to address it or just make adjustments yourself. But if you have other plans and do not want to merge this, that's fine too.
[1] https://developer.apple.com/documentation/appkit/nsresponder/1534192-scrollwheel?language=objc
[2] https://developer.apple.com/documentation/appkit/nsevent/1525758-hasprecisescrollingdeltas
[3] https://developer.apple.com/documentation/appkit/nsevent/1524505-scrollingdeltax