diff --git a/internal/uidriver/mobile/ui.go b/internal/uidriver/mobile/ui.go index a98f28f87..53abfb9bc 100644 --- a/internal/uidriver/mobile/ui.go +++ b/internal/uidriver/mobile/ui.go @@ -105,17 +105,14 @@ type UserInterface struct { } var ( - deviceScaleVal float64 - deviceScaleM sync.Mutex + deviceScaleVal float64 + deviceScaleOnce sync.Once ) func getDeviceScale() float64 { - deviceScaleM.Lock() - defer deviceScaleM.Unlock() - - if deviceScaleVal == 0 { + deviceScaleOnce.Do(func() { deviceScaleVal = devicescale.GetAt(0, 0) - } + }) return deviceScaleVal }