From d15a61a1aa81317ae2414d8002a6e00475407cc3 Mon Sep 17 00:00:00 2001
From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Date: Mon, 10 Feb 2025 08:19:58 -0300
Subject: [PATCH] context menu: Adjust toggleable entry label alignment
(#24549)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Previously, we were passing an `IconSize` that had a default size. Given
the check icon is small by default, when the entry is not toggled, that
caused a slight misalignment between the toggled and not-toggled items.
I'm passing now the same icon element but inside an opacity 0 div. Open
to other suggestions if this feels clunky.
| Before | After |
|--------|--------|
|
|
|
Release Notes:
- N/A
---
crates/ui/src/components/context_menu.rs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/crates/ui/src/components/context_menu.rs b/crates/ui/src/components/context_menu.rs
index fe00c733f0..6d8e0a8678 100644
--- a/crates/ui/src/components/context_menu.rs
+++ b/crates/ui/src/components/context_menu.rs
@@ -672,15 +672,16 @@ impl Render for ContextMenu {
*toggle,
|list_item, (position, toggled)| {
let contents = if toggled {
- v_flex().flex_none().child(
+ div().flex_none().child(
Icon::new(IconName::Check)
.color(Color::Accent)
.size(*icon_size)
)
} else {
- v_flex().flex_none().size(
- IconSize::default().rems(),
- )
+ div().flex_none().child(
+ Icon::new(IconName::Check)
+ .size(*icon_size)
+ ).opacity(0.)
};
match position {
IconPosition::Start => {