mirror of
https://github.com/godotengine/godot.git
synced 2024-12-15 10:12:40 +08:00
Merge pull request #45670 from Faless/js/4.x_canvas_id_fix
[HTML5] Fix mouse_mode and fullscreen detection.
This commit is contained in:
commit
3cecf11bb6
@ -93,7 +93,7 @@ EM_BOOL DisplayServerJavaScript::fullscreen_change_callback(int p_event_type, co
|
||||
DisplayServerJavaScript *display = get_singleton();
|
||||
// Empty ID is canvas.
|
||||
String target_id = String::utf8(p_event->id);
|
||||
if (target_id.is_empty() || target_id == String::utf8(display->canvas_id)) {
|
||||
if (target_id.is_empty() || target_id == String::utf8(&(display->canvas_id[1]))) {
|
||||
// This event property is the only reliable data on
|
||||
// browser fullscreen state.
|
||||
if (p_event->isFullscreen) {
|
||||
@ -455,7 +455,7 @@ DisplayServer::MouseMode DisplayServerJavaScript::mouse_get_mode() const {
|
||||
|
||||
EmscriptenPointerlockChangeEvent ev;
|
||||
emscripten_get_pointerlock_status(&ev);
|
||||
return (ev.isActive && String::utf8(ev.id) == String::utf8(canvas_id)) ? MOUSE_MODE_CAPTURED : MOUSE_MODE_VISIBLE;
|
||||
return (ev.isActive && String::utf8(ev.id) == String::utf8(&canvas_id[1])) ? MOUSE_MODE_CAPTURED : MOUSE_MODE_VISIBLE;
|
||||
}
|
||||
|
||||
// Wheel
|
||||
|
Loading…
Reference in New Issue
Block a user