fix(segmented_button): misaligned next tab button

This commit is contained in:
Michael Aaron Murphy 2024-01-27 02:38:07 +01:00
parent 135770a16d
commit 213ede371b
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
2 changed files with 5 additions and 16 deletions

View file

@ -152,7 +152,7 @@ where
// If collapsed, use the maximum width available.
visible_width = if state.collapsed {
max_size.width - f32::from(self.button_height)
max_size.width
} else {
total_width
};

View file

@ -475,7 +475,7 @@ where
} else {
// Check if the next tab button was clicked.
if cursor_position.is_over(Rectangle {
x: bounds.width - f32::from(self.button_height) / 4.0 - 8.0,
x: bounds.x + bounds.width - f32::from(self.button_height),
y: bounds.y,
width: f32::from(self.button_height),
height: f32::from(self.button_height),
@ -803,13 +803,7 @@ where
renderer.fill_quad(
renderer::Quad {
bounds: Rectangle {
x: bounds.width
- f32::from(self.button_height) / 2.0
- if let Length::Shrink = self.width {
0.0
} else {
8.0
},
x: bounds.x + bounds.width - f32::from(self.button_height),
y: bounds.y,
width: f32::from(self.button_height),
height: bounds.height,
@ -838,13 +832,8 @@ where
appearance.inactive.text_color
},
Rectangle {
x: bounds.width
- f32::from(self.button_height) / 4.0
- if let Length::Shrink = self.width {
0.0
} else {
8.0
},
x: bounds.x + bounds.width - f32::from(self.button_height)
+ f32::from(self.button_height) / 4.0,
y: bounds.y + f32::from(self.button_height) / 4.0,
width: 16.0,
height: 16.0,