-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENH] Canvas: Add zoom #2841
[ENH] Canvas: Add zoom #2841
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2841 +/- ##
==========================================
- Coverage 81.91% 81.72% -0.19%
==========================================
Files 326 326
Lines 55997 55700 -297
==========================================
- Hits 45868 45523 -345
- Misses 10129 10177 +48 |
@ales-erjavec, can you take a quick look? |
Orange/canvas/canvas/view.py
Outdated
@@ -2,10 +2,11 @@ | |||
Canvas Graphics View | |||
""" | |||
import logging | |||
from math import floor, copysign |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
floor is unused
Orange/canvas/canvas/view.py
Outdated
def wheelEvent(self, event: QWheelEvent): | ||
# use mouse position as anchor while zooming | ||
self.setTransformationAnchor(2) | ||
if event.modifiers() & Qt.ControlModifier: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... and event.buttons() == Qt.NoButtons:
Orange/canvas/canvas/view.py
Outdated
if event.modifiers() & Qt.ControlModifier: | ||
delta = event.angleDelta().y() | ||
if QT_VERSION >= 0x050300 \ | ||
and event.source() != Qt.MouseEventNotSynthesized \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http://doc.qt.io/qt-5/qwheelevent.html#source says it was introduced in Qt 5.5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this to 0x050500. The documentation for the corresponding enum says that the enum exists from 5.3. I don't know how would you get the source then.
Issue
Zooming is currently rather rigid. There is also no zooming out.
Description of changes
Add zooming by ⌘+scroll; zooming is continuous on trackpads, and discrete with mouse.
Add zooming by ⌘+ and ⌘- ,and reset by ⌘0.
Remove the zoom toggle button from the toolbar.
Includes