Use Padding::horizontal and Padding::vertical helpers
This commit is contained in:
parent
2e17d7860b
commit
b94cd7a2a8
5 changed files with 10 additions and 14 deletions
|
|
@ -119,8 +119,8 @@ impl Limits {
|
|||
/// Shrinks the current [`Limits`] to account for the given padding.
|
||||
pub fn pad(&self, padding: Padding) -> Limits {
|
||||
self.shrink(Size::new(
|
||||
(padding.left + padding.right) as f32,
|
||||
(padding.top + padding.bottom) as f32,
|
||||
padding.horizontal() as f32,
|
||||
padding.vertical() as f32,
|
||||
))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ where
|
|||
let size = {
|
||||
let intrinsic = Size::new(
|
||||
0.0,
|
||||
f32::from(text_size + self.padding.top + self.padding.bottom)
|
||||
f32::from(text_size + self.padding.vertical())
|
||||
* self.options.len() as f32,
|
||||
);
|
||||
|
||||
|
|
@ -364,11 +364,8 @@ where
|
|||
|
||||
*self.hovered_option = Some(
|
||||
((cursor_position.y - bounds.y)
|
||||
/ f32::from(
|
||||
text_size
|
||||
+ self.padding.top
|
||||
+ self.padding.bottom,
|
||||
)) as usize,
|
||||
/ f32::from(text_size + self.padding.vertical()))
|
||||
as usize,
|
||||
);
|
||||
|
||||
if let Some(index) = *self.hovered_option {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue