Skip to content
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

Add zoom using Ctrl+scroll #313

Merged
merged 6 commits into from
Aug 2, 2021
Merged

Add zoom using Ctrl+scroll #313

merged 6 commits into from
Aug 2, 2021

Conversation

amolenaar
Copy link
Member

@amolenaar amolenaar commented Aug 1, 2021

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes

What is the current behavior?

Zoom with mouse is not really possible.

Issue Number: gaphor/gaphor#877

What is the new behavior?

Zoom works with Ctrl+scroll

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Added:

  • Ctrl + middle mouse button scroll: zoom in
  • Middle mouse button press + move: pan canvas

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Aug 1, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.09%.

Quality metrics Before After Change
Complexity 1.58 ⭐ 1.65 ⭐ 0.07 👎
Method Length 51.33 ⭐ 49.39 ⭐ -1.94 👍
Working memory 6.03 ⭐ 6.21 🙂 0.18 👎
Quality 73.66% 🙂 73.75% 🙂 0.09% 👍
Other metrics Before After Change
Lines 1095 1147 52
Changed files Quality Before Quality After Quality Change
examples/demo.py 70.67% 🙂 70.60% 🙂 -0.07% 👎
examples/demo4.py 71.36% 🙂 71.35% 🙂 -0.01% 👎
gaphas/tool/init.py % % %
gaphas/tool/scroll.py 85.70% ⭐ 74.18% 🙂 -11.52% 👎
gaphas/tool/zoom.py 78.75% ⭐ 82.51% ⭐ 3.76% 👍
tests/test_tool_zoom.py 92.64% ⭐ 92.59% ⭐ -0.05% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
examples/demo.py create_window 4 ⭐ 655 ⛔ 9 🙂 47.92% 😞 Try splitting into smaller methods
examples/demo4.py create_window 4 ⭐ 640 ⛔ 9 🙂 47.93% 😞 Try splitting into smaller methods
gaphas/tool/scroll.py on_scroll 6 ⭐ 126 😞 15 😞 51.83% 🙂 Try splitting into smaller methods. Extract out complex expressions
examples/demo.py create_canvas 1 ⭐ 221 ⛔ 6 ⭐ 65.03% 🙂 Try splitting into smaller methods
examples/demo4.py create_canvas 1 ⭐ 221 ⛔ 6 ⭐ 65.03% 🙂 Try splitting into smaller methods

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

Copy link
Member

@danyeaw danyeaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, nice feature to add 👍

@danyeaw danyeaw merged commit 73bfc96 into master Aug 2, 2021
@danyeaw danyeaw deleted the mouse-zoom branch August 2, 2021 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants