Adding buttons field to mouse events #178
Open
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.
Syn does not properly fill the "buttons" field in mouse-type event generation. This change adds 'buttons' for most mouse-events (but not for jQuery drag & drop - in this case it adds "undef" buttons - for some reason that I have yet to understand, setting the buttons field in jQuery will prevent the drag)
The size of this change is a bit worrisome. I feel like the size of this change is an indication that the way FuncUnit / Syn is organized should be revisited. It probably shouldn't require so many far-flung changes to add a field in the mouse event generation.
Now that we've dropped support for IE, we could look at some more ES6-style workflows, maybe use the event constructors rather than using the initializer, and create them directly rather than via the event trigger (which shaves off a lot of useful data that we need to re-find).
It could also be helpful to make Syn/FuncUnit stateful. Rather than interrogate and try and keep track of which buttons are down, we could have a global state machine that describes the "current state" of user interactions. (which buttons are down, keys, etc)