LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Crop: double-click inside the crop box applies the crop
Clément Lca1f4dbd8adb
diff --git a/crates/ui-egui/src/panels/detail.rs b/crates/ui-egui/src/panels/detail.rsindex ecbb0e10a..a974548db 100644--- a/crates/ui-egui/src/panels/detail.rs+++ b/crates/ui-egui/src/panels/detail.rs@@ -677,6 +677,15 @@ fn crop_overlay(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::ResponsNone => egui::CursorIcon::Alias,});}+ // double-click inside the crop box applies the crop (same as Return / Done)+ if resp.double_clicked()+ && let Some(q) = resp.interact_pointer_pos()+ && inside(q)+ && !handles.iter().any(|h| h.distance(q) < 12.0)+ {+ let _ = app.run("tool.done", json!({}));+ return;+ }if resp.drag_started()&& let Some(q) = resp.interact_pointer_pos(){diff --git a/crates/ui-egui/src/tests_masking.rs b/crates/ui-egui/src/tests_masking.rsindex 4cbead74a..1e4c0d143 100644--- a/crates/ui-egui/src/tests_masking.rs+++ b/crates/ui-egui/src/tests_masking.rs@@ -236,6 +236,18 @@ fn command_drag_straightens_in_crop() {h.settle(SETTLE);}+#[test]+fn double_click_in_crop_box_applies_the_crop() {+ let mut h = detail("panel.crop");+ h.settle(SETTLE);+ assert_eq!(h.app.ui.right, crate::state::RightPanel::Crop);+ let c = h.app.image_rect.expect("image on screen").center();+ let r = h.request("ui.click", json!({"x": c.x, "y": c.y, "count": 2}), T);+ assert_eq!(r["ok"], true, "{r}");+ h.settle(SETTLE);+ assert_eq!(h.app.ui.right, crate::state::RightPanel::Edit, "double-click leaves the crop tool");+}+#[test]fn option_digit_toggles_keyword_from_set() {let mut h = detail("panel.keywords");diff --git a/docs/parity.md b/docs/parity.mdindex 0da044e7b..6e1bd213f 100644--- a/docs/parity.md+++ b/docs/parity.md@@ -269,7 +269,7 @@ under the UI command that wraps it (a no-op error); the UI command now wins.| Id | Feature | Tier | Status | Evidence | Missing / notes ||---|---|---|---|---|---|-| LR-CROP-RECT | Crop rectangle | P0 | ✅ | `cmd:crop.set`, `crates/ui-egui/src/panels/detail.rs` | |+| LR-CROP-RECT | Crop rectangle | P0 | ✅ | `cmd:crop.set`, `crates/ui-egui/src/panels/detail.rs` | double-click inside the box applies the crop (like Return) || LR-CROP-ASPECT | Aspect ratios | P0 | ✅ | `cmd:crop.aspect`, `cmd:crop.rotateAspect` | no "As Shot"; custom ratio via command params only || LR-CROP-STRAIGHTEN | Straighten tool | P0 | ✅ | `cmd:crop.straighten`, `cmd:crop.autoStraighten` | Straighten Tool button: drag along a horizon/vertical; double-click or Auto levels automatically || LR-CROP-AUTO | Auto straighten | P1 | ✅ | `cmd:crop.autoStraighten` | crop-angle leveling from detected horizon/plumb lines (consensus required) |