Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding buttons field to mouse events #178

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kdillon
Copy link
Collaborator

@kdillon kdillon commented Dec 5, 2019

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)

… RIGHTCLICK now so that the buttons fields are auto-filled, and I made it so that the default is buttons: undef for the jQuery Drag and Drop case. All other cases should have buttons pre-populated. Tested on chrome
…g drop 'dragStart' and 'dragEnd' events. The dragend should be button 0 (not -1). The -1 comes from PointerOut, which we are not generating.
@justinbmeyer
Copy link
Member

Thanks. I just did a big rewrite. I organized the events like:

dragstart = {
  setup(){ .. }    // do this before the event
  options(){ .. }   // create options
  create() { .. }   // create the event
  default() { .. }   // default actions
}

This should make it easier to make changes like this.

I'm going to try to pull this in to these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants