mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 06:10:06 -04:00
refactor: group mouse input into own struct
This commit is contained in:
@@ -147,7 +147,7 @@ impl ScrollArea {
|
||||
// Dragg contents to scroll (for touch screens mostly):
|
||||
let content_interact = ui.interact_rect(inner_rect, id.with("area"));
|
||||
if content_interact.active {
|
||||
state.offset.y -= ui.input().mouse_move.y;
|
||||
state.offset.y -= ui.input().mouse.delta.y;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,11 +181,11 @@ impl ScrollArea {
|
||||
let interact_id = id.with("vertical");
|
||||
let handle_interact = ui.interact_rect(handle_rect, interact_id);
|
||||
|
||||
if let Some(mouse_pos) = ui.input().mouse_pos {
|
||||
if let Some(mouse_pos) = ui.input().mouse.pos {
|
||||
if handle_interact.active {
|
||||
if inner_rect.top() <= mouse_pos.y && mouse_pos.y <= inner_rect.bottom() {
|
||||
state.offset.y +=
|
||||
ui.input().mouse_move.y * content_size.y / inner_rect.height();
|
||||
ui.input().mouse.delta.y * content_size.y / inner_rect.height();
|
||||
}
|
||||
} else {
|
||||
// Check for mouse down outside handle:
|
||||
|
||||
Reference in New Issue
Block a user