mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +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.UserInterfaceV2;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
@ -72,8 +71,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
},
|
||||
new FormSliderBar<float>
|
||||
{
|
||||
Caption = BeatmapsetsStrings.ShowStatsDrain,
|
||||
HintText = EditorSetupStrings.DrainRateDescription,
|
||||
Caption = "Instantaneous slider",
|
||||
Current = new BindableFloat
|
||||
{
|
||||
MinValue = 0,
|
||||
@ -82,6 +80,18 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
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.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -29,7 +30,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
set => current.Current = value;
|
||||
}
|
||||
|
||||
private bool instantaneous;
|
||||
private bool instantaneous = true;
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
{
|
||||
instantaneous = value;
|
||||
slider.TransferValueOnCommit = !instantaneous;
|
||||
|
||||
if (slider.IsNotNull())
|
||||
slider.TransferValueOnCommit = !instantaneous;
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,6 +119,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Width = 0.5f,
|
||||
Current = Current,
|
||||
TransferValueOnCommit = !instantaneous,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user