From b2870dcd7f78820ddc54bfc43eae34d8fcfd5421 Mon Sep 17 00:00:00 2001 From: Akshara Balachandra Date: Fri, 2 Oct 2020 17:46:57 -0400 Subject: [PATCH] fix: sizing issue with scale UI Fixes ankitects/help-wanted#18. Height of webview should be the height of the contents inside it. Previously, scale factors increased fixed height of the container webview, thus creating empty space (e.g. at 200% scaling, height of webview was double the height of the inner HTML page). Now height of webview is always the height of the contained element. --- CONTRIBUTORS | 1 + qt/aqt/webview.py | 8 +------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index b36c6b209..f4f93eb2a 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -60,6 +60,7 @@ phwoo Soren Bjornstad Aleksa Sarai Jakub Kaczmarzyk +Akshara Balachandra ******************** diff --git a/qt/aqt/webview.py b/qt/aqt/webview.py index 2d012965e..ea4b37844 100644 --- a/qt/aqt/webview.py +++ b/qt/aqt/webview.py @@ -4,7 +4,6 @@ import dataclasses import json -import math import re import sys from typing import Any, Callable, List, Optional, Sequence, Tuple @@ -580,12 +579,7 @@ body {{ zoom: {zoom}; background: {background}; direction: {lang_dir}; {font} }} mw.progress.timer(1000, mw.reset, False) return - scaleFactor = self.zoomFactor() - if scaleFactor == 1: - scaleFactor = mw.pm.uiScale() - - height = math.ceil(qvar * scaleFactor) - self.setFixedHeight(height) + self.setFixedHeight(qvar) def set_bridge_command(self, func: Callable[[str], Any], context: Any) -> None: """Set a handler for pycmd() messages received from Javascript.