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

Extended Click Event Handlers #530

Merged
merged 2 commits into from
Jun 24, 2020
Merged

Extended Click Event Handlers #530

merged 2 commits into from
Jun 24, 2020

Conversation

stephencorwin
Copy link
Member

@stephencorwin stephencorwin commented Jun 24, 2020

2020-06-23_20-11-07

Following the existing examples of the onClick implementation, I extended the event handlers to support both onDoubleClick and onContextMenu.

The main reason for this PR is that I need to support "right-clicking" in my game. I was surprised to find that support for it didn't exist yet in R3F. The corresponding handler in React is onContextMenu. I looked through the discussions and didn't see any conversations about it yet, however I did see one about onDoubleClick. I figured I would add support for that event as well since I'll probably need it too 😉

Please let me know if there is anything I can do to get this merged. Thanks again for this awesome library @drcmda!

@drcmda drcmda merged commit 064d9a3 into pmndrs:master Jun 24, 2020
@drcmda
Copy link
Member

drcmda commented Jun 24, 2020

Thanks, looking good, I will publish later today

@drcmda
Copy link
Member

drcmda commented Jun 24, 2020

@stephencorwin some users have reported that click isnt working on mobile, could you look into this? it probably will affect contextmenu and dlbclick as well ...

@stephencorwin
Copy link
Member Author

stephencorwin commented Jun 24, 2020

some users have reported that click isnt working on mobile

@drcmda I can take a look into it. 👍
My inclination is that the event my be named differently by the browser and/or that the escape hatches for "click" in handlePointer is not handling tap events correctly.

@stephencorwin stephencorwin deleted the extended-click-events branch June 24, 2020 13:51
@stephencorwin
Copy link
Member Author

@drcmda Update: Click + Click-and-hold (ContextMenu) on Mobile seem to work. onClick attached to a mesh works ONLY if there are no click handlers on the <Canvas />. Otherwise it looks like the Canvas eats up that event. onDoubleClick doesn't seem to be supported on mobile. Hopefully that helps.
ezgif-4-10136e2241a7

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