mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
Fix top toolbar getting huge when switching modes
The issue was caused by the min-height hack to align the background images. A call to web.adjustHeightToFit would set the toolbar to the same height as the main webview, as the function makes use of document.offsetHeight.
This commit is contained in:
parent
9449c9bcb2
commit
7327f77dec
1 changed files with 5 additions and 2 deletions
|
@ -153,7 +153,6 @@ class TopWebView(ToolbarWebView):
|
||||||
f"""document.body.style.setProperty("background-position-y", "-{self.web_height}px"); """
|
f"""document.body.style.setProperty("background-position-y", "-{self.web_height}px"); """
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
self.mw.web.evalWithCallback(
|
self.mw.web.evalWithCallback(
|
||||||
"""window.getComputedStyle(document.body).background; """,
|
"""window.getComputedStyle(document.body).background; """,
|
||||||
set_background,
|
set_background,
|
||||||
|
@ -163,7 +162,11 @@ class TopWebView(ToolbarWebView):
|
||||||
self.eval(
|
self.eval(
|
||||||
f"""document.body.style.setProperty("min-height", "{self.mw.web.height()}px"); """
|
f"""document.body.style.setProperty("min-height", "{self.mw.web.height()}px"); """
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def adjustHeightToFit(self) -> None:
|
||||||
|
self.eval("""document.body.style.setProperty("min-height", "0px"); """)
|
||||||
|
self.evalWithCallback("document.documentElement.offsetHeight", self._onHeight)
|
||||||
|
|
||||||
def resizeEvent(self, event: QResizeEvent) -> None:
|
def resizeEvent(self, event: QResizeEvent) -> None:
|
||||||
super().resizeEvent(event)
|
super().resizeEvent(event)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue