mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-26 20:38:21 +00:00
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.
This commit is contained in:
@@ -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<String> = (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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user