mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-14 19:27:01 -04:00
Crop: double-click inside the crop box applies the crop
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
1 parent
7bf24ff856
commit
ca1f4dbd8a
3 files changed
+22
-1
No files matched your search
@@ -677,6 +677,15 @@ fn crop_overlay(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Respons
|
||||
None => 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()
|
||||
{
|
||||
|
||||
@@ -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");
|
||||
|
||||
+1
-1
@@ -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) |
|
||||
|
||||
Reference in new issue
Block a user