mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/uidriver/js: Refactoring
This commit is contained in:
parent
ead84553a0
commit
20705d63a3
@ -150,6 +150,9 @@ func (u *UserInterface) SetCursorMode(mode driver.CursorMode) {
|
||||
}
|
||||
|
||||
func (u *UserInterface) recoverCursorMode() {
|
||||
if theUI.cursorPrevMode == driver.CursorModeCaptured {
|
||||
panic("js: cursorPrevMode must not be driver.CursorModeCaptured at recoverCursorMode")
|
||||
}
|
||||
u.SetCursorMode(u.cursorPrevMode)
|
||||
}
|
||||
|
||||
@ -388,9 +391,6 @@ func init() {
|
||||
|
||||
// A user can exit the pointer lock by pressing ESC. In this case, sync the cursor mode state.
|
||||
if theUI.cursorMode == driver.CursorModeCaptured {
|
||||
if theUI.cursorPrevMode == driver.CursorModeCaptured {
|
||||
panic("js: cursorPrevMode must not be driver.CursorModeCaptured")
|
||||
}
|
||||
theUI.recoverCursorMode()
|
||||
}
|
||||
theUI.input.recoverCursorPosition()
|
||||
|
Loading…
Reference in New Issue
Block a user