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

Mouse CursorModeCapture broken in WASM #2634

Closed
1 of 10 tasks
harbdog opened this issue Apr 9, 2023 · 2 comments
Closed
1 of 10 tasks

Mouse CursorModeCapture broken in WASM #2634

harbdog opened this issue Apr 9, 2023 · 2 comments
Milestone

Comments

@harbdog
Copy link
Contributor

harbdog commented Apr 9, 2023

Ebitengine Version

2.5

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • OpenBSD
  • Android
  • iOS
  • Nintendo Switch
  • Xbox
  • Web Browsers

Go Version (go version)

1.19.6

What steps will reproduce the problem?

Created an example and gh-pages to host the wasm example in my fork:

https://harbdog.github.io/ebiten/

Branch: wasm_mouse_capture
https://github.com/harbdog/ebiten/tree/wasm_mouse_capture

git checkout wasm_mouse_capture
wasmserve.exe ./examples/capture

It works when not using WASM:

git checkout wasm_mouse_capture
go run ./examples/capture

What is the expected result?

Mouse capture should work in browser the same as it does in desktop application mode.

What happens instead?

The mouse tends to move only in a single direction or jumps around unexpectedly.

Anything else you feel useful to add?

No response

@harbdog
Copy link
Contributor Author

harbdog commented Apr 9, 2023

It seems that using the Escape key to toggle capture may conflict a bit with the browser also using Escape to release capture, that might be the source of some of the weird behavior. So I've updated the example to use Space instead.

While that did at least address some of the weirdness with re-capturing the cursor however, what I noticed was that it still showed only the X mouse movement to register when using Chrome.

However in Edge, it only has Y mouse movement registering.

In Firefox it registers both X and Y mouse movement, but the movement is not smooth, almost "drunk" like by sometimes not moving in the correct direction as expected.

@harbdog
Copy link
Contributor Author

harbdog commented Apr 10, 2023

Thanks @hajimehoshi, confirmed that change fixes the mouse movement as expected in each browser!

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

No branches or pull requests

2 participants