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

Adds keyboard shortcuts for panning and zooming on a focused view #3832

Merged
merged 8 commits into from
Aug 29, 2023

Conversation

carolinebridge
Copy link
Contributor

Adds keyboard shortcuts for:

Scroll with LeftArrow and RightArrow
Zoom with Shift + (UpArrow || DownArrow)

  • put the event listener in the AppFocus mixin, wondering if that's the best place for it
  • not sure if I like shift + arrow for zoom, I think ctrl/cmd is more intuitive but would like to hear thoughts

Waiting for the focus PR to be merged before this one into main

Partially resolves #927

@carolinebridge carolinebridge added the enhancement New feature or request label Aug 1, 2023
@carolinebridge carolinebridge self-assigned this Aug 1, 2023
@codecov
Copy link

codecov bot commented Aug 1, 2023

Codecov Report

Merging #3832 (4da760a) into main (6fb9daa) will increase coverage by 0.02%.
Report is 8 commits behind head on main.
The diff coverage is 52.94%.

@@            Coverage Diff             @@
##             main    #3832      +/-   ##
==========================================
+ Coverage   64.45%   64.47%   +0.02%     
==========================================
  Files        1003     1003              
  Lines       29782    29799      +17     
  Branches     7146     7151       +5     
==========================================
+ Hits        19196    19213      +17     
  Misses      10423    10423              
  Partials      163      163              
Files Changed Coverage Δ
...s/linear-genome-view/src/LinearGenomeView/model.ts 83.16% <52.94%> (-1.10%) ⬇️

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@carolinebridge carolinebridge changed the title adds keyb shortcuts for panning and zooming Adds keyboard shortcuts for panning and zooming on a focused view Aug 1, 2023
Base automatically changed from add-focus-view to main August 13, 2023 16:43
@carolinebridge carolinebridge marked this pull request as ready for review August 14, 2023 15:52
@garrettjstevens
Copy link
Collaborator

I think ctrl+up/down is more intuitive for zoom than shift.

I noticed that if the side widget has a horizontal scroll and is in focus from a browser perspective (not from a JBrowse perspective) the left/right will also scroll the widget.

widget_scroll

@cmdcolin
Copy link
Collaborator

cmdcolin commented Aug 24, 2023

i might agree with ctrl+up/down because we have ctrl+scroll for zoom too

@carolinebridge
Copy link
Contributor Author

Added ctrl/meta keys to the left and right operations --

  • consistent with the other nav operations
  • allows the user to still scroll up and down on widgets / in the main views container if they wish if they use the arrows without pressing ctrl/meta
  • deeply nested preventDefault so if the user has the view in focus it doesn't override the default for every keystroke (e.g. cmd + r for refresh would be overridden if it was one level outside of where i placed it)

@cmdcolin cmdcolin force-pushed the add-keyboard-shortcuts branch from 4da760a to f372736 Compare August 29, 2023 14:26
@cmdcolin
Copy link
Collaborator

I added a 'removeEventHandler' using an addDisposer. I think should be good to go. it is a little tricky, becuase I was pressing "ctrl+down" multiple times but it would not zoom out a lot. that is because it is actively doing an animation. it may be good to find a workaround for this...i think it would be good to 'quickly zoom out' a multiple rapid ctrl+down key presses.

@cmdcolin
Copy link
Collaborator

might not be necessary to hold up the PR though. can merge :)

@cmdcolin cmdcolin merged commit cc606dd into main Aug 29, 2023
@cmdcolin cmdcolin deleted the add-keyboard-shortcuts branch August 29, 2023 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add keyboard shortcuts
3 participants