From 402e1a251a27245bace703652c303d8881647029 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 21 Mar 2021 16:40:35 +0900 Subject: [PATCH] internal/uidriver/js: Bug fix: CursorMode didn't work on go2cpp --- internal/uidriver/js/ui_js.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/uidriver/js/ui_js.go b/internal/uidriver/js/ui_js.go index d8cfba012..2e77ab18f 100644 --- a/internal/uidriver/js/ui_js.go +++ b/internal/uidriver/js/ui_js.go @@ -103,6 +103,10 @@ func (u *UserInterface) IsVsyncEnabled() bool { } func (u *UserInterface) CursorMode() driver.CursorMode { + if !canvas.Truthy() { + return driver.CursorModeHidden + } + if jsutil.Equal(canvas.Get("style").Get("cursor"), stringNone) { return driver.CursorModeVisible } @@ -110,6 +114,10 @@ func (u *UserInterface) CursorMode() driver.CursorMode { } func (u *UserInterface) SetCursorMode(mode driver.CursorMode) { + if !canvas.Truthy() { + return + } + var visible bool switch mode { case driver.CursorModeVisible: