mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 07:22:55 +08:00
IsEnabled property for drag bar of music controller.
This commit is contained in:
parent
19897013a0
commit
3a4fb2ffed
@ -16,6 +16,18 @@ namespace osu.Game.Overlays
|
|||||||
public Action<float> SeekRequested;
|
public Action<float> SeekRequested;
|
||||||
private bool isDragging;
|
private bool isDragging;
|
||||||
|
|
||||||
|
private bool enabled;
|
||||||
|
public bool IsEnabled
|
||||||
|
{
|
||||||
|
get { return enabled; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
enabled = value;
|
||||||
|
if (!enabled)
|
||||||
|
fill.Width = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public DragBar()
|
public DragBar()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
@ -34,13 +46,14 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
public void UpdatePosition(float position)
|
public void UpdatePosition(float position)
|
||||||
{
|
{
|
||||||
if (isDragging) return;
|
if (isDragging || !IsEnabled) return;
|
||||||
|
|
||||||
fill.Width = position;
|
fill.Width = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void seek(InputState state)
|
private void seek(InputState state)
|
||||||
{
|
{
|
||||||
|
if (!IsEnabled) return;
|
||||||
float seekLocation = state.Mouse.Position.X / DrawWidth;
|
float seekLocation = state.Mouse.Position.X / DrawWidth;
|
||||||
SeekRequested?.Invoke(seekLocation);
|
SeekRequested?.Invoke(seekLocation);
|
||||||
fill.Width = seekLocation;
|
fill.Width = seekLocation;
|
||||||
|
@ -240,6 +240,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private void workingChanged(object sender = null, EventArgs e = null)
|
private void workingChanged(object sender = null, EventArgs e = null)
|
||||||
{
|
{
|
||||||
|
progress.IsEnabled = (beatmapSource.Value != null);
|
||||||
if (beatmapSource.Value == current) return;
|
if (beatmapSource.Value == current) return;
|
||||||
bool audioEquals = current?.BeatmapInfo.AudioEquals(beatmapSource.Value.BeatmapInfo) ?? false;
|
bool audioEquals = current?.BeatmapInfo.AudioEquals(beatmapSource.Value.BeatmapInfo) ?? false;
|
||||||
current = beatmapSource.Value;
|
current = beatmapSource.Value;
|
||||||
|
Loading…
Reference in New Issue
Block a user