internal/uidriver/js: Bug fix: CursorMode didn't work on go2cpp

This commit is contained in:
Hajime Hoshi 2021-03-21 16:40:35 +09:00
parent 41f060b1d2
commit 402e1a251a

View File

@ -103,6 +103,10 @@ func (u *UserInterface) IsVsyncEnabled() bool {
} }
func (u *UserInterface) CursorMode() driver.CursorMode { func (u *UserInterface) CursorMode() driver.CursorMode {
if !canvas.Truthy() {
return driver.CursorModeHidden
}
if jsutil.Equal(canvas.Get("style").Get("cursor"), stringNone) { if jsutil.Equal(canvas.Get("style").Get("cursor"), stringNone) {
return driver.CursorModeVisible return driver.CursorModeVisible
} }
@ -110,6 +114,10 @@ func (u *UserInterface) CursorMode() driver.CursorMode {
} }
func (u *UserInterface) SetCursorMode(mode driver.CursorMode) { func (u *UserInterface) SetCursorMode(mode driver.CursorMode) {
if !canvas.Truthy() {
return
}
var visible bool var visible bool
switch mode { switch mode {
case driver.CursorModeVisible: case driver.CursorModeVisible: