mirror of
https://github.com/ppy/osu.git
synced 2025-03-04 06:12:57 +08:00
Make slider bar instantaneous by default (and fix broken implementation)
This commit is contained in:
parent
1b17231da4
commit
95e26e6fd8
@ -8,7 +8,6 @@ using osu.Framework.Graphics.Cursor;
|
|||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Graphics.UserInterfaceV2;
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.UserInterface
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
@ -72,8 +71,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
},
|
},
|
||||||
new FormSliderBar<float>
|
new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Caption = BeatmapsetsStrings.ShowStatsDrain,
|
Caption = "Instantaneous slider",
|
||||||
HintText = EditorSetupStrings.DrainRateDescription,
|
|
||||||
Current = new BindableFloat
|
Current = new BindableFloat
|
||||||
{
|
{
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
@ -82,6 +80,18 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
new FormSliderBar<float>
|
||||||
|
{
|
||||||
|
Caption = "Non-instantaneous slider",
|
||||||
|
Current = new BindableFloat
|
||||||
|
{
|
||||||
|
MinValue = 0,
|
||||||
|
MaxValue = 10,
|
||||||
|
Value = 5,
|
||||||
|
Precision = 0.1f,
|
||||||
|
},
|
||||||
|
Instantaneous = false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ using System.Numerics;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Extensions.ObjectExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -29,7 +30,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
set => current.Current = value;
|
set => current.Current = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool instantaneous;
|
private bool instantaneous = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether changes to the slider should instantaneously transfer to the text box (and vice versa).
|
/// Whether changes to the slider should instantaneously transfer to the text box (and vice versa).
|
||||||
@ -41,7 +42,9 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
instantaneous = value;
|
instantaneous = value;
|
||||||
slider.TransferValueOnCommit = !instantaneous;
|
|
||||||
|
if (slider.IsNotNull())
|
||||||
|
slider.TransferValueOnCommit = !instantaneous;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,6 +119,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Width = 0.5f,
|
Width = 0.5f,
|
||||||
Current = Current,
|
Current = Current,
|
||||||
|
TransferValueOnCommit = !instantaneous,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user