Improved Text Editor scrolling with the trackpad,
by accumulating deltas that are less than one line/character.
Makes the scroll speed match the speed in other Blender editors,
and other macOS applications as well.
***
**Ver.2 Smooth scrolling**
Implementing gesture phases: https://developer.blender.org/D8760?id=31074
```
lines=10
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 526285c076a..20b43b7e88e 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -2614,6 +2614,10 @@ static void text_scroll_apply(bContext *C, wmOperator *op, const wmEvent *event)
tsc->mval_delta[0] = mval[0] - tsc->mval_prev[0];
tsc->mval_delta[1] = mval[1] - tsc->mval_prev[1];
}
+ else {
+ tsc->mval_delta[0] = event->x - event->prevx;
+ tsc->mval_delta[1] = event->y - event->prevy;
+ }
/* accumulate scroll, in float values for events that give less than one
* line offset but taken together should still scroll */
@@ -2710,6 +2714,13 @@ static int text_scroll_modal(bContext *C, wmOperator *op, const wmEvent *event)
ARegion *region = CTX_wm_region(C);
switch (event->type) {
+ case MOUSEPAN:
+ text_scroll_apply(C, op, event);
+ if (ELEM(GESTURE_PHASE_ENDED, event->phase, event->momentumPhase)) {
+ scroll_exit(C, op);
+ return OPERATOR_FINISHED;
+ }
+ break;
case MOUSEMOVE:
if (tsc->zone == SCROLLHANDLE_BAR) {
text_scroll_apply(C, op, event);
@@ -2761,7 +2772,7 @@ static int text_scroll_invoke(bContext *C, wmOperator *op, const wmEvent *event)
st->flags |= ST_SCROLL_SELECT;
- if (event->type == MOUSEPAN) {
+ if (0) {
text_update_character_width(st);
tsc->mval_prev[0] = event->x;
```