From 989ae1ebc5f0ef926cf9104c269cbe5be9021090 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 19 Jun 2016 05:14:02 +0900 Subject: [PATCH] ui: Fix deviceScale for mobiles --- internal/ui/ui_android.go | 2 +- internal/ui/ui_ios.go | 4 ++-- internal/ui/ui_linux.go | 1 + internal/ui/ui_mobile.go | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/ui/ui_android.go b/internal/ui/ui_android.go index 565c9a7a7..6ce7dd827 100644 --- a/internal/ui/ui_android.go +++ b/internal/ui/ui_android.go @@ -14,6 +14,6 @@ package ui -func deviceScale() int { +func deviceScale() float64 { return 1 } diff --git a/internal/ui/ui_ios.go b/internal/ui/ui_ios.go index 52a059e70..ac34ecc9d 100644 --- a/internal/ui/ui_ios.go +++ b/internal/ui/ui_ios.go @@ -26,6 +26,6 @@ package ui // } import "C" -func deviceScale() int { - return int(C.devicePixelRatio()) +func deviceScale() float64 { + return float64(C.devicePixelRatio()) } diff --git a/internal/ui/ui_linux.go b/internal/ui/ui_linux.go index 373d29289..ab602eb32 100644 --- a/internal/ui/ui_linux.go +++ b/internal/ui/ui_linux.go @@ -13,6 +13,7 @@ // limitations under the License. // +build !js +// +build !android package ui diff --git a/internal/ui/ui_mobile.go b/internal/ui/ui_mobile.go index 38dd2752b..f842456d5 100644 --- a/internal/ui/ui_mobile.go +++ b/internal/ui/ui_mobile.go @@ -145,7 +145,7 @@ func (u *userInterface) ScreenScale() int { } func (u *userInterface) actualScreenScale() int { - return u.scale * deviceScale() + return u.scale * int(deviceScale()) } func UpdateTouches(touches []Touch) {