mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Possible workaround for toolbar height issue
https://forums.ankiweb.net/t/anki-24-04-beta-rc/41792/125
This commit is contained in:
parent
22559929f9
commit
67062da924
1 changed files with 6 additions and 4 deletions
|
@ -88,7 +88,8 @@ class TopWebView(ToolbarWebView):
|
||||||
|
|
||||||
def _onHeight(self, qvar: Optional[int]) -> None:
|
def _onHeight(self, qvar: Optional[int]) -> None:
|
||||||
super()._onHeight(qvar)
|
super()._onHeight(qvar)
|
||||||
self.web_height = int(qvar)
|
if qvar:
|
||||||
|
self.web_height = int(qvar)
|
||||||
|
|
||||||
def hide_if_allowed(self) -> None:
|
def hide_if_allowed(self) -> None:
|
||||||
if self.mw.state != "review":
|
if self.mw.state != "review":
|
||||||
|
@ -151,9 +152,10 @@ class TopWebView(ToolbarWebView):
|
||||||
self.set_body_height(self.mw.web.height())
|
self.set_body_height(self.mw.web.height())
|
||||||
|
|
||||||
# offset reviewer background by toolbar height
|
# offset reviewer background by toolbar height
|
||||||
self.mw.web.eval(
|
if self.web_height:
|
||||||
f"""document.body.style.setProperty("background-position-y", "-{self.web_height}px"); """
|
self.mw.web.eval(
|
||||||
)
|
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; """,
|
||||||
|
|
Loading…
Reference in a new issue