Skip to content

janhohenheim/bevy_fix_cursor_unlock_web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fix Cursor Unlock on Web

crates.io docs.rs

A tiny plugin that fixes Bevy not reporting when the cursor is unlocked on web

Usage

Just add the plugin, that's it:

use bevy::prelude::*;
use bevy_fix_cursor_unlock_web::prelude::*;

App::new()
  .add_plugins(DefaultPlugins)
  .add_plugins(FixPointerUnlockPlugin);

Now, Window::cursor_options::grab_mode is automatically set to CursorGrabMode::None for you when unlocking the cursor on web. This fixes bevyengine/bevy#8949

If you want to detect when a cursor was force freed, e.g. when the user presses escape, you can observe the ForceUnlockCursor event. Note that Bevy does not forward the "Escape" key press in this case.

Compatibility

bevy bevy_fix_cursor_unlock_web
0.18 0.3
0.17 0.2
0.16 0.1

About

A tiny plugin that fixes Bevy not reporting when the cursor is unlocked on web

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
license-apache.txt
MIT
license-mit.txt

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages