Color panel trial: the channel sliders end at one x (shared value and unit columns); SliderField's field-width comment names the column group

This commit is contained in:
aiongg
2026-11-13 19:26:50 +00:00
parent 17b0290d77
commit 0b723e6686
2 changed files with 4 additions and 2 deletions
+1
View File
@@ -150,6 +150,7 @@ fn the_slider_modes_show_a_channel_on_one_line() {
"{case}: {slider:?} then {field:?} on one line"
);
assert!((slider.rect.left() - sliders[0].rect.left()).abs() < 0.5, "{case}: the sliders start at one x ({slider:?}, {:?})", sliders[0]);
assert!((slider.rect.right() - sliders[0].rect.right()).abs() < 0.5, "{case}: the sliders end at one x ({slider:?}, {:?})", sliders[0]);
assert!(field.rect.bottom() <= room.y + 0.5, "{case}: every row in view ({field:?})");
}
let last = fields.iter().map(|field| field.rect.bottom()).fold(0.0, f32::max);
+3 -2
View File
@@ -284,8 +284,9 @@ impl Component for SliderField<'_> {
let name = cx.label();
let look = self.look();
let (track, field) = match self.layout {
// The field takes the width its own measure gives (a number cell, or its widest value when content-sized),
// so every row of a column with the same range ends its slider at one place.
// The field takes the width its own measure gives: a number cell, or its widest value and unit when
// content-sized, which in a column group are the group's widest. So every row of the column ends its slider
// at one place.
SliderFieldLayout::Inline => arrange(cx.rect.size(), cx.style.inline_gap, self.field_width),
SliderFieldLayout::Stacked => stack(cx.rect.size(), cx.style.metrics.gap, cx.style.row),
};