-
Notifications
You must be signed in to change notification settings - Fork 184
Feature: More customizable pointer events for advanced use cases #498
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
base: v6
Are you sure you want to change the base?
Conversation
@hmpthz we'll be taking a look as soon as possible, thanks! |
@hmpthz can you please check the conflicts? |
@danielbarion Thanks, I'm looking into it. It seems the conflicts are just about imports. |
78f8bbd
to
ff4375a
Compare
the code looks good to me, but I would like to have feedback from @lunarraid too. @lunarraid can you please take a look and let me know your thoughts about it? thanks in advance |
This seems to add a lot of complexity just to change out whether or not the pointer events use the capture phase or not. Is all that per-event logic really necessary? There's nothing preventing devs from simply adding their own capture phase events for any reason they'd need to without any API changes. |
Hi @lunarraid the main reason for this pr is because you can't stop the original InputManager from adding all default listeners in constructor. An alternative solution could be a simple boolean option such as "noDefaultListeners" so that InputManager won't add anything in contructor. Then it'll be devs jobs to add things on their demand. Do you think this sounds ok? if (!this.viewport.options.noDefaultListeners)
{
this.addPointerListeners();
} Frankly speaking, writing some "remove then add again" code doesn't hurt anything. It's just my personal motive to get rid of it at the cost of a small API change. |
It's always been hard if there are interactive childs inside Viewport containers.
Devs have to be careful with all those event bubbling and capturing stuff to make things work as they expect.
Recently, I was adding a few childs with 'pointertap' events into Viewport, hoping the child events would be emitted before Viewport events. Then I found out 'pointertap' event was not added by InputManager, therefore event bubbling didn't work.
This makes me think if it's a good idea to provide additional options for devs to fully control Viewport's pointer events. I believe it might be useful in some rare use cases.
This commit adds a new property to IViewportOption. People won't notice any difference if this prop is not specified.