Page MenuHome

Text Editor: Add smooth scrolling
Needs ReviewPublic

Authored by Kai Jægersen (kaio) on Mon, Sep 23, 4:33 PM.
Tags
None
Tokens
"Like" token, awarded by Fracture128."Love" token, awarded by intracube."Love" token, awarded by amonpaike."Love" token, awarded by johnsyed."Y So Serious" token, awarded by shader."Love" token, awarded by brilliant_ape."Like" token, awarded by Samirosman."Love" token, awarded by lucky3."Love" token, awarded by zgorg."Love" token, awarded by pablodp606."Love" token, awarded by monio."Like" token, awarded by fin.eskimo."Love" token, awarded by Arindam."Love" token, awarded by tintwotin."Like" token, awarded by cmbasnett.

Details

Reviewers
Julian Eisel (Severin)
Group Reviewers
Text Editor
Summary

This patch makes it so text in the text editor may be smooth scrolled.

Works by making st->top, st->left as floats, then calculate draw offsets and adding them to the draw coordinates.

This patch makes some changes in draw order so that text may be scrolled horizontally behind line numbers margin.

Does not change the behavior of scroll operators which use fixed values, e.g a mouse wheel still scrolls three lines. However drag scrolling (middle mouse pan, text scroll bar) now applies delta directly to st->top and st->left without being accumulated.

Also added behavior to reveal line when setting cursor on a partially visible line.

Diff Detail

Event Timeline

-- (zgorg) added a subscriber: -- (zgorg).EditedTue, Sep 24, 4:53 PM
This comment has been deleted.

Would this make sense in other 2D editors also? e.g. the Outliner and properties?

@Aaron Carlisle (Blendify) From what I gathered, most 2d editors already share a common pan and scroll operator which on paper does support by-pixel scrolling. The text editor is a bit of an oddball here, being one of the last editors that still uses fixed line scrolling. There were some remarks in the code about it being left out, but no explanation as to why.

If you meant in terms of smooth animated scrolling using the mousewheel, it's not being tackled this round, however I'd be keen on trying to add support for this (and yes, I think it would be a nice, toggleable feature to have).