From a1886f6957a5735471034add3a7470442fa82f88 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 24 Nov 2026 19:32:35 -0800 Subject: [PATCH] 3D: the light list is a framework Stack, and the light sphere measures as tall as it shows The light sphere's height follows its width, but it measured with the width of a band picture, which is its least width when a column measures it with no room. In a Stack the measuring run then found the light list shorter than it showed (by 64 pt in the 3D panel test), and "Light behind the object", the last row, lay outside the Stack and took no clicks. The sphere now measures with MeasureCx::picture_size, so the column measures it again at the width it shows at. The light list moves from ui.vertical into form::stacked: each run edits a copy of the values, and the copy from the run that is not a measuring run replaces them. --- crates/ui-egui/src/dialogs/revolve.rs | 3 +-- crates/ui-egui/src/dialogs/revolve_lights.rs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/dialogs/revolve.rs b/crates/ui-egui/src/dialogs/revolve.rs index a61190970e..a20c8c720b 100644 --- a/crates/ui-egui/src/dialogs/revolve.rs +++ b/crates/ui-egui/src/dialogs/revolve.rs @@ -721,7 +721,7 @@ pub(crate) fn light_editor(_data: &Data, place: Place, classic: bool) -> Param { fields.remove("__lightPick"); set_light_value(fields, "lightColor", json!(hex)); } - ui.vertical(|ui| { + super::form::stacked(ui, fields, |ui, fields| { let mut list = explicit_lights(fields).unwrap_or_else(|| vec![light_record(fields)]); let mut index = light_index(fields, list.len()); let titles: Vec = (1..=list.len()).map(|i| format!("{} {i}", c3("Light"))).collect(); @@ -767,7 +767,6 @@ pub(crate) fn light_editor(_data: &Data, place: Place, classic: bool) -> Param { store_selected(fields, &selected); } }) - .response }) .companions(LIGHT_KEYS.iter().map(|(_, k)| *k).chain(["__light", "__lightPick"])) .on_set(set_light_field) diff --git a/crates/ui-egui/src/dialogs/revolve_lights.rs b/crates/ui-egui/src/dialogs/revolve_lights.rs index 992ccf44ae..342f032808 100644 --- a/crates/ui-egui/src/dialogs/revolve_lights.rs +++ b/crates/ui-egui/src/dialogs/revolve_lights.rs @@ -272,8 +272,8 @@ impl Component for LightSphere<'_> { /// The row's width and the height of the sphere that fits it, with its suns. fn measure(&mut self, cx: &MeasureCx<'_, Self>) -> Vec2 { - let width = cx.picture_width((24.0 + SUN + 8.0) * 2.0, f32::INFINITY); - Vec2::new(width, (radius_in(width) + SUN + 6.0) * 2.0) + // The height follows the width: a column that measures the sphere with no room measures it again at its width. + cx.picture_size((24.0 + SUN + 8.0) * 2.0, f32::INFINITY, |width| (radius_in(width) + SUN + 6.0) * 2.0) } fn sense(&self) -> Sense {