mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Fix is_zoom_event()
(#1607)
This commit is contained in:
parent
f90895995f
commit
a51232debe
2 changed files with 7 additions and 10 deletions
|
@ -1002,19 +1002,16 @@ def no_arg_trigger(func: Callable) -> Callable:
|
||||||
return pyqtSlot()(func) # type: ignore
|
return pyqtSlot()(func) # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def is_zoom_event(evt: QEvent) -> bool:
|
def is_gesture_or_zoom_event(evt: QEvent) -> bool:
|
||||||
"""If the event will trigger zoom.
|
"""If the event is a gesture and/or will trigger zoom.
|
||||||
|
|
||||||
Includes zoom by pinching, Ctrl-scrolling, and Meta-scrolling,
|
Includes zoom by pinching, and Ctrl-scrolling on Win and Linux.
|
||||||
where scrolling may be triggered by mouse wheel or gesture.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return isinstance(evt, QNativeGestureEvent) or (
|
return isinstance(evt, QNativeGestureEvent) or (
|
||||||
isinstance(evt, QWheelEvent)
|
isinstance(evt, QWheelEvent)
|
||||||
and (
|
and not is_mac
|
||||||
(is_mac and KeyboardModifiersPressed().meta)
|
and KeyboardModifiersPressed().control
|
||||||
or KeyboardModifiersPressed().control
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ from anki.utils import is_lin, is_mac, is_win
|
||||||
from aqt import colors, gui_hooks
|
from aqt import colors, gui_hooks
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
from aqt.theme import theme_manager
|
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"^.+:\/\/[^\/]+")
|
serverbaseurl = re.compile(r"^.+:\/\/[^\/]+")
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ class AnkiWebView(QWebEngineView):
|
||||||
self._disable_zoom = True
|
self._disable_zoom = True
|
||||||
|
|
||||||
def eventFilter(self, obj: QObject, evt: QEvent) -> bool:
|
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
|
return True
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Reference in a new issue