mirror of
https://github.com/ppy/osu
synced 2025-01-09 23:59:44 +00:00
Ensure toolbar is hidden even when the active screen is changed while the editor is open
This commit is contained in:
parent
86960c791f
commit
c807ad7e4e
@ -4,7 +4,6 @@
|
||||
using System.Diagnostics;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
@ -84,7 +83,7 @@ namespace osu.Game.Skinning.Editor
|
||||
}
|
||||
|
||||
var editor = new SkinEditor();
|
||||
editor.State.BindValueChanged(editorVisibilityChanged);
|
||||
editor.State.BindValueChanged(visibility => updateComponentVisibility());
|
||||
|
||||
skinEditor = editor;
|
||||
|
||||
@ -107,13 +106,13 @@ namespace osu.Game.Skinning.Editor
|
||||
});
|
||||
}
|
||||
|
||||
private void editorVisibilityChanged(ValueChangedEvent<Visibility> visibility)
|
||||
private void updateComponentVisibility()
|
||||
{
|
||||
Debug.Assert(skinEditor != null);
|
||||
|
||||
const float toolbar_padding_requirement = 0.18f;
|
||||
|
||||
if (visibility.NewValue == Visibility.Visible)
|
||||
if (skinEditor.State.Value == Visibility.Visible)
|
||||
{
|
||||
scalingContainer.SetCustomRect(new RectangleF(toolbar_padding_requirement, 0.1f, 0.8f - toolbar_padding_requirement, 0.7f), true);
|
||||
|
||||
@ -144,6 +143,9 @@ namespace osu.Game.Skinning.Editor
|
||||
|
||||
skinEditor.Save();
|
||||
|
||||
// ensure the toolbar is re-hidden even if a new screen decides to try and show it.
|
||||
updateComponentVisibility();
|
||||
|
||||
// AddOnce with parameter will ensure the newest target is loaded if there is any overlap.
|
||||
Scheduler.AddOnce(setTarget, screen);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user