Merge branch 'main' into fix/import-reports-skipped-4319

# Conflicts:
#	docs/whats-new.md
This commit is contained in:
FredApps committed 2026-11-28 09:55:31 +07:00
commit cdedaa4f3e
6 files changed
+86 -2

No files matched your search

+1 -1
View File
@@ -27,10 +27,10 @@ mod window;
pub(crate) use brush::settle_wheel_edit;
use brush::{brush_drag, brush_wheel};
pub(crate) use crop::crop_angle_label;
use crop::crop_overlay;
#[cfg(test)]
pub(crate) use crop::readout_rect;
pub(crate) use crop::{crop_angle_label, crop_size_text};
#[cfg(test)]
use crop::{flipped_corners, outside_crop_mesh, rotate_cursor_turn};
#[cfg(test)]
+34
View File
@@ -180,6 +180,14 @@ pub(super) fn crop_overlay(
app.gesture = None;
let _ = app.run("develop.endInteraction", json!({}));
}
// resizing (a corner or an edge, not a move of the whole box): the size the crop gives, in pixels,
// next to the pointer, from this frame's crop (issue #4106)
if let Some(Gesture::CropHandle { handle: 0..=7, .. }) = app.gesture
&& let Some(at) = resp.interact_pointer_pos().or_else(|| ui.input(|i| i.pointer.latest_pos()))
&& let Some(text) = crop_size_text(app, id)
{
size_readout(ui, at, &text, resp.rect);
}
if let Some(at) = readout_at {
// the canvas (the loupe's own rect), not the photo: rotating happens in the margin around it
angle_readout(ui, at, shown_angle, resp.rect);
@@ -327,6 +335,32 @@ fn angle_readout(ui: &egui::Ui, at: Pos2, angle: f64, bounds: Rect) {
register(ui, "cropAngleReadout", rect);
}
/// The size photo `id` comes out at with its crop, at its full resolution (what an export at full size
/// gives), as "W × H px". While the crop tool shows the remembered ratio's box on an untouched photo,
/// that box's size. `None` without the photo.
pub(crate) fn crop_size_text(app: &LightcraftApp, id: PhotoId) -> Option<String> {
let p = app.session.catalog.photo(id)?;
let mut d = DevelopSettings::clone(&*app.session.develop_of(id)?);
if let Some(geometry) = app.crop_tool_preview().filter(|_| app.session.active() == Some(id)) {
d.crop.geometry = geometry;
}
let (w, h) = lightcraft_pipeline::native_output_size(p.width.max(1) as usize, p.height.max(1) as usize, &d);
// rounded as an export rounds them
Some(format!("{} × {} px", w.round().max(1.0) as u64, h.round().max(1.0) as u64))
}
/// While resizing the crop: its size in pixels next to the pointer, kept inside `bounds` like the
/// angle readout.
fn size_readout(ui: &egui::Ui, at: Pos2, text: &str, bounds: Rect) {
let t = Tokens::get(ui.ctx());
let p = top_painter(ui, "crop-size-readout");
let galley = p.layout_no_wrap(text.to_string(), t.font(12.5), Color32::WHITE);
let rect = readout_rect(at, galley.size() + vec2(12.0, 6.0), bounds);
p.rect_filled(rect, 4.0, Color32::from_black_alpha(170));
p.galley(rect.min + vec2(6.0, 3.0), galley, Color32::WHITE);
register(ui, "cropSizeReadout", rect);
}
/// Guided Upright: draw up to four guides along lines that should be vertical or horizontal. Guides are
/// stored in lens-corrected (pre-perspective) coordinates, so they stay attached to the image as it warps.
fn guided_overlay(
+8
View File
@@ -99,6 +99,14 @@ pub(super) fn crop(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
let _ = app.run("crop.aspect", json!({"aspect": "toggle"}));
}
});
// the size the crop gives at full resolution, kept up to date while it is dragged (issue #4106)
if let Some(size) = crate::panels::detail::crop_size_text(app, id) {
ui.horizontal(|ui| {
ui.label(crate::i18n::tr("Size"));
let r = ui.label(egui::RichText::new(size).color(Tokens::get(ui.ctx()).text_dim));
register(ui, "cropSize", r.rect);
});
}
ui.add_space(6.0);
ui.horizontal_wrapped(|ui| {
if text_button(ui, "cropRotateLeft", crate::i18n::tr("Rotate Left"), false).clicked() {
+37
View File
@@ -499,3 +499,40 @@ fn auto_straighten_says_when_it_finds_nothing() {
assert_eq!(angle(&h), 0.0);
let _ = std::fs::remove_dir_all(dir);
}
/// The size the crop gives, in pixels, as the export at full size would make it (issue #4106).
fn size_of(h: &Headless) -> String {
let id = h.app.session.active().expect("a photo");
let p = h.app.session.catalog.photo(id).expect("the photo");
let (w, ht) = lightcraft_pipeline::native_output_size(p.width as usize, p.height as usize, &p.develop);
format!("{} × {} px", w.round() as u64, ht.round() as u64)
}
/// The crop's size in pixels shows in the Crop panel, and next to the pointer while a handle is dragged,
/// and follows the drag (issue #4106: see the resolution a crop leaves while making it).
#[test]
fn the_crop_shows_its_size_in_pixels_as_it_is_dragged() {
let mut h = crop_tool();
let full = size_of(&h);
let shown = |h: &Headless, text: &str| h.painted_text().iter().any(|t| t == text);
assert!(has(&h, "cropSize") && shown(&h, &full), "the panel shows the uncropped size {full}: {:?}", h.painted_text());
assert!(!has(&h, "cropSizeReadout"), "no readout by the pointer before a drag");
// drag the right edge's handle a quarter of the way in, and hold it there
let r = h.request(
"ui.pointer",
json!({"events": [{"kind": "down", "x": 1.0, "y": 0.5}, {"kind": "drag", "x": 0.9, "y": 0.5}, {"kind": "drag", "x": 0.75, "y": 0.5}]}),
T,
);
assert_eq!(r["ok"], true, "{r}");
h.settle(SETTLE);
let cropped = size_of(&h);
assert_ne!(cropped, full, "the drag cropped the photo");
assert!(has(&h, "cropSizeReadout"), "the size shows by the pointer while resizing");
assert!(shown(&h, &cropped), "and reads the crop's new size {cropped}: {:?}", h.painted_text());
assert!(!shown(&h, &full), "the old size is gone from the panel too");
let r = h.request("ui.pointer", json!({"events": [{"kind": "up", "x": 0.75, "y": 0.5}]}), T);
assert_eq!(r["ok"], true, "{r}");
h.settle(SETTLE);
assert!(!has(&h, "cropSizeReadout"), "the readout goes once released");
assert!(shown(&h, &size_of(&h)), "the panel keeps the size");
}
+1 -1
View File
@@ -254,7 +254,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts).
| Id | Feature | Tier | Status | Evidence | Missing / notes |
|---|---|---|---|---|---|
| LR-CROP-RECT | Crop rectangle | P0 | ✅ | `cmd:crop.set`, `cmd:crop.drag`, `crates/geom/src/crop_drag.rs`, `crates/ui-egui/src/panels/detail.rs` | double-click inside the box applies the crop (like Return); on a straightened photo a moved box slides along the tilted edges to where the pointer asks, so a box that fills the photo's height still reaches its sides (issue #2299), and a free corner dragged out goes to the place nearest the pointer that fits, growing both sides instead of only the first one to reach a tilted edge (issue #2308) |
| LR-CROP-RECT | Crop rectangle | P0 | ✅ | `cmd:crop.set`, `cmd:crop.drag`, `crates/geom/src/crop_drag.rs`, `crates/ui-egui/src/panels/detail.rs` | double-click inside the box applies the crop (like Return); on a straightened photo a moved box slides along the tilted edges to where the pointer asks, so a box that fills the photo's height still reaches its sides (issue #2299), and a free corner dragged out goes to the place nearest the pointer that fits, growing both sides instead of only the first one to reach a tilted edge (issue #2308); the Crop panel shows the size the crop leaves in pixels, and a handle drag shows it beside the pointer as it changes (`crop_size_text`, issue #4106) |
| LR-CROP-ASPECT | Aspect ratios | P0 | ✅ | `cmd:crop.aspect`, `cmd:crop.rotateAspect`, `crates/ui-egui/src/panels/right.rs` | menu with presets + custom W × H (a preset takes the crop's orientation, portrait after X; a custom ratio is used as entered, issue #2253), visible Lock toggle (also A, its own row in Keyboard Shortcuts: `crop.lockAspect` toggles it, sharing A with Visualize Spots by context), button names the active ratio; every handle honours the lock, holding Shift while dragging a handle keeps the frame's proportions for that drag (issue #614), and the drag stops at the image edge instead of shifting the frame (issue #295); "Original" is the photo's own shape (no separate As Shot); the last chosen aspect is saved as a crop tool default, resolving Original per photo and preserving existing crops; opening Crop or browsing never edits a photo: the default applies only when a crop gesture starts, within its single undo step; a crop starts locked to the photo's own shape until the Lock is switched off once, then as last set (#991) |
| LR-CROP-STRAIGHTEN | Straighten tool | P0 | ✅ | `cmd:crop.straighten`, `cmd:crop.autoStraighten`, `crates/ui-egui/src/panels/detail.rs` (`rotate_cursor`, `angle_readout`), `crates/ui-egui/src/panels/right.rs` (Angle field), `crates/ui-egui/src/tests/crop_rotate.rs` | Straighten Tool button: drag along a horizon/vertical; double-click or Auto levels automatically. Dragging outside the crop box rotates it: there the pointer is a curved double arrow that bulges away from the side of the box it is on, diagonally off a corner and following a rotated box (`rotate_cursor_turn`, tested by `rotate_cursor_faces_away_from_the_crop_box`) (with ⌘ held, the straighten crosshair), and while rotating the angle shows next to it, kept on the canvas (issue #534); an exact angle goes in the Angle field under Straighten (`cropAngleField`: applies on Return or leaving it, Esc keeps the old angle, takes a decimal comma; a drag on it is one undo step) or by clicking the Straighten value (its hover says so). Every way of setting the angle (rotate handle, Straighten slider, Angle field, `crop.straighten`, `crop.set {angle}`, and the generic `develop.set` / `develop.adjust` / `develop.quickAdjust` / `develop.resetControl` on `crop.angle`, as MCP, the control channel and `lightcraft-cli render --set` use them) keeps the crop if it still fits, else shrinks it about its own centre, keeping its aspect, until it fits; the full photo (or a crop an earlier turn shrank to the largest of its aspect) stays the largest, so it grows back towards 0° (issue #1388), and no other crop ever grows (issue #1794: a crop dragged in from a corner turned into nearly the whole photo) (`CropGeometry::with_angle`, `crates/engine/src/tests/crop_angle.rs`; before issue #742 the generic path left the box, and the export, past the photo with smeared edge pixels in the corners). The dimming outside the box is the photo minus the (rotated) box, drawn as one mesh (`outside_crop_mesh`), so rotating never dims wedges inside the box or doubles them outside (issue #731) |
| LR-CROP-AUTO | Auto straighten | P1 | 🟡 | `cmd:crop.autoStraighten`, `crates/pipeline/src/straighten.rs` | crop-angle leveling from three cues, in this order: the roll from the vertical vanishing point (plumb lines, also when they converge in perspective), the horizon as the straight full-width line with brighter rows on one side (scored by its weaker columns, so waves, clouds and ridges don't make one), and the consensus of long lines (at least 3 agreeing, which also vetoes a horizon it disagrees with by more than 1°); never more than 5° (`straighten::MAX_DEGREES`); says so when it finds nothing (`auto_straighten_says_when_it_finds_nothing`). Measured on 113 photos straightened by hand in Lightroom Classic: 50 come out straighter (29 with the long lines alone), 10 more tilted (also 10 before), mean error 0.82° (1.01°). 🟡 because it still leaves about a third of tilted photos alone (36 of the 113) |
+5
View File
@@ -13,6 +13,11 @@
- `library.import` now reports what its folder walk left out, `skipped: {unreadable, unsupported}`, as
`library.importPreview` already did, so a script or MCP client can tell a skipped file from a missing one (#4319).
### The crop shows its size in pixels
- The Crop panel shows the size the crop leaves, in pixels (as a full-size export makes it, such as 2160 × 2700 px),
and dragging a crop handle shows it beside the pointer as it changes, so you can keep a minimum resolution while
you crop (issue #4106).
### Shift+Tab hides all the panels
- Window ▸ Hide All Panels (Shift+Tab, Lightroom Classic's Toggle All Panels) hides the left sidebar, the right panel,
the Presets column and the filmstrip; the next press brings back exactly what was shown, so a panel that was already