config: Add invert_scroll_direction and scroll_speed

This commit is contained in:
Aleksander
2025-11-11 12:11:34 +01:00
parent 6169ec9505
commit afc8804aba
16 changed files with 159 additions and 101 deletions

View File

@@ -395,7 +395,7 @@ impl WidgetState {
if info.handle_size.x < 1.0 && wheel.pos.x != 0.0 {
// Horizontal scrolling
let mult = (1.0 / (l.content_box_width() - info.content_size.x)) * step_pixels;
let new_scroll = (self.data.scrolling_target.x + wheel.shift.x * mult).clamp(0.0, 1.0);
let new_scroll = (self.data.scrolling_target.x + wheel.delta.x * mult).clamp(0.0, 1.0);
if self.data.scrolling_target.x != new_scroll {
self.data.scrolling_target.x = new_scroll;
params.alterables.mark_tick(self.obj.get_id());
@@ -405,7 +405,7 @@ impl WidgetState {
if info.handle_size.y < 1.0 && wheel.pos.y != 0.0 {
// Vertical scrolling
let mult = (1.0 / (l.content_box_height() - info.content_size.y)) * step_pixels;
let new_scroll = (self.data.scrolling_target.y + wheel.shift.y * mult).clamp(0.0, 1.0);
let new_scroll = (self.data.scrolling_target.y + wheel.delta.y * mult).clamp(0.0, 1.0);
if self.data.scrolling_target.y != new_scroll {
self.data.scrolling_target.y = new_scroll;
params.alterables.mark_tick(self.obj.get_id());