1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +08:00

Add a way to hide the drag handle

This commit is contained in:
smoogipoo 2020-02-14 16:09:15 +09:00
parent 5e871f9838
commit 1909ea2bd3
2 changed files with 17 additions and 2 deletions

View File

@ -23,6 +23,9 @@ namespace osu.Game.Graphics.Containers
private Color4 handleColour = Color4.White;
/// <summary>
/// The colour of the drag handle.
/// </summary>
protected Color4 HandleColour
{
get => handleColour;
@ -38,6 +41,11 @@ namespace osu.Game.Graphics.Containers
}
}
/// <summary>
/// Whether the drag handle should be shown.
/// </summary>
protected virtual bool ShowDragHandle => true;
private PlaylistItemHandle handle;
protected OsuRearrangeableListItem(TModel item)
@ -50,6 +58,8 @@ namespace osu.Game.Graphics.Containers
[BackgroundDependencyLoader]
private void load()
{
Container handleContainer;
InternalChild = new GridContainer
{
RelativeSizeAxes = Axes.X,
@ -58,7 +68,7 @@ namespace osu.Game.Graphics.Containers
{
new[]
{
new Container
handleContainer = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -78,6 +88,9 @@ namespace osu.Game.Graphics.Containers
ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize) },
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }
};
if (!ShowDragHandle)
handleContainer.Alpha = 0;
}
protected override bool OnDragStart(DragStartEvent e)
@ -107,7 +120,7 @@ namespace osu.Game.Graphics.Containers
protected abstract Drawable CreateContent();
private class PlaylistItemHandle : SpriteIcon
public class PlaylistItemHandle : SpriteIcon
{
public bool HandlingDrag { get; private set; }
private bool isHovering;

View File

@ -34,6 +34,8 @@ namespace osu.Game.Screens.Multi
public Action<PlaylistItem> RequestSelection;
public Action<PlaylistItem> RequestDeletion;
protected override bool ShowDragHandle => allowEdit;
private Container maskingContainer;
private Container difficultyIconContainer;
private LinkFlowContainer beatmapText;