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

Fix selection changing when clicking overlapping hitobjects

This commit is contained in:
Dean Herbert 2018-04-06 11:22:36 +09:00
parent 24b9a8c983
commit 32e8d93596
2 changed files with 17 additions and 3 deletions

View File

@ -86,8 +86,18 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
/// </summary>
public void DeselectAll() => aliveMasks.ToList().ForEach(m => m.Deselect());
private void onMaskSelected(HitObjectMask mask) => MaskSelected?.Invoke(mask);
private void onMaskDeselected(HitObjectMask mask) => MaskDeselected?.Invoke(mask);
private void onMaskSelected(HitObjectMask mask)
{
MaskSelected?.Invoke(mask);
ChangeChildDepth(mask, 1);
}
private void onMaskDeselected(HitObjectMask mask)
{
MaskDeselected?.Invoke(mask);
ChangeChildDepth(mask, 0);
}
private void onSelectionRequested(HitObjectMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state);
private void onDragRequested(HitObjectMask mask, InputState state) => MaskDragRequested?.Invoke(mask, state);
@ -100,6 +110,11 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
public int Compare(HitObjectMask x, HitObjectMask y)
{
// dpeth is used to denote selected status (we always want selected masks to handle input first).
int d = x.Depth.CompareTo(y.Depth);
if (d != 0)
return d;
// Put earlier hitobjects towards the end of the list, so they handle input first
int i = y.HitObject.HitObject.StartTime.CompareTo(x.HitObject.HitObject.StartTime);
return i == 0 ? CompareReverseChildID(x, y) : i;

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;