-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Add support for wheel events #808
Comments
I am willing to implement this (I already have a working prototype I am using in game I am working on). For handling the scenario's where the page could have a scroll bar, we could provide some sort of "enableMousewheelCapture" flag which uses event.preventDefault() to cancel the window from scrolling. That way, the developer can decide how to handle that circumstance. Aside from that, what should I name the events? I am thinking "wheelforward" and "wheelbackward". |
I like "wheelForward" and "wheelBackward". @excaliburjs/core-contributors, any thoughts? Watching for changes in vertical scroll covers the most common action with a standard mousewheel. There are other scrolling scenarios we may want to address (for example, a trackball, or a mouse with sidescroll capability). Those are probably best left to a second issue to add additional support for changes in |
Looking into this further, we could be more generic and have a "wheel" event in general. Then leave it up to the develop to examine deltaX, deltaY, and deltaZ. I started work on this about an hour ago, and that's the way I am going so far. I will push up a draft shortly. Also, side question: why var instead of let and const? |
@jedeen Further issues. According the MDN (https://developer.mozilla.org/en-US/docs/Web/Events/wheel) there is a "deltaMode" which defines what type of "detla" is pased. It can either be "pixels", "lines" or "pages". The question is, do we try to normalize this, or do we just give the developer the deltaMode and let them deal with it? I am leaning toward just giving the developer the deltaMode and letting them deal with it. In most use cases, developers are not even going to care about the raw values. They are just going to want to know if they were positive or negative. |
- Added event "wheel" - Added sandbox pointer wheel test - Added docs
Excalibur currently targets ECMAScript 5, which does not include the I think passing through the |
@jedeen did you mean to leave this comment on the PR? |
@kamranayub no, I haven't had a chance to look at the PR yet, just responding to the questions in the previous comment. |
- Added event "wheel" - Added sandbox pointer wheel test - Added docs
Context
Currently, Excalibur does not directly support wheel events (such as mouse scrolling) for input.
Proposal
Add support for wheel events.
Additionally, work will need to be done for the scenario where a game is using wheel events, but the page has a scroll bar.
The text was updated successfully, but these errors were encountered: