ui: Bug fix: timer condition was wrong

This commit is contained in:
Hajime Hoshi 2018-10-02 02:53:17 +09:00
parent bf850e12a4
commit 78f2946797

View File

@ -546,7 +546,10 @@ func (u *userInterface) getScale() float64 {
func (u *userInterface) actualScreenScale() float64 {
n := time.Now().UnixNano()
// As devicescale.DeviceScale accesses OS API, not call this too often.
if u.deviceScale == 0 || n-u.deviceScaleUpdated < int64(time.Second/2) {
//
// TODO: This function might return different values in one frame. Instead of using time, can we use frames
// or tick?
if u.deviceScale == 0 || n-u.deviceScaleUpdated > int64(time.Second/4) {
u.deviceScale = devicescale.DeviceScale()
u.deviceScaleUpdated = n
}