feat: add overflow option to Pin widget to allow content beyond boundaries
This commit is contained in:
parent
ba4f09b7bf
commit
dc0e80edd8
1 changed files with 14 additions and 2 deletions
|
|
@ -60,6 +60,7 @@ where
|
|||
width: Length,
|
||||
height: Length,
|
||||
position: Point,
|
||||
overflow: bool,
|
||||
}
|
||||
|
||||
impl<'a, Message, Theme, Renderer> Pin<'a, Message, Theme, Renderer>
|
||||
|
|
@ -75,6 +76,7 @@ where
|
|||
width: Length::Fill,
|
||||
height: Length::Fill,
|
||||
position: Point::ORIGIN,
|
||||
overflow: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -107,6 +109,12 @@ where
|
|||
self.position.y = y.into().0;
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets whether the [`Pin`] can overflow its boundaries.
|
||||
pub fn overflow(mut self, overflow: bool) -> Self {
|
||||
self.overflow = overflow;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<Message, Theme, Renderer> Widget<Message, Theme, Renderer>
|
||||
|
|
@ -146,7 +154,11 @@ where
|
|||
let limits = limits.width(self.width).height(self.height);
|
||||
|
||||
let available =
|
||||
limits.max() - Size::new(self.position.x, self.position.y);
|
||||
if self.overflow {
|
||||
limits.max()
|
||||
} else {
|
||||
limits.max() - Size::new(self.position.x, self.position.y)
|
||||
};
|
||||
|
||||
let node = self
|
||||
.content
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue