Skip to content

Refactor ShearedButton to allow easier relative sizing#36802

Merged
peppy merged 3 commits intoppy:masterfrom
LiquidPL:sheared-button-relative-sizing
Mar 5, 2026
Merged

Refactor ShearedButton to allow easier relative sizing#36802
peppy merged 3 commits intoppy:masterfrom
LiquidPL:sheared-button-relative-sizing

Conversation

@LiquidPL
Copy link
Copy Markdown
Contributor

@LiquidPL LiquidPL commented Mar 3, 2026

This commit rearranges the contents of ShearedButtons to be more independent of each other in regards to sizing. Thanks to that, the custom logic related to enabling autosizing is no longer necessary. Witdh and height are no longer set via the constructor, and can be freely configured using the initializer syntax.

Additionally, this allows the button to use relative sizing without having to resort to any hackery with Size (this will come in handy for me when implementing the new footer on multiplayer screens).

Given that most of the ShearedButtons currently in use set their width explicitly, I did not set AutoSizeAxes = Axes.X like it would be by default previously. Instead it is set on the only two such buttons (show converts/selected mods on ssv2). I suppose it might be a good idea to have it set that by default if no Width is specified, as right now it'll just not show anything.

Also I've set the margin on the text field by default in all cases instead of only when autosizing like how it was previously, since otherwise it would be a pain to set that on each button instance when needed. I've checked all affected components and could not find any text overflowing issues that this could cause.

This commit rearranges the contents of `ShearedButtons` to be more
independent of each other in regards to sizing. Thanks to that,
the custom logic related to enabling autosizing is no longer
necessary. With and height are no longer set via the constructor,
and can be freely configured using the initializer syntax.

Additionally, this allows the button to use relative sizing without
having to resort to any hackery with `Size`.
LiquidPL added a commit to LiquidPL/osu that referenced this pull request Mar 5, 2026
Related to (but shouldn't depend on) ppy#36802.
Depends on ppy/osu-resources#408.

Pushing this ahead of time mostly to set the new icon on the add to playlist button.
LiquidPL added a commit to LiquidPL/osu that referenced this pull request Mar 5, 2026
Related to (but shouldn't depend on) ppy#36802.
Depends on ppy/osu-resources#408.

Pushing this ahead of time mostly to set the new icon on the add to playlist button.
LiquidPL added a commit to LiquidPL/osu that referenced this pull request Mar 5, 2026
Depends on ppy#36802 and ppy/osu-resources#408.

Pushing this ahead of time mostly to set the new icon on the add to playlist button.
LiquidPL added a commit to LiquidPL/osu that referenced this pull request Mar 5, 2026
Depends on ppy#36802 and ppy/osu-resources#408.

This moves out the common layout from `AddToPlaylistFooterButton` to
a separate `ShearedFooterButton`, that is intended to be used
in other screens which I'm currently working on migrating them to the
new footer.

It also adds a new 'add' icon to be used on the playlists button.

Pushing this ahead of time (without any other buttons using it yet)
mostly to get the new icon on the add to playlist button.

I've set the icon size to `20`. Could get it smaller, howvever
I think it should be a *bit* taller than the button label.
@peppy peppy self-requested a review March 5, 2026 16:32
@peppy peppy merged commit b76a7e1 into ppy:master Mar 5, 2026
1 check passed
@LiquidPL LiquidPL deleted the sheared-button-relative-sizing branch March 5, 2026 17:10
LiquidPL added a commit to LiquidPL/osu that referenced this pull request Mar 13, 2026
Depends on ppy#36802 and ppy/osu-resources#408.

This moves out the common layout from `AddToPlaylistFooterButton` to
a separate `ShearedFooterButton`, that is intended to be used
in other screens which I'm currently working on migrating them to the
new footer.

It also adds a new 'add' icon to be used on the playlists button.

Pushing this ahead of time (without any other buttons using it yet)
mostly to get the new icon on the add to playlist button.

I've set the icon size to `20`. Could get it smaller, howvever
I think it should be a *bit* taller than the button label.
LiquidPL added a commit to LiquidPL/osu that referenced this pull request Mar 23, 2026
Depends on ppy#36802 and ppy/osu-resources#408.

This moves out the common layout from `AddToPlaylistFooterButton` to
a separate `ShearedFooterButton`, that is intended to be used
in other screens which I'm currently working on migrating them to the
new footer.

It also adds a new 'add' icon to be used on the playlists button.

Pushing this ahead of time (without any other buttons using it yet)
mostly to get the new icon on the add to playlist button.

I've set the icon size to `20`. Could get it smaller, howvever
I think it should be a *bit* taller than the button label.

# Conflicts:
#	osu.Game/Screens/OnlinePlay/Playlists/AddToPlaylistFooterButton.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants