ui_shot: an out-of-range {"ppp": s} is clamped to 0.5–4, not ignored

A scale outside the range fell back to 2 instead of the nearest allowed
one (review on #3101): {"ppp": 5} now gives 4, {"ppp": 0.1} gives 0.5.
This commit is contained in:
Mikael Tollefsen
2026-10-20 01:07:36 +02:00
committed by vangel76
parent be492ddc98
commit ad7eea67c1
+1 -1
View File
@@ -35,7 +35,7 @@ fn main() {
}
let w = lines.iter().find_map(|l| l.get("width").and_then(|v| v.as_f64())).unwrap_or(1440.0) as f32;
let h = lines.iter().find_map(|l| l.get("height").and_then(|v| v.as_f64())).unwrap_or(900.0) as f32;
let ppp = lines.iter().find_map(|l| l.get("ppp").and_then(|v| v.as_f64())).filter(|p| (0.5..=4.0).contains(p)).unwrap_or(2.0) as f32;
let ppp = lines.iter().find_map(|l| l.get("ppp").and_then(|v| v.as_f64())).map(|p| p.clamp(0.5, 4.0)).unwrap_or(2.0) as f32;
let mut harness =
egui_kittest::Harness::builder().with_size(egui::vec2(w, h)).with_pixels_per_point(ppp).with_max_steps(1_000_000).wgpu().build_ui_state(
|ui, app: &mut WordApp| {