mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-18 02:32:33 +00:00
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:
@@ -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);
|
||||
|
||||
@@ -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),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user