Compare commits
1 changed files with 11 additions and 17 deletions
28
src/main.rs
28
src/main.rs
|
|
@ -81,24 +81,20 @@ impl State {
|
|||
}
|
||||
|
||||
Key::Character("r") => {
|
||||
match self.image.as_ref() {
|
||||
None => self.error = Some("no image to rotate".into()),
|
||||
Some(image) => {
|
||||
self.error = None;
|
||||
self.image = Some(imageops::rotate90(image));
|
||||
return self.allocate_image();
|
||||
}
|
||||
let Some(image) = self.image.as_ref() else {
|
||||
eprintln!("no image to rotate");
|
||||
return Task::none();
|
||||
};
|
||||
self.image = Some(imageops::rotate90(image));
|
||||
return self.allocate_image();
|
||||
}
|
||||
Key::Character("i") => {
|
||||
match self.image.as_mut() {
|
||||
None => self.error = Some("no image to invert".into()),
|
||||
Some(image) => {
|
||||
self.error = None;
|
||||
imageops::invert(image);
|
||||
return self.allocate_image();
|
||||
}
|
||||
let Some(image) = self.image.as_mut() else {
|
||||
eprintln!("no image to invert");
|
||||
return Task::none();
|
||||
};
|
||||
imageops::invert(image);
|
||||
return self.allocate_image();
|
||||
}
|
||||
|
||||
Key::Character("s") => {
|
||||
|
|
@ -145,9 +141,7 @@ impl State {
|
|||
path.display()
|
||||
));
|
||||
}
|
||||
Err(e) => {
|
||||
return Some(format!("failed to decode jxl '{}': {e}", path.display()));
|
||||
}
|
||||
Err(e) => return Some(format!("faled to decode '{}' {e}", path.display())),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue