File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33use evdev:: { EventType , InputEvent , RelativeAxisCode } ;
44use std:: time:: SystemTime ;
5- use log:: error;
65
76/// Parameters for the anxious scroll algorithm
87#[ derive( Debug , Clone ) ]
@@ -93,9 +92,9 @@ pub fn apply_anxious_scroll(
9392
9493 let vel = value. abs ( ) / elapsed_time. as_millis ( ) as f32 ;
9594 let c = ( anxious_params. max_sens / anxious_params. base_sens ) - 1.0 ;
96- // TODO: Use fast approximation for the calculation
97- let sens = anxious_params . max_sens
98- / fast_exp ( 1.0 + c * ( - 1.0 * vel as f32 * anxious_params . ramp_up_rate ) ) ;
95+ let exp_term = fast_exp ( -anxious_params . ramp_up_rate * vel ) ;
96+ // Apply the logistic function: max_sens / (1 + c * e^(-ramp_up_rate * vel))
97+ let sens = anxious_params . max_sens / ( 1.0 + c * exp_term ) ;
9998 return ( value * sens) as i32 ;
10099}
101100
You can’t perform that action at this time.
0 commit comments