mirror of
https://github.com/ppy/osu.git
synced 2025-01-21 06:42:54 +08:00
Hide drag handles of all playlist items not currently being dragged
This commit is contained in:
parent
0c30e802c0
commit
48350638a2
@ -18,6 +18,11 @@ namespace osu.Game.Overlays.Music
|
|||||||
|
|
||||||
public readonly Bindable<BeatmapSetInfo> SelectedSet = new Bindable<BeatmapSetInfo>();
|
public readonly Bindable<BeatmapSetInfo> SelectedSet = new Bindable<BeatmapSetInfo>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether any item is currently being dragged. Used to hide other items' drag handles.
|
||||||
|
/// </summary>
|
||||||
|
private readonly BindableBool playlistDragActive = new BindableBool();
|
||||||
|
|
||||||
public new MarginPadding Padding
|
public new MarginPadding Padding
|
||||||
{
|
{
|
||||||
get => base.Padding;
|
get => base.Padding;
|
||||||
@ -31,6 +36,7 @@ namespace osu.Game.Overlays.Music
|
|||||||
protected override RearrangeableListItem<BeatmapSetInfo> CreateDrawable(BeatmapSetInfo item) => new PlaylistItem(item)
|
protected override RearrangeableListItem<BeatmapSetInfo> CreateDrawable(BeatmapSetInfo item) => new PlaylistItem(item)
|
||||||
{
|
{
|
||||||
SelectedSet = { BindTarget = SelectedSet },
|
SelectedSet = { BindTarget = SelectedSet },
|
||||||
|
PlaylistDragActive = { BindTarget = playlistDragActive },
|
||||||
RequestSelection = set => RequestSelection?.Invoke(set)
|
RequestSelection = set => RequestSelection?.Invoke(set)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,7 +23,10 @@ namespace osu.Game.Overlays.Music
|
|||||||
{
|
{
|
||||||
private const float fade_duration = 100;
|
private const float fade_duration = 100;
|
||||||
|
|
||||||
|
public BindableBool PlaylistDragActive = new BindableBool();
|
||||||
|
|
||||||
public readonly Bindable<BeatmapSetInfo> SelectedSet = new Bindable<BeatmapSetInfo>();
|
public readonly Bindable<BeatmapSetInfo> SelectedSet = new Bindable<BeatmapSetInfo>();
|
||||||
|
|
||||||
public Action<BeatmapSetInfo> RequestSelection;
|
public Action<BeatmapSetInfo> RequestSelection;
|
||||||
|
|
||||||
private PlaylistItemHandle handle;
|
private PlaylistItemHandle handle;
|
||||||
@ -122,11 +125,26 @@ namespace osu.Game.Overlays.Music
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnDragStart(DragStartEvent e)
|
||||||
|
{
|
||||||
|
if (!base.OnDragStart(e))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
PlaylistDragActive.Value = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDragEnd(DragEndEvent e)
|
||||||
|
{
|
||||||
|
PlaylistDragActive.Value = false;
|
||||||
|
base.OnDragEnd(e);
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool IsDraggableAt(Vector2 screenSpacePos) => handle.HandlingDrag;
|
protected override bool IsDraggableAt(Vector2 screenSpacePos) => handle.HandlingDrag;
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
handle.UpdateHoverState(true);
|
handle.UpdateHoverState(IsDragged || !PlaylistDragActive.Value);
|
||||||
return base.OnHover(e);
|
return base.OnHover(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user