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:
commit
fd57e61324
1 changed files with 1 additions and 6 deletions
|
|
@ -230,17 +230,12 @@ where
|
||||||
state.cursor_grabbed_at = Some(cursor_position);
|
state.cursor_grabbed_at = Some(cursor_position);
|
||||||
state.starting_offset = state.current_offset;
|
state.starting_offset = state.current_offset;
|
||||||
|
|
||||||
shell.request_redraw();
|
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left)) => {
|
Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left)) => {
|
||||||
let state = tree.state.downcast_mut::<State>();
|
let state = tree.state.downcast_mut::<State>();
|
||||||
|
|
||||||
if state.cursor_grabbed_at.is_some() {
|
state.cursor_grabbed_at = None;
|
||||||
state.cursor_grabbed_at = None;
|
|
||||||
shell.request_redraw();
|
|
||||||
shell.capture_event();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Event::Mouse(mouse::Event::CursorMoved { position }) => {
|
Event::Mouse(mouse::Event::CursorMoved { position }) => {
|
||||||
let state = tree.state.downcast_mut::<State>();
|
let state = tree.state.downcast_mut::<State>();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue