pub trait ContainerInputHandler {
// Provided methods
fn hit_test_scrollbar(
&self,
scrollbar_rect: &Rect,
mouse_pos: (f64, f64),
) -> bool { ... }
fn mouse_to_scroll_offset(
&self,
mouse_y: f64,
scrollbar_y: f64,
scrollbar_height: f64,
content_height: f64,
viewport_height: f64,
) -> f64 { ... }
fn scroll_to_delta(&self, scroll_delta: f64, _viewport_height: f64) -> f64 { ... }
fn clamp_scroll_offset(
&self,
offset: f64,
content_height: f64,
viewport_height: f64,
) -> f64 { ... }
fn calculate_thumb_size(
&self,
viewport_height: f64,
content_height: f64,
scrollbar_height: f64,
min_thumb_height: f64,
) -> f64 { ... }
fn calculate_thumb_position(
&self,
scroll_offset: f64,
content_height: f64,
viewport_height: f64,
scrollbar_y: f64,
scrollbar_height: f64,
thumb_height: f64,
) -> f64 { ... }
}Expand description
Input handler adapter for container scrollbar events
This trait defines the contract for converting raw input events into scroll actions. External projects implement this trait to customize scroll behavior (rare).
Provided Methods§
Sourcefn hit_test_scrollbar(
&self,
scrollbar_rect: &Rect,
mouse_pos: (f64, f64),
) -> bool
fn hit_test_scrollbar( &self, scrollbar_rect: &Rect, mouse_pos: (f64, f64), ) -> bool
Test if mouse position is inside scrollbar rect
Sourcefn mouse_to_scroll_offset(
&self,
mouse_y: f64,
scrollbar_y: f64,
scrollbar_height: f64,
content_height: f64,
viewport_height: f64,
) -> f64
fn mouse_to_scroll_offset( &self, mouse_y: f64, scrollbar_y: f64, scrollbar_height: f64, content_height: f64, viewport_height: f64, ) -> f64
Convert mouse Y position to scroll offset (for drag scrolling)
Sourcefn scroll_to_delta(&self, scroll_delta: f64, _viewport_height: f64) -> f64
fn scroll_to_delta(&self, scroll_delta: f64, _viewport_height: f64) -> f64
Convert scroll wheel delta to scroll offset change
Sourcefn clamp_scroll_offset(
&self,
offset: f64,
content_height: f64,
viewport_height: f64,
) -> f64
fn clamp_scroll_offset( &self, offset: f64, content_height: f64, viewport_height: f64, ) -> f64
Clamp scroll offset to valid range [0, max_scroll]