1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 09:42:54 +08:00

Handle controls with dragging state wrapped in underlying components

I'm not 100% sure about this approach but it'll do for now.
This commit is contained in:
Salman Ahmed 2022-01-21 17:47:11 +03:00
parent f4c7a332c3
commit 648e7f6bbc
3 changed files with 8 additions and 1 deletions

View File

@ -119,6 +119,6 @@ namespace osu.Game.Overlays
/// <summary>
/// Whether the given control is currently active, by checking whether it's hovered or dragged.
/// </summary>
private bool isControlActive(TControl control) => control.IsHovered || control.IsDragged;
private bool isControlActive(TControl control) => control.IsHovered || control.IsDragged || (control is ISettingsItem item && item.IsControlDragged);
}
}

View File

@ -14,5 +14,10 @@ namespace osu.Game.Overlays.Settings
/// Invoked when the setting value has changed.
/// </summary>
event Action SettingChanged;
/// <summary>
/// Returns whether the UI control is currently in a dragged state.
/// </summary>
bool IsControlDragged { get; }
}
}

View File

@ -105,6 +105,8 @@ namespace osu.Game.Overlays.Settings
public BindableBool Expanded { get; } = new BindableBool(true);
public bool IsControlDragged => Control.IsDragged;
public event Action SettingChanged;
public virtual IEnumerable<string> FilterTerms => Keywords == null ? new[] { LabelText.ToString() } : new List<string>(Keywords) { LabelText.ToString() }.ToArray();