Fix is_zoom_event()
(#1607)
This commit is contained in:
parent
f90895995f
commit
a51232debe
@ -1002,19 +1002,16 @@ def no_arg_trigger(func: Callable) -> Callable:
|
||||
return pyqtSlot()(func) # type: ignore
|
||||
|
||||
|
||||
def is_zoom_event(evt: QEvent) -> bool:
|
||||
"""If the event will trigger zoom.
|
||||
def is_gesture_or_zoom_event(evt: QEvent) -> bool:
|
||||
"""If the event is a gesture and/or will trigger zoom.
|
||||
|
||||
Includes zoom by pinching, Ctrl-scrolling, and Meta-scrolling,
|
||||
where scrolling may be triggered by mouse wheel or gesture.
|
||||
Includes zoom by pinching, and Ctrl-scrolling on Win and Linux.
|
||||
"""
|
||||
|
||||
return isinstance(evt, QNativeGestureEvent) or (
|
||||
isinstance(evt, QWheelEvent)
|
||||
and (
|
||||
(is_mac and KeyboardModifiersPressed().meta)
|
||||
or KeyboardModifiersPressed().control
|
||||
)
|
||||
and not is_mac
|
||||
and KeyboardModifiersPressed().control
|
||||
)
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ from anki.utils import is_lin, is_mac, is_win
|
||||
from aqt import colors, gui_hooks
|
||||
from aqt.qt import *
|
||||
from aqt.theme import theme_manager
|
||||
from aqt.utils import askUser, is_zoom_event, openLink, showInfo, tr
|
||||
from aqt.utils import askUser, is_gesture_or_zoom_event, openLink, showInfo, tr
|
||||
|
||||
serverbaseurl = re.compile(r"^.+:\/\/[^\/]+")
|
||||
|
||||
@ -260,7 +260,7 @@ class AnkiWebView(QWebEngineView):
|
||||
self._disable_zoom = True
|
||||
|
||||
def eventFilter(self, obj: QObject, evt: QEvent) -> bool:
|
||||
if self._disable_zoom and is_zoom_event(evt):
|
||||
if self._disable_zoom and is_gesture_or_zoom_event(evt):
|
||||
return True
|
||||
|
||||
if (
|
||||
|
Loading…
Reference in New Issue
Block a user