pub trait PopupInputHandler {
// Provided methods
fn hit_test(&self, popup_rect: &Rect, mouse_pos: (f64, f64)) -> bool { ... }
fn is_outside_click(&self, mouse_pos: (f64, f64), popup_rect: &Rect) -> bool { ... }
fn mouse_to_item_index(
&self,
mouse_y: f64,
popup_y: f64,
item_height: f64,
item_count: usize,
padding_vertical: f64,
) -> Option<usize> { ... }
fn mouse_to_color_index(
&self,
mouse_pos: (f64, f64),
popup_rect: &Rect,
grid_cols: usize,
swatch_size: f64,
grid_spacing: f64,
padding: f64,
) -> Option<usize> { ... }
fn adjust_position_to_screen(
&self,
pos: (f64, f64),
size: (f64, f64),
screen: (f64, f64),
) -> (f64, f64) { ... }
}Expand description
Input handler adapter for popup events
This trait defines the contract for converting raw input events into popup actions. External projects implement this trait to customize input behavior (rare).
Provided Methods§
Sourcefn hit_test(&self, popup_rect: &Rect, mouse_pos: (f64, f64)) -> bool
fn hit_test(&self, popup_rect: &Rect, mouse_pos: (f64, f64)) -> bool
Test if mouse position is inside popup rect
Sourcefn is_outside_click(&self, mouse_pos: (f64, f64), popup_rect: &Rect) -> bool
fn is_outside_click(&self, mouse_pos: (f64, f64), popup_rect: &Rect) -> bool
Test if click was outside popup (for auto-dismiss)
Sourcefn mouse_to_item_index(
&self,
mouse_y: f64,
popup_y: f64,
item_height: f64,
item_count: usize,
padding_vertical: f64,
) -> Option<usize>
fn mouse_to_item_index( &self, mouse_y: f64, popup_y: f64, item_height: f64, item_count: usize, padding_vertical: f64, ) -> Option<usize>
Convert mouse Y coordinate to menu item index