Skip to content

Commit

Permalink
internal/ui: bug fix: recover the cursor mode when capturing fails
Browse files Browse the repository at this point in the history
  • Loading branch information
hajimehoshi committed Sep 15, 2024
1 parent 429e0d8 commit 6f3f567
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/ui/ui_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,10 @@ func (u *UserInterface) init() error {
}))
document.Call("addEventListener", "pointerlockerror", js.FuncOf(func(this js.Value, args []js.Value) any {
js.Global().Get("console").Call("error", "pointerlockerror event is fired. 'sandbox=\"allow-pointer-lock\"' might be required at an iframe. This function on browsers must be called as a result of a gestural interaction or orientation change.")
if u.cursorMode == CursorModeCaptured {
u.recoverCursorMode()
}
u.recoverCursorPosition()
return nil
}))
document.Call("addEventListener", "fullscreenerror", js.FuncOf(func(this js.Value, args []js.Value) any {
Expand Down

0 comments on commit 6f3f567

Please sign in to comment.