From 6b3cc777c147c2cef960c2ed897e268af21e02db Mon Sep 17 00:00:00 2001 From: helgehelge123 <117832631+helgehelge123@users.noreply.github.com> Date: Thu, 22 Oct 2026 20:49:20 +0200 Subject: [PATCH] LR-LIB-CULL: a typed similarity keeps its thousandths (#2275) The similarity slider stepped and showed whole hundredths, and egui applies both to a typed value too, so 0.995 became 1.00 before photo.analyze saw it. It now steps by a thousandth and shows two or three decimals: dragging still lands on round values, and a typed 0.995 is kept. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/panels/dialogs.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/panels/dialogs.rs b/crates/ui-egui/src/panels/dialogs.rs index d90e3285a..205e9d1c6 100644 --- a/crates/ui-egui/src/panels/dialogs.rs +++ b/crates/ui-egui/src/panels/dialogs.rs @@ -364,8 +364,10 @@ pub fn show(app: &mut LightcraftApp, ctx: &egui::Context) { egui::Slider::new(similarity, 0.70..=0.99) .clamping(egui::SliderClamping::Never) .text(crate::i18n::tr("Burst: how alike (loose … strict)")) - .step_by(0.01) - .fixed_decimals(2), + // a typed 0.995 is kept (whole hundredths would round it to 1.00) + .step_by(0.001) + .min_decimals(2) + .max_decimals(3), ); crate::widgets::register(ui.ctx(), "field:cullSimilar", r.rect); clamp_cull_burst(burst_gap, similarity); @@ -2511,6 +2513,13 @@ mod cull_dialog_tests { assert_eq!(burst(&h), (0.0, 1.0)); type_value(&mut h, "field:cullGap", "1800"); assert_eq!(burst(&h).0, 1800.0); + // a similarity between the slider's hundredths is kept to the thousandth + type_value(&mut h, "field:cullSimilar", "0.995"); + assert_eq!(burst(&h).1, 0.995); + type_value(&mut h, "field:cullSimilar", "0.9951"); + assert_eq!(burst(&h).1, 0.995); + type_value(&mut h, "field:cullSimilar", "1.0"); + assert_eq!(burst(&h).1, 1.0); // OK hands them to photo.analyze as typed (it refuses values out of its range) let r = h.request("ui.dialog.confirm", json!({}), T); assert_eq!(r["ok"], true, "{r}");