From ea3563493ebc025ad2ae031e82423664813492c8 Mon Sep 17 00:00:00 2001 From: Sophie Herold Date: Tue, 6 Aug 2024 14:08:24 +0200 Subject: [PATCH] image/rotation: Fix issuing edit for 0deg rotation Rotating by 0 degrees went through the complete rotation pipeline including a image reload. Now, 0 deg rotations are ignored. --- .../47.rc/fixed-dont-rewrite-image-for-0deg-rotation | 1 + src/widgets/image/rotation.rs | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 news.d/47.rc/fixed-dont-rewrite-image-for-0deg-rotation diff --git a/news.d/47.rc/fixed-dont-rewrite-image-for-0deg-rotation b/news.d/47.rc/fixed-dont-rewrite-image-for-0deg-rotation new file mode 100644 index 0000000..8e1143d --- /dev/null +++ b/news.d/47.rc/fixed-dont-rewrite-image-for-0deg-rotation @@ -0,0 +1 @@ +Rotating by 0 degrees went through the complete rotation pipeline including a image reload. Now, 0 deg rotations are ignored. diff --git a/src/widgets/image/rotation.rs b/src/widgets/image/rotation.rs index ce4844c..3b2b4a7 100644 --- a/src/widgets/image/rotation.rs +++ b/src/widgets/image/rotation.rs @@ -103,11 +103,13 @@ impl LpImage { } if let Ok(r) = gufo_common::orientation::Rotation::try_from(angle) { - log::debug!("Editing image to rotate by {r:?}"); - let operation = glycin::Operation::Rotate(r); - let editing_queue = &self.imp().editing_queue; - editing_queue.push(operation); - editing_queue.write_to_image(self); + if r != gufo_common::orientation::Rotation::_0 { + log::debug!("Editing image to rotate by {r:?}"); + let operation = glycin::Operation::Rotate(r); + let editing_queue = &self.imp().editing_queue; + editing_queue.push(operation); + editing_queue.write_to_image(self); + } } } }