Merge pull request #2744 from rhysd/issue-2743

Do not capture released event inside `image::Viewer` when mouse is not dragged
This commit is contained in:
Héctor 2025-11-20 01:46:17 +01:00 committed by GitHub
commit fd57e61324
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -230,17 +230,12 @@ where
state.cursor_grabbed_at = Some(cursor_position);
state.starting_offset = state.current_offset;
shell.request_redraw();
shell.capture_event();
}
Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left)) => {
let state = tree.state.downcast_mut::<State>();
if state.cursor_grabbed_at.is_some() {
state.cursor_grabbed_at = None;
shell.request_redraw();
shell.capture_event();
}
state.cursor_grabbed_at = None;
}
Event::Mouse(mouse::Event::CursorMoved { position }) => {
let state = tree.state.downcast_mut::<State>();