From 213ede371b8f37780267542eb2e1af09ca0173fc Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Sat, 27 Jan 2024 02:38:07 +0100 Subject: [PATCH] fix(segmented_button): misaligned next tab button --- src/widget/segmented_button/horizontal.rs | 2 +- src/widget/segmented_button/widget.rs | 19 ++++--------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/widget/segmented_button/horizontal.rs b/src/widget/segmented_button/horizontal.rs index f308a949..9ba58022 100644 --- a/src/widget/segmented_button/horizontal.rs +++ b/src/widget/segmented_button/horizontal.rs @@ -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 }; diff --git a/src/widget/segmented_button/widget.rs b/src/widget/segmented_button/widget.rs index 071ad562..a223525a 100644 --- a/src/widget/segmented_button/widget.rs +++ b/src/widget/segmented_button/widget.rs @@ -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,