From b5e93b98c9376e4d283d81ff64f3d7aa3ff88ac0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 27 Jan 2026 18:41:27 +0900 Subject: [PATCH] Fix mismatching spacing in dropdown form menus --- .../UserInterfaceV2/FormControlBackground.cs | 7 +++++-- osu.Game/Graphics/UserInterfaceV2/FormDropdown.cs | 13 ++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/UserInterfaceV2/FormControlBackground.cs b/osu.Game/Graphics/UserInterfaceV2/FormControlBackground.cs index c576bad0f9..43c1c87f1c 100644 --- a/osu.Game/Graphics/UserInterfaceV2/FormControlBackground.cs +++ b/osu.Game/Graphics/UserInterfaceV2/FormControlBackground.cs @@ -15,6 +15,9 @@ namespace osu.Game.Graphics.UserInterfaceV2 { public partial class FormControlBackground : CompositeDrawable { + public const float CORNER_EXPONENT = 2.5f; + public const float BORDER_THICKNESS = 2.5f; + private bool styleDisabled; public bool StyleDisabled @@ -61,9 +64,9 @@ namespace osu.Game.Graphics.UserInterfaceV2 Masking = true; CornerRadius = 5; - CornerExponent = 2.5f; - BorderThickness = 2.5f; + CornerExponent = CORNER_EXPONENT; + BorderThickness = BORDER_THICKNESS; InternalChildren = new Drawable[] { diff --git a/osu.Game/Graphics/UserInterfaceV2/FormDropdown.cs b/osu.Game/Graphics/UserInterfaceV2/FormDropdown.cs index d7860bab4f..009d439b08 100644 --- a/osu.Game/Graphics/UserInterfaceV2/FormDropdown.cs +++ b/osu.Game/Graphics/UserInterfaceV2/FormDropdown.cs @@ -156,8 +156,6 @@ namespace osu.Game.Graphics.UserInterfaceV2 Masking = true; CornerRadius = 5; - Margin = new MarginPadding { Bottom = header_menu_spacing }; - // We use our own background for more control. Background.Alpha = 0; @@ -290,7 +288,8 @@ namespace osu.Game.Graphics.UserInterfaceV2 { ItemsContainer.Padding = new MarginPadding(9); - MaskingContainer.BorderThickness = 2; + MaskingContainer.BorderThickness = FormControlBackground.BORDER_THICKNESS; + MaskingContainer.CornerExponent = FormControlBackground.CORNER_EXPONENT; MaskingContainer.BorderColour = colourProvider.Highlight1; } @@ -301,13 +300,17 @@ namespace osu.Game.Graphics.UserInterfaceV2 // there's negative bottom margin applied on the whole dropdown control to remove extra spacing when the menu is closed. // however, when the menu is open, we want spacing between the menu and the next control below it. therefore apply bottom margin here. // we use a transform to keep the open animation smooth while margin is adjusted. - this.TransformTo(nameof(Margin), new MarginPadding { Bottom = header_menu_spacing }, 300, Easing.OutQuint); + this.TransformTo(nameof(Margin), new MarginPadding + { + Top = header_menu_spacing, + Bottom = header_menu_spacing + }, 50, Easing.OutQuint); } protected override void AnimateClose() { base.AnimateClose(); - this.TransformTo(nameof(Margin), new MarginPadding { Bottom = 0 }, 300, Easing.OutQuint); + this.TransformTo(nameof(Margin), new MarginPadding { Bottom = 0 }, 300); } } }