From 7aacea23107c2ce17b57ab355c9ed251a0a45621 Mon Sep 17 00:00:00 2001 From: Piyush Mishra Date: Fri, 4 Feb 2022 12:57:00 +0530 Subject: [PATCH] Bug fixes: 1) awake all widgets after redraw of image after saving 2) Floting point issue in Crop position of new image --- src/draw_thread.rs | 5 ++++- src/utils.rs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/draw_thread.rs b/src/draw_thread.rs index 3f98dec..ed187c0 100644 --- a/src/draw_thread.rs +++ b/src/draw_thread.rs @@ -169,9 +169,10 @@ pub(crate) fn spawn_image_thread( status.set_label("Saving..."); win.deactivate(); cont.save(); + status.set_label(""); win.activate(); win.redraw(); - status.set_label(""); + app::awake(); } } DrawMessage::Clone => { @@ -194,6 +195,7 @@ pub(crate) fn spawn_image_thread( status.set_label(""); win.activate(); win.redraw(); + app::awake(); } } DrawMessage::Delete => { @@ -212,6 +214,7 @@ pub(crate) fn spawn_image_thread( status.set_label(""); win.activate(); win.redraw(); + app::awake(); } } } diff --git a/src/utils.rs b/src/utils.rs index 7774d8b..8543d91 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -121,8 +121,8 @@ impl ImageContainer { let (origina_crop_width, origina_crop_height) = croped_ratio(original_width, original_height); prop.crop_position = Some(( - original_width / 2.0 - origina_crop_width / 2.0, - original_height / 2.0 - origina_crop_height / 2.0, + (original_width - origina_crop_width) / 2.0, + (original_height - origina_crop_height) / 2.0, )); let (s_width, s_height): (f64, f64) = Coord::from(self.image.dimensions()).into();