feat: use widget::image::Viewer to allow zooming and panning
This commit is contained in:
parent
e9fb349352
commit
e703be030e
1 changed files with 5 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use std::{env, ffi::OsStr, fs};
|
||||
|
||||
use iced::{
|
||||
Color, Element, Renderer, Subscription, Task, Theme, color, event,
|
||||
Color, Element, Length, Renderer, Subscription, Task, Theme, color, event,
|
||||
keyboard::{self, Key, key},
|
||||
theme, widget, window,
|
||||
};
|
||||
|
|
@ -52,7 +52,10 @@ impl State {
|
|||
}
|
||||
fn view(&self) -> Element<'_, Message, Theme, Renderer> {
|
||||
if let Some(allocation) = self.image_display.as_ref() {
|
||||
widget::image(allocation.handle()).expand(true).into()
|
||||
widget::image::viewer(allocation.handle().clone())
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.into()
|
||||
} else {
|
||||
widget::space().into()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue