Added applyCursorVisibility()
This commit is contained in:
parent
3f65b2c0c8
commit
bca31f0d7a
pixelgl
|
@ -324,13 +324,17 @@ func (w *Window) SetCursorVisible(visible bool) {
|
|||
if !w.cursorDisabled {
|
||||
w.cursorVisible = visible
|
||||
mainthread.Call(func() {
|
||||
if visible {
|
||||
w.applyCursorVisibility()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (w *Window) applyCursorVisibility() {
|
||||
if w.cursorVisible {
|
||||
w.window.SetInputMode(glfw.CursorMode, glfw.CursorNormal)
|
||||
} else {
|
||||
w.window.SetInputMode(glfw.CursorMode, glfw.CursorHidden)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// CursorVisible returns the visibility status of the mouse cursor.
|
||||
|
@ -346,11 +350,7 @@ func (w *Window) SetCursorDisabled(disabled bool) {
|
|||
w.cursorVisible = false
|
||||
w.window.SetInputMode(glfw.CursorMode, glfw.CursorDisabled)
|
||||
} else {
|
||||
if w.cursorVisible {
|
||||
w.window.SetInputMode(glfw.CursorMode, glfw.CursorNormal)
|
||||
} else {
|
||||
w.window.SetInputMode(glfw.CursorMode, glfw.CursorHidden)
|
||||
}
|
||||
w.applyCursorVisibility()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue