diff options
author | 2023-02-17 16:09:49 +0100 | |
---|---|---|
committer | 2023-02-17 16:09:49 +0100 | |
commit | 3320ac1126750ed1c462d4f1ff81a59c74d1e9fb (patch) | |
tree | 1bc13717cc9ea27cfdae3912745d2b52ec0c6330 /native/src/overlay | |
parent | 0872d078e2e3200e2aa2f5ee0005c34fff9effb7 (diff) | |
download | iced-3320ac1126750ed1c462d4f1ff81a59c74d1e9fb.tar.gz iced-3320ac1126750ed1c462d4f1ff81a59c74d1e9fb.tar.bz2 iced-3320ac1126750ed1c462d4f1ff81a59c74d1e9fb.zip |
Use `f32` for `Padding`
Diffstat (limited to 'native/src/overlay')
-rw-r--r-- | native/src/overlay/menu.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/native/src/overlay/menu.rs b/native/src/overlay/menu.rs index fac3028e..efee14d4 100644 --- a/native/src/overlay/menu.rs +++ b/native/src/overlay/menu.rs @@ -344,9 +344,7 @@ where let size = { let intrinsic = Size::new( 0.0, - text_size - + f32::from(self.padding.vertical()) - * self.options.len() as f32, + text_size + self.padding.vertical() * self.options.len() as f32, ); limits.resolve(intrinsic) @@ -387,7 +385,7 @@ where *self.hovered_option = Some( ((cursor_position.y - bounds.y) - / (text_size + f32::from(self.padding.vertical()))) + / (text_size + self.padding.vertical())) as usize, ); } @@ -402,7 +400,7 @@ where *self.hovered_option = Some( ((cursor_position.y - bounds.y) - / (text_size + f32::from(self.padding.vertical()))) + / (text_size + self.padding.vertical())) as usize, ); @@ -451,8 +449,7 @@ where let text_size = self.text_size.unwrap_or_else(|| renderer.default_size()); - let option_height = - (text_size + f32::from(self.padding.vertical())) as usize; + let option_height = (text_size + self.padding.vertical()) as usize; let offset = viewport.y - bounds.y; let start = (offset / option_height as f32) as usize; @@ -469,7 +466,7 @@ where x: bounds.x, y: bounds.y + (option_height * i) as f32, width: bounds.width, - height: text_size + f32::from(self.padding.vertical()), + height: text_size + self.padding.vertical(), }; if is_selected { @@ -487,12 +484,12 @@ where renderer.fill_text(Text { content: &option.to_string(), bounds: Rectangle { - x: bounds.x + self.padding.left as f32, + x: bounds.x + self.padding.left, y: bounds.center_y(), width: f32::INFINITY, ..bounds }, - size: f32::from(text_size), + size: text_size, font: self.font.clone(), color: if is_selected { appearance.selected_text_color |