Page MenuHome

Add jump to top and bottom operator in view panning
Needs ReviewPublic

Authored by Himanshi Kalra (calra) on Aug 31 2021, 11:53 AM.

Details

Reviewers
Jacques Lucke (JacquesLucke)
Group Reviewers
User Interface
Summary

Useful for jumping to top or bottom in Spreadsheet Editor and
Outliner.
Shortcut on Windows:

  • Top - Shift + Home
  • Bottom - Shift+End

Shortcut on Mac:

  • Top - Fn + Shift + Left Arrow Key
  • Bottom - Fn + Shift + Right Arrow Key

View2D Reset at times fulfills the purpose of Jump to Top, but having a dedicated operator
for this is good.

Diff Detail

Repository
rB Blender
Branch
spreadsheet_ops (branched from master)
Build Status
Buildable 16783
Build 16783: arc lint + arc unit

Event Timeline

Himanshi Kalra (calra) requested review of this revision.Aug 31 2021, 11:53 AM
Himanshi Kalra (calra) created this revision.
  • Added the complementary jump to top operator.
  • Updated keymap for both - top and bottom
Himanshi Kalra (calra) retitled this revision from Add jump to end operator in view panning to Add jump to top and bottom operator in view panning.Aug 31 2021, 5:36 PM
Himanshi Kalra (calra) edited the summary of this revision. (Show Details)
Himanshi Kalra (calra) edited the summary of this revision. (Show Details)
  • Update comment style to newer version
Jacques Lucke (JacquesLucke) requested changes to this revision.Sep 2 2021, 1:12 PM
Jacques Lucke (JacquesLucke) added inline comments.
release/scripts/presets/keyconfig/keymap_data/blender_default.py
647

Some lines have trailing whitespace, please configure your editor so that it removes trailing whitespace automatically.

691

Do the shortcuts work for you? They don't seem to work for me.

source/blender/editors/interface/view2d_ops.c
584

Declare variables where they are used.

645
/home/jacques/blender-git/blender/source/blender/editors/interface/view2d_ops.c: In function ‘scroll_to_top_exec’:
/home/jacques/blender-git/blender/source/blender/editors/interface/view2d_ops.c:597:21: warning: using integer absolute value function ‘abs’ when argument is of floating-point type ‘float’ [-Wabsolute-value]
  597 |   int scroll_diff = abs(v2d->cur.ymax - v2d->tot.ymax);
      |                     ^~~
/home/jacques/blender-git/blender/source/blender/editors/interface/view2d_ops.c: In function ‘scroll_to_bottom_exec’:
/home/jacques/blender-git/blender/source/blender/editors/interface/view2d_ops.c:645:21: warning: using integer absolute value function ‘abs’ when argument is of floating-point type ‘float’ [-Wabsolute-value]
  645 |   int scroll_diff = abs(v2d->cur.ymin - v2d->tot.ymin);
      |                     ^~~

You may want to use fabsf.

674

What is the purpose of the page property?

This revision now requires changes to proceed.Sep 2 2021, 1:12 PM
Himanshi Kalra (calra) marked 2 inline comments as done.
  • Merge branch 'master' into spreadsheet_ops
  • Addressed comments
  • Removed the page property from keymap as well
release/scripts/presets/keyconfig/keymap_data/blender_default.py
691

Yes they do. Note, its Shift + Home and Shift + End.

source/blender/editors/interface/view2d_ops.c
584

Was trying to be consistent with the surrounding code.

674

Removed. The page property is not needed here. Could in the future be page_top and page_bottom. If a mouse clicks outside the scrollbar on the empty are but on the scroll line. The scrollbar moves up or down by one "page" (some fixed amount).

Himanshi Kalra (calra) marked an inline comment as done.Sep 2 2021, 5:35 PM
  • Fix missing brackets
  • Cleanup and fixes

Seems to work well for me. Will add the interface module as a blocking review, because this adds something to the keymap.

Is there a reason to use shift-home and shift-end rather than not including shift in the shortcut?

Is there a reason to use shift-home and shift-end rather than not including shift in the shortcut?

yes, Home key is used by View2D Zoom reset operator.

This does not work correctly in the Node or Graph editor.

"Jump to the first value of the list"

The description needs to be improved. What is the "value of the list"?

Himanshi Kalra (calra) edited the summary of this revision. (Show Details)Feb 19 2022, 5:32 PM

This does not work correctly in the Node or Graph editor.

Yes it doesn't work in the Node or Graph Editor. It has been tested on Outliner and Spreadsheet Editor as mentioned in the description.

"Jump to the first value of the list"

The description needs to be improved. What is the "value of the list"?

@Yevgeny Makarov (jenkm)
By list I intended to mean - a collection of objects arranged in a an ordered way.
Do you have suggestions ?
I am thinking of the following alternative text.

  • Jump to the first value
  • Jump to Top/Jump to Bottom
  • Jump to the first value of the region

Rebasing to latest master