internal/ui: refactoring: remove sizeChanged for js

It is safe to call Layout every frame.
This commit is contained in:
Hajime Hoshi 2022-02-14 02:50:32 +09:00
parent e2f0878a4c
commit cffa123405

View File

@ -57,8 +57,6 @@ type UserInterface struct {
cursorShape CursorShape cursorShape CursorShape
onceUpdateCalled bool onceUpdateCalled bool
sizeChanged bool
lastDeviceScaleFactor float64 lastDeviceScaleFactor float64
context *contextImpl context *contextImpl
@ -67,7 +65,6 @@ type UserInterface struct {
var theUI = &UserInterface{ var theUI = &UserInterface{
runnableOnUnfocused: true, runnableOnUnfocused: true,
sizeChanged: true,
initFocused: true, initFocused: true,
} }
@ -229,8 +226,6 @@ func (u *UserInterface) updateSize() {
} }
u.lastDeviceScaleFactor = a u.lastDeviceScaleFactor = a
if u.sizeChanged {
u.sizeChanged = false
switch { switch {
case document.Truthy(): case document.Truthy():
body := document.Get("body") body := document.Get("body")
@ -246,7 +241,6 @@ func (u *UserInterface) updateSize() {
u.context.layout(640, 480) u.context.layout(640, 480)
} }
} }
}
func (u *UserInterface) suspended() bool { func (u *UserInterface) suspended() bool {
if u.runnableOnUnfocused { if u.runnableOnUnfocused {
@ -611,7 +605,6 @@ func (u *UserInterface) updateScreenSize() {
case go2cpp.Truthy(): case go2cpp.Truthy():
// TODO: Implement this // TODO: Implement this
} }
u.sizeChanged = true
} }
func (u *UserInterface) SetScreenTransparent(transparent bool) { func (u *UserInterface) SetScreenTransparent(transparent bool) {