Implement Container widget
Remove `align_self` and `justify_content` methods
This commit is contained in:
parent
bfe19193b9
commit
ceb02f4a36
25 changed files with 310 additions and 205 deletions
|
|
@ -7,7 +7,6 @@ pub struct Scrollable<'a, Element> {
|
|||
pub state: &'a mut State,
|
||||
pub height: Length,
|
||||
pub max_height: u32,
|
||||
pub align_self: Option<Align>,
|
||||
pub content: Column<Element>,
|
||||
}
|
||||
|
||||
|
|
@ -17,7 +16,6 @@ impl<'a, Element> Scrollable<'a, Element> {
|
|||
state,
|
||||
height: Length::Shrink,
|
||||
max_height: u32::MAX,
|
||||
align_self: None,
|
||||
content: Column::new(),
|
||||
}
|
||||
}
|
||||
|
|
@ -72,17 +70,6 @@ impl<'a, Element> Scrollable<'a, Element> {
|
|||
self
|
||||
}
|
||||
|
||||
/// Sets the alignment of the [`Scrollable`] itself.
|
||||
///
|
||||
/// This is useful if you want to override the default alignment given by
|
||||
/// the parent container.
|
||||
///
|
||||
/// [`Scrollable`]: struct.Scrollable.html
|
||||
pub fn align_self(mut self, align: Align) -> Self {
|
||||
self.align_self = Some(align);
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the horizontal alignment of the contents of the [`Scrollable`] .
|
||||
///
|
||||
/// [`Scrollable`]: struct.Scrollable.html
|
||||
|
|
@ -142,9 +129,9 @@ impl State {
|
|||
|
||||
pub fn offset(&self, bounds: Rectangle, content_bounds: Rectangle) -> u32 {
|
||||
let hidden_content =
|
||||
(content_bounds.height - bounds.height).round() as u32;
|
||||
(content_bounds.height - bounds.height).max(0.0).round() as u32;
|
||||
|
||||
self.offset.min(hidden_content).max(0)
|
||||
self.offset.min(hidden_content)
|
||||
}
|
||||
|
||||
pub fn is_scrollbar_grabbed(&self) -> bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue