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

feat: Include command/control-0 for OriginalSize in StandardKeyBindings #220

Merged
merged 1 commit into from
Aug 17, 2024

Conversation

psobolewskiPhD
Copy link
Contributor

I just discovered the very cool StandardKeyBindings while adding Zoom keybindings in napari.
In this PR I'm just adding the command/control-0 to reset zoom as a standard keybinding, sometimes called OriginalSize (Qt), Actual Size (macOS), etc. but a consistent pattern on macOS and Windows and in Qt (https://doc.qt.io/qtcreator/creator-keyboard-shortcuts.html#image-viewer-shortcuts).

Copy link

codecov bot commented Aug 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4afa6f6) to head (1c1c4ea).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #220   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           31        31           
  Lines         1870      1871    +1     
=========================================
+ Hits          1870      1871    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@tlambert03 tlambert03 left a comment

Choose a reason for hiding this comment

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

@tlambert03 tlambert03 merged commit b7cd0d5 into pyapp-kit:main Aug 17, 2024
36 checks passed
@DragaDoncila
Copy link
Contributor

@tlambert03 it would be nice to have this PR released so we can merge a related PR in napari. Any chance of an app-model release soonish?

@tlambert03 tlambert03 added the enhancement New feature or request label Sep 17, 2024
@tlambert03
Copy link
Member

just pushed v0.3.0, lemme know if the release fails for any reason

jni pushed a commit to napari/napari that referenced this pull request Sep 23, 2024
# References and relevant issues

Closes #4855

# Description

This PR adds menu items and "standard keybindings" for Zoom in, Zoom
out, and Reset Zoom to the View menu.
The keybindings are Qt defaults
(https://doc.qt.io/qtcreator/creator-keyboard-shortcuts.html#image-viewer-shortcuts),
as well as defaults on macOS and Windows (see e.g. Adobe Photoshop or
Chrome)
Note: I've made a PR to app-model to add the Reset Zoom standard
keybinding (pyapp-kit/app-model#220) so if that
is merged I can edit this PR to use that here too!

I added to a test for the new behavior.

Note, this approach does not present these as editable in the napari
Preferences. I
These are bound like an OS default would be, e.g. copy, paste, etc. They
are editable on the OS level at least on macOS.

---------

Co-authored-by: Grzegorz Bokota <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants