PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Merge PR #7753: Crop: a typed ratio fits from the frame the edit started with (#7752)
aionggf1cc8ad42382
diff --cc crates/ui-egui/src/crop_ui.rsindex 888ddd5cf,77228342a..7c5e4db8e--- a/crates/ui-egui/src/crop_ui.rs+++ b/crates/ui-egui/src/crop_ui.rs@@@ -249,9 -248,23 +249,24 @@@ pub(crate) fn apply_ratio(app: &mut Phocrate::crop_mode::sync_frame(app);}+ /// [`apply_ratio`] for a ratio being typed: fits from `base`, the frame the edit started with,+ /// not from the frame the last keystroke's ratio left (#7752).+ pub(crate) fn apply_ratio_from(app: &mut PhotocraftApp, base: [f64; 4]) {+ if app.ui.tool != Tool::Crop || app.crop.drag.is_some() {+ return;+ }+ if let Some(ratio) = preset_ratio(app)+ && let Some(fitted) = fitted_ratio(base, ratio)+ && app.ui.crop_rect != Some(fitted)+ {+ keyed(app, fitted);+ }+ crate::crop_mode::sync_frame(app);+ }+fn fit_frame(app: &mut PhotocraftApp) {let dpi = app.session.active().map_or(72.0, |s| f64::from(s.doc.resolution_dpi));+ let pt_per_in = app.session.prefs().units_and_rulers.point_size.per_inch();if let Some(r) = app.ui.crop_rect&& let Some(ratio) = preset_ratio(app)&& let Some(fitted) = fitted_ratio(r, ratio)