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.
This commit is contained in:
Akshara Balachandra 2020-10-02 17:46:57 -04:00
parent 53a984ba15
commit b2870dcd7f
2 changed files with 2 additions and 7 deletions

View file

@ -60,6 +60,7 @@ phwoo <github.com/phwoo>
Soren Bjornstad <anki@sorenbjornstad.com> Soren Bjornstad <anki@sorenbjornstad.com>
Aleksa Sarai <cyphar@cyphar.com> Aleksa Sarai <cyphar@cyphar.com>
Jakub Kaczmarzyk <jakub.kaczmarzyk@gmail.com> Jakub Kaczmarzyk <jakub.kaczmarzyk@gmail.com>
Akshara Balachandra <akshara.bala.18@gmail.com>
******************** ********************

View file

@ -4,7 +4,6 @@
import dataclasses import dataclasses
import json import json
import math
import re import re
import sys import sys
from typing import Any, Callable, List, Optional, Sequence, Tuple 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) mw.progress.timer(1000, mw.reset, False)
return return
scaleFactor = self.zoomFactor() self.setFixedHeight(qvar)
if scaleFactor == 1:
scaleFactor = mw.pm.uiScale()
height = math.ceil(qvar * scaleFactor)
self.setFixedHeight(height)
def set_bridge_command(self, func: Callable[[str], Any], context: Any) -> None: def set_bridge_command(self, func: Callable[[str], Any], context: Any) -> None:
"""Set a handler for pycmd() messages received from Javascript. """Set a handler for pycmd() messages received from Javascript.