Skip to content

Commit 2e632ad

Browse files
committed
Fix oopsie
1 parent 0a701c0 commit 2e632ad

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
use evdev::{EventType, InputEvent, RelativeAxisCode};
44
use 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

0 commit comments

Comments
 (0)