Skip to content

Commit

Permalink
Improve demo
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Nov 9, 2023
1 parent a89883c commit 20f6625
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions crates/egui/src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,12 @@ impl ScrollStyle {
ui.selectable_value(self, Self::floating(), "Floating");
});

ui.collapsing("Details", |ui| {
self.details_ui(ui);
});
}

pub fn details_ui(&mut self, ui: &mut Ui) {
let Self {
floating,
bar_width,
Expand Down
9 changes: 7 additions & 2 deletions crates/egui_demo_lib/src/demo/scrolling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ struct ScrollAppearance {
impl Default for ScrollAppearance {
fn default() -> Self {
Self {
num_lorem_ipsums: 10,
num_lorem_ipsums: 2,
visibility: ScrollBarVisibility::default(),
}
}
Expand All @@ -128,6 +128,7 @@ impl ScrollAppearance {
ui.selectable_value(visibility, option, format!("{option:?}"));
}
});
ui.weak("When to show scroll bars; resize the window to see the effect.");

ui.add_space(8.0);

Expand All @@ -141,7 +142,11 @@ impl ScrollAppearance {

ui.separator();

ui.add(egui::Slider::new(num_lorem_ipsums, 1..=100).text("Content length"));
ui.add(
egui::Slider::new(num_lorem_ipsums, 1..=100)
.text("Content length")
.logarithmic(true),
);

ui.separator();

Expand Down

0 comments on commit 20f6625

Please sign in to comment.