mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-26 19:36:16 +00:00
Merge pull request #9271 from dotCooCoo/fix/light-list-stack
3D: the light list is a framework Stack, and the light sphere measures as tall as it shows
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