Make stick_to_bottom take a bool argument
This commit is contained in:
parent
263c9bd601
commit
06adb09fa3
4 changed files with 11 additions and 13 deletions
|
@ -272,8 +272,8 @@ impl ScrollArea {
|
|||
/// it will remain focused on whatever content viewport the user left it on. If the scroll
|
||||
/// handle is dragged all the way to the right it will again become stuck and remain there
|
||||
/// until manually pulled from the end position.
|
||||
pub fn stick_to_right(mut self) -> Self {
|
||||
self.stick_to_end[0] = true;
|
||||
pub fn stick_to_right(mut self, stick: bool) -> Self {
|
||||
self.stick_to_end[0] = stick;
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -283,8 +283,8 @@ impl ScrollArea {
|
|||
/// it will remain focused on whatever content viewport the user left it on. If the scroll
|
||||
/// handle is dragged to the bottom it will again become stuck and remain there until manually
|
||||
/// pulled from the end position.
|
||||
pub fn stick_to_bottom(mut self) -> Self {
|
||||
self.stick_to_end[1] = true;
|
||||
pub fn stick_to_bottom(mut self, stick: bool) -> Self {
|
||||
self.stick_to_end[1] = stick;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
@ -371,7 +371,7 @@ impl EguiWindows {
|
|||
ui.separator();
|
||||
|
||||
egui::ScrollArea::vertical()
|
||||
.stick_to_bottom()
|
||||
.stick_to_bottom(true)
|
||||
.show(ui, |ui| {
|
||||
for event in output_event_history {
|
||||
ui.label(format!("{:?}", event));
|
||||
|
|
|
@ -271,7 +271,7 @@ impl super::View for ScrollStickTo {
|
|||
|
||||
let text_style = TextStyle::Body;
|
||||
let row_height = ui.text_style_height(&text_style);
|
||||
ScrollArea::vertical().stick_to_bottom().show_rows(
|
||||
ScrollArea::vertical().stick_to_bottom(true).show_rows(
|
||||
ui,
|
||||
row_height,
|
||||
self.n_items,
|
||||
|
|
|
@ -110,8 +110,8 @@ impl<'a> TableBuilder<'a> {
|
|||
/// Should the scroll handle stick to the bottom position even as the content size changes
|
||||
/// dynamically? The scroll handle remains stuck until manually changed, and will become stuck
|
||||
/// once again when repositioned to the bottom. Default: `false`.
|
||||
pub fn stick_to_bottom(mut self) -> Self {
|
||||
self.stick_to_bottom = true;
|
||||
pub fn stick_to_bottom(mut self, stick: bool) -> Self {
|
||||
self.stick_to_bottom = stick;
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -295,11 +295,9 @@ impl<'a> Table<'a> {
|
|||
|
||||
let mut new_widths = widths.clone();
|
||||
|
||||
let mut scroll_area = egui::ScrollArea::new([false, scroll]).auto_shrink([true; 2]);
|
||||
|
||||
if stick_to_bottom {
|
||||
scroll_area = scroll_area.stick_to_bottom();
|
||||
}
|
||||
let scroll_area = egui::ScrollArea::new([false, scroll])
|
||||
.auto_shrink([true; 2])
|
||||
.stick_to_bottom(stick_to_bottom);
|
||||
|
||||
scroll_area.show(ui, move |ui| {
|
||||
let layout = StripLayout::new(ui, CellDirection::Horizontal, clip, cell_layout);
|
||||
|
|
Loading…
Reference in a new issue