Skip to content

Commit

Permalink
Merge pull request iced-rs#2795 from tarkah/fix/image-viewer-redraw
Browse files Browse the repository at this point in the history
Request redraw in image viewer update
  • Loading branch information
hecrj authored Feb 7, 2025
2 parents 4bbb5cb + a8b1aef commit 940a079
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions widget/src/image/viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ where
}
}

shell.request_redraw();
shell.capture_event();
}
Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) => {
Expand All @@ -226,13 +227,16 @@ 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();
}
}
Expand Down Expand Up @@ -273,6 +277,7 @@ where
};

state.current_offset = Vector::new(x, y);
shell.request_redraw();
shell.capture_event();
}
}
Expand Down

0 comments on commit 940a079

Please sign in to comment.