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

Support both touch and mouse on same target platform (touch for Web Assembly target) #17

Merged
merged 2 commits into from
Jan 26, 2024

Conversation

clinuxrulz
Copy link
Contributor

Hi @SergioRibera,

This is a suggestion for allowing touch events from the mobile browser for the Web Assembly target.
On touch screen laptops, they can use either touch or mouse.

  • When touch is interacting with joystick, mouse events are ignored until touch interaction stops.
  • When mouse is interacting with joystick, touch events are ignored until mouse interaction stops.

This is ready for merge if you are happy with the solution.

@clinuxrulz
Copy link
Contributor Author

Also the mobile web browser will emulate some mouse events from touch events. The filtering of events stop event double up for the browser target.

Copy link
Owner

@SergioRibera SergioRibera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm loving this PR because it's something I've been planning to do for a while, let me know what you think about the comment I made in the review or if you can think of any other case for which the enum could be useful

src/input.rs Outdated Show resolved Hide resolved
@SergioRibera
Copy link
Owner

SergioRibera commented Jan 26, 2024

And one last favor, run a cargo fmt --all to fix the IC problems so we can unify the PR

@clinuxrulz
Copy link
Contributor Author

Thank you for having a look. I agree with your comment. enum TouchOrMouse is now just is_mouse: bool.

@SergioRibera
Copy link
Owner

Thank you very much for the changes, right now I'm unifying the changes, I don't think I will release a new version soon, so I recommend you to use the dependency from github and in the main branch until I release a new version, on the other hand I invite you to continue contributing to the project :D

@SergioRibera SergioRibera merged commit 0e8b924 into SergioRibera:main Jan 26, 2024
2 checks passed
@clinuxrulz clinuxrulz deleted the wasm-touch-v2 branch January 27, 2024 00:26
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