From 93cee0abab8cd1a2969b668d2664951af9cfe75f Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Tue, 5 Dec 2023 15:58:20 +0100 Subject: [PATCH] fix(dropdown::multi::menu): vertically center-align separators --- src/widget/dropdown/multi/menu.rs | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/widget/dropdown/multi/menu.rs b/src/widget/dropdown/multi/menu.rs index 5cb5d01..0faedfe 100644 --- a/src/widget/dropdown/multi/menu.rs +++ b/src/widget/dropdown/multi/menu.rs @@ -515,7 +515,7 @@ where let mut current_offset = 0.0; for (elem, elem_height) in visible_options { - let bounds = Rectangle { + let mut bounds = Rectangle { x: bounds.x, y: bounds.y + current_offset, width: bounds.width, @@ -530,13 +530,15 @@ where let item_x = bounds.x + appearance.border_width; let item_width = bounds.width - appearance.border_width * 2.0; + bounds = Rectangle { + x: item_x, + width: item_width, + ..bounds + }; + renderer.fill_quad( renderer::Quad { - bounds: Rectangle { - x: item_x, - width: item_width, - ..bounds - }, + bounds, border_color: Color::TRANSPARENT, border_width: 0.0, border_radius: appearance.border_radius, @@ -563,13 +565,15 @@ where let item_x = bounds.x + appearance.border_width; let item_width = bounds.width - appearance.border_width * 2.0; + bounds = Rectangle { + x: item_x, + width: item_width, + ..bounds + }; + renderer.fill_quad( renderer::Quad { - bounds: Rectangle { - x: item_x, - width: item_width, - ..bounds - }, + bounds, border_color: Color::TRANSPARENT, border_width: 0.0, border_radius: appearance.border_radius, @@ -617,7 +621,7 @@ where layout_node.move_to(Point { x: bounds.x, - y: bounds.y + self.padding.top, + y: bounds.y + (self.padding.vertical() / 2.0) - 4.0, }); Widget::::draw(