Skip to content

Commit

Permalink
more sensical order of operations for scaling, axis snap, and rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
eynsai committed Sep 29, 2024
1 parent 0068124 commit e643998
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions quantum/pointing_device/pointing_device_dragscroll.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ static void dragscroll_scroll_task(dragscroll_state_t* d, report_mouse_t* mouse_
}
# endif

// apply any previously recorded rounding errors
h += d->rounding_error_h;
v += d->rounding_error_v;

// zero out the accumulators
d->accumulator_h = 0;
d->accumulator_v = 0;

// apply scaling
h *= DRAGSCROLL_MULTIPLIER_H;
v *= DRAGSCROLL_MULTIPLIER_V;

// apply axis snapping
switch (d->axis_snapping_state) {
case AXIS_SNAPPING_OFF:
Expand Down Expand Up @@ -284,11 +284,9 @@ static void dragscroll_scroll_task(dragscroll_state_t* d, report_mouse_t* mouse_
# endif
# endif
// apply scaling
h *= DRAGSCROLL_MULTIPLIER_H;
v *= DRAGSCROLL_MULTIPLIER_V;

// save rounding errors
h += d->rounding_error_h;
v += d->rounding_error_v;
mouse_report->h = (mouse_hv_report_t)h;
mouse_report->v = (mouse_hv_report_t)v;
d->rounding_error_h = h - mouse_report->h;
Expand Down

0 comments on commit e643998

Please sign in to comment.