update example

This commit is contained in:
griffi-gh 2024-03-22 15:25:01 +01:00
parent ab5998de03
commit 2af4fd900c

View file

@ -41,7 +41,11 @@ ui_main!(
.with_wrap(true) .with_wrap(true)
.with_children(|ui| { .with_children(|ui| {
Text::new(format!("Number of images: {counter}")) Text::new(format!("Number of images: {counter}"))
.with_text_size(24) .with_text_size(32)
.add_child(ui);
Br.add_child(ui);
Text::new("Absolute tracking slider:")
.with_text_size(16)
.add_child(ui); .add_child(ui);
Br.add_child(ui); Br.add_child(ui);
Slider::new(*counter as f32 / 100.) Slider::new(*counter as f32 / 100.)
@ -51,6 +55,18 @@ ui_main!(
}) })
.add_child(ui); .add_child(ui);
Br.add_child(ui); Br.add_child(ui);
Text::new("Relative tracking slider (Experimental):")
.with_text_size(16)
.add_child(ui);
Br.add_child(ui);
Slider::new(*counter as f32 / 100.)
.with_size(size!(66%, 20))
.with_follow_mode(hui::element::slider::SliderFollowMode::Relative)
.on_change(|x| {
CounterSignal::ChangeValue((x * 100.).round() as u32)
})
.add_child(ui);
Br.add_child(ui);
for _ in 0..*counter { for _ in 0..*counter {
Image::new(*image) Image::new(*image)
.with_size(size!(48, 48)) .with_size(size!(48, 48))