Commit Graph

7 Commits

Author SHA1 Message Date
Dean Herbert b9d9fc56af Move files to UI namespace 2022-02-14 17:51:39 +09:00
Salman Ahmed 326f12f847 Add `IExpandable` support for `SettingsToolboxGroup` 2022-01-23 05:41:16 +03:00
Bartłomiej Dach 8f744c99ee
Fix settings toolbox toggle button starting in incorrect state
While displaying replays, the colour of the toolbox toggle button would
not match the actual state of the rest of the toolbox, i.e. both buttons
would be white, even though the "playback settings" section was expanded
and as such should have a yellow toggle button.

In the case of the replay player, the failure scenario was as follows:

1. `SettingsToolboxGroup` calls `updateExpanded()` in its BDL to update
   the initial state of the toolbox, including the toggle button
   colour, by adding a colour fade transform.

2. An ancestor of both the toolbox groups - `PlayerSettingsOverlay`,
   which is a `VisibilityContainer` - calls `FinishTransforms(true)` in
   its `LoadCompleteAsync()`, therefore instantly applying the colour
   from point (1) to the toggle button instantly.

3. However, `IconButton` inherits from `OsuAnimatedButton`. And
   `OsuAnimatedButton` changes its colour in `LoadComplete()`, therefore
   undoing the instant application from point (2).

This conjunction of circumstances is instrumental to reproducing the
bug, because if the `FinishTransforms(true)` call wasn't there, point
(3) wouldn't matter - the transform would get applied at some
indeterminate point in the future, ignoring the write from
`OsuAnimatedButton`.

As for the fix, move the `updateExpanded()` call in
`SettingsToolboxGroup` to `LoadComplete()` to avoid the above
unfortunate order. Applying initial visual state in `LoadComplete()` is
the idiomatic style of doing things these days anyhow.
2022-01-06 20:45:56 +01:00
Dean Herbert e02863f780 Avoid accessing `DrawWidth` from invalidation 2022-01-07 01:24:30 +09:00
Dean Herbert 5aca2dd4ce Hide header text when it won't fit in the toolbox group 2022-01-06 23:08:50 +09:00
Dean Herbert cea9cab4dc Use `ExpandingButtonContainer` in editor composer 2022-01-06 21:10:45 +09:00
Dean Herbert 5baaf356aa Split out `SettingsToolboxGroup` from `PlayerSettingsGroup` 2022-01-06 21:05:00 +09:00