mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 09:27:18 +09: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 System.Diagnostics;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
@ -84,7 +83,7 @@ namespace osu.Game.Skinning.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
var editor = new SkinEditor();
|
var editor = new SkinEditor();
|
||||||
editor.State.BindValueChanged(editorVisibilityChanged);
|
editor.State.BindValueChanged(visibility => updateComponentVisibility());
|
||||||
|
|
||||||
skinEditor = editor;
|
skinEditor = editor;
|
||||||
|
|
||||||
@ -107,13 +106,13 @@ namespace osu.Game.Skinning.Editor
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editorVisibilityChanged(ValueChangedEvent<Visibility> visibility)
|
private void updateComponentVisibility()
|
||||||
{
|
{
|
||||||
Debug.Assert(skinEditor != null);
|
Debug.Assert(skinEditor != null);
|
||||||
|
|
||||||
const float toolbar_padding_requirement = 0.18f;
|
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);
|
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();
|
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.
|
// AddOnce with parameter will ensure the newest target is loaded if there is any overlap.
|
||||||
Scheduler.AddOnce(setTarget, screen);
|
Scheduler.AddOnce(setTarget, screen);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user