Add in new convenience function for a hidden Scrollbar

This commit is contained in:
ellieplayswow 2025-02-01 00:21:41 +00:00 committed by Héctor Ramón Jiménez
parent 281e58da8e
commit fd1d9654b0
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -332,6 +332,12 @@ impl Scrollbar {
Self::default()
}
/// Create a [`Scrollbar`] with zero width to allow a [`Scrollable`] to scroll without a visible
/// scroller.
pub fn hidden() -> Self {
Self::default().width(0).scroller_width(0)
}
/// Sets the scrollbar width of the [`Scrollbar`] .
pub fn width(mut self, width: impl Into<Pixels>) -> Self {
self.width = width.into().0.max(0.0);