edit/crop: Track selection correctly on widget resize

This commit is contained in:
Sophie Herold 2024-12-21 22:51:03 +01:00
parent 5c31272605
commit 7611b11b55
4 changed files with 85 additions and 45 deletions

View file

@ -387,4 +387,15 @@ impl LpImage {
(x, y)
}
/// Convert image coordinates to drawn image coordinates
pub fn img_to_draw_coord(&self, (cur_x, cur_y): (f64, f64)) -> (f64, f64) {
let imp = self.imp();
let zoom = imp.applicable_zoom();
let x = cur_x * zoom;
let y = cur_y * zoom;
(x, y)
}
}