ソースを参照

Reworked web scaling to work with both letterbox aspects

Dom Crayford 9 年 前
コミット
2415edb675
1 ファイル変更12 行追加15 行削除
  1. 12 15
      src/ui/webview.qml

+ 12 - 15
src/ui/webview.qml

@@ -45,24 +45,21 @@ KonvergoWindow
     transformOrigin: Item.TopLeft
     scale:
     {
-      var aheight = (width * 9) / 16;
+      var verticalScale = height / 720;
+      var horizontalScale = width / 1280;
 
-      // handle underscale, 720 is the minimum scale of the webclient.
-      if (aheight < 720)
-      {
-        return aheight / 720;
-      }
-
-      if (webMaxHeight == 0)
-        return 1;
+      var desiredScale = Math.min(verticalScale, horizontalScale);
+      var maximumScale = webMaxHeight ? (webMaxHeight / 720) : 10;
 
-      if (aheight > webMaxHeight)
-      {
-        return aheight / webMaxHeight;
-      }
-      else
-      {
+      if (desiredScale < 1) {
+        // Web renders at 1:1, so scale down
+        return desiredScale;
+      } else if (desiredScale < maximumScale) {
+        // Web renders at windows scale, no scaling
         return 1;
+      } else {
+        // Web should max out at maximum scaling
+        return desiredScale / maximumScale;
       }
     }