mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Add ability for loading layer to not block input
This commit is contained in:
parent
c35b4ef914
commit
4da9482a3e
@ -20,6 +20,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class LoadingLayer : LoadingSpinner
|
public class LoadingLayer : LoadingSpinner
|
||||||
{
|
{
|
||||||
|
private readonly bool blockInput;
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
protected Box BackgroundDimLayer { get; }
|
protected Box BackgroundDimLayer { get; }
|
||||||
|
|
||||||
@ -28,9 +30,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dimBackground">Whether the full background area should be dimmed while loading.</param>
|
/// <param name="dimBackground">Whether the full background area should be dimmed while loading.</param>
|
||||||
/// <param name="withBox">Whether the spinner should have a surrounding black box for visibility.</param>
|
/// <param name="withBox">Whether the spinner should have a surrounding black box for visibility.</param>
|
||||||
public LoadingLayer(bool dimBackground = false, bool withBox = true)
|
/// <param name="blockInput">Whether to block input of components behind the loading layer.</param>
|
||||||
|
public LoadingLayer(bool dimBackground = false, bool withBox = true, bool blockInput = true)
|
||||||
: base(withBox)
|
: base(withBox)
|
||||||
{
|
{
|
||||||
|
this.blockInput = blockInput;
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
Size = new Vector2(1);
|
Size = new Vector2(1);
|
||||||
|
|
||||||
@ -52,6 +56,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected override bool Handle(UIEvent e)
|
protected override bool Handle(UIEvent e)
|
||||||
{
|
{
|
||||||
|
if (!blockInput)
|
||||||
|
return false;
|
||||||
|
|
||||||
switch (e)
|
switch (e)
|
||||||
{
|
{
|
||||||
// blocking scroll can cause weird behaviour when this layer is used within a ScrollContainer.
|
// blocking scroll can cause weird behaviour when this layer is used within a ScrollContainer.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user