From 2c099b5edd9f5f45c96cb83a8d972cc2c4e274d7 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Fri, 22 Mar 2024 15:25:01 +0100 Subject: [PATCH] update example --- hui-examples/examples/ui_test_6_slider.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/hui-examples/examples/ui_test_6_slider.rs b/hui-examples/examples/ui_test_6_slider.rs index ac844ef..371641a 100644 --- a/hui-examples/examples/ui_test_6_slider.rs +++ b/hui-examples/examples/ui_test_6_slider.rs @@ -41,7 +41,11 @@ ui_main!( .with_wrap(true) .with_children(|ui| { 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); Br.add_child(ui); Slider::new(*counter as f32 / 100.) @@ -51,6 +55,18 @@ ui_main!( }) .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 { Image::new(*image) .with_size(size!(48, 48))