mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 12:53:11 +08:00
Rename HitObjectMask -> SelectionMask
This commit is contained in:
parent
dbe055a877
commit
4cdb6dcea5
@ -15,7 +15,7 @@ using OpenTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
|
namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
|
||||||
{
|
{
|
||||||
public class HoldNoteMask : HitObjectMask
|
public class HoldNoteSelectionMask : SelectionMask
|
||||||
{
|
{
|
||||||
public new DrawableHoldNote HitObject => (DrawableHoldNote)base.HitObject;
|
public new DrawableHoldNote HitObject => (DrawableHoldNote)base.HitObject;
|
||||||
|
|
||||||
@ -23,13 +23,13 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
|
|||||||
|
|
||||||
private readonly BodyPiece body;
|
private readonly BodyPiece body;
|
||||||
|
|
||||||
public HoldNoteMask(DrawableHoldNote hold)
|
public HoldNoteSelectionMask(DrawableHoldNote hold)
|
||||||
: base(hold)
|
: base(hold)
|
||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new HoldNoteNoteMask(hold.Head),
|
new HoldNoteNoteSelectionMask(hold.Head),
|
||||||
new HoldNoteNoteMask(hold.Tail),
|
new HoldNoteNoteSelectionMask(hold.Tail),
|
||||||
body = new BodyPiece
|
body = new BodyPiece
|
||||||
{
|
{
|
||||||
AccentColour = Color4.Transparent
|
AccentColour = Color4.Transparent
|
||||||
@ -59,9 +59,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
|
|||||||
Y -= HitObject.Tail.DrawHeight;
|
Y -= HitObject.Tail.DrawHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class HoldNoteNoteMask : NoteMask
|
private class HoldNoteNoteSelectionMask : NoteSelectionMask
|
||||||
{
|
{
|
||||||
public HoldNoteNoteMask(DrawableNote note)
|
public HoldNoteNoteSelectionMask(DrawableNote note)
|
||||||
: base(note)
|
: base(note)
|
||||||
{
|
{
|
||||||
Select();
|
Select();
|
@ -9,9 +9,9 @@ using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
|
namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
|
||||||
{
|
{
|
||||||
public class NoteMask : HitObjectMask
|
public class NoteSelectionMask : SelectionMask
|
||||||
{
|
{
|
||||||
public NoteMask(DrawableNote note)
|
public NoteSelectionMask(DrawableNote note)
|
||||||
: base(note)
|
: base(note)
|
||||||
{
|
{
|
||||||
Scale = note.Scale;
|
Scale = note.Scale;
|
@ -40,14 +40,14 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
new HitObjectCompositionTool<HoldNote>("Hold"),
|
new HitObjectCompositionTool<HoldNote>("Hold"),
|
||||||
};
|
};
|
||||||
|
|
||||||
public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject)
|
public override SelectionMask CreateMaskFor(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
switch (hitObject)
|
switch (hitObject)
|
||||||
{
|
{
|
||||||
case DrawableNote note:
|
case DrawableNote note:
|
||||||
return new NoteMask(note);
|
return new NoteSelectionMask(note);
|
||||||
case DrawableHoldNote holdNote:
|
case DrawableHoldNote holdNote:
|
||||||
return new HoldNoteMask(holdNote);
|
return new HoldNoteSelectionMask(holdNote);
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CreateMaskFor(hitObject);
|
return base.CreateMaskFor(hitObject);
|
||||||
|
@ -10,9 +10,9 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
|
namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
|
||||||
{
|
{
|
||||||
public class HitCircleMask : HitObjectMask
|
public class HitCircleSelectionMask : SelectionMask
|
||||||
{
|
{
|
||||||
public HitCircleMask(DrawableHitCircle hitCircle)
|
public HitCircleSelectionMask(DrawableHitCircle hitCircle)
|
||||||
: base(hitCircle)
|
: base(hitCircle)
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
@ -12,21 +12,21 @@ using OpenTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
|
namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
|
||||||
{
|
{
|
||||||
public class SliderCircleMask : HitObjectMask
|
public class SliderCircleSelectionMask : SelectionMask
|
||||||
{
|
{
|
||||||
public SliderCircleMask(DrawableHitCircle sliderHead, DrawableSlider slider)
|
public SliderCircleSelectionMask(DrawableHitCircle sliderHead, DrawableSlider slider)
|
||||||
: this(sliderHead, Vector2.Zero, slider)
|
: this(sliderHead, Vector2.Zero, slider)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public SliderCircleMask(DrawableSliderTail sliderTail, DrawableSlider slider)
|
public SliderCircleSelectionMask(DrawableSliderTail sliderTail, DrawableSlider slider)
|
||||||
: this(sliderTail, ((Slider)slider.HitObject).Curve.PositionAt(1), slider)
|
: this(sliderTail, ((Slider)slider.HitObject).Curve.PositionAt(1), slider)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly DrawableOsuHitObject hitObject;
|
private readonly DrawableOsuHitObject hitObject;
|
||||||
|
|
||||||
private SliderCircleMask(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider)
|
private SliderCircleSelectionMask(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider)
|
||||||
: base(hitObject)
|
: base(hitObject)
|
||||||
{
|
{
|
||||||
this.hitObject = hitObject;
|
this.hitObject = hitObject;
|
@ -14,12 +14,12 @@ using OpenTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
|
namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
|
||||||
{
|
{
|
||||||
public class SliderMask : HitObjectMask
|
public class SliderSelectionMask : SelectionMask
|
||||||
{
|
{
|
||||||
private readonly SliderBody body;
|
private readonly SliderBody body;
|
||||||
private readonly DrawableSlider slider;
|
private readonly DrawableSlider slider;
|
||||||
|
|
||||||
public SliderMask(DrawableSlider slider)
|
public SliderSelectionMask(DrawableSlider slider)
|
||||||
: base(slider)
|
: base(slider)
|
||||||
{
|
{
|
||||||
this.slider = slider;
|
this.slider = slider;
|
||||||
@ -35,8 +35,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
|
|||||||
AccentColour = Color4.Transparent,
|
AccentColour = Color4.Transparent,
|
||||||
PathWidth = sliderObject.Scale * 64
|
PathWidth = sliderObject.Scale * 64
|
||||||
},
|
},
|
||||||
new SliderCircleMask(slider.HeadCircle, slider),
|
new SliderCircleSelectionMask(slider.HeadCircle, slider),
|
||||||
new SliderCircleMask(slider.TailCircle, slider),
|
new SliderCircleSelectionMask(slider.TailCircle, slider),
|
||||||
};
|
};
|
||||||
|
|
||||||
sliderObject.PositionChanged += _ => Position = slider.Position;
|
sliderObject.PositionChanged += _ => Position = slider.Position;
|
@ -33,14 +33,14 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
|
|
||||||
protected override ScalableContainer CreateLayerContainer() => new ScalableContainer(OsuPlayfield.BASE_SIZE.X) { RelativeSizeAxes = Axes.Both };
|
protected override ScalableContainer CreateLayerContainer() => new ScalableContainer(OsuPlayfield.BASE_SIZE.X) { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject)
|
public override SelectionMask CreateMaskFor(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
switch (hitObject)
|
switch (hitObject)
|
||||||
{
|
{
|
||||||
case DrawableHitCircle circle:
|
case DrawableHitCircle circle:
|
||||||
return new HitCircleMask(circle);
|
return new HitCircleSelectionMask(circle);
|
||||||
case DrawableSlider slider:
|
case DrawableSlider slider:
|
||||||
return new SliderMask(slider);
|
return new SliderSelectionMask(slider);
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CreateMaskFor(hitObject);
|
return base.CreateMaskFor(hitObject);
|
||||||
|
@ -348,7 +348,7 @@ namespace osu.Game.Beatmaps
|
|||||||
OnlineBeatmapSetID = beatmap.BeatmapInfo.BeatmapSet?.OnlineBeatmapSetID,
|
OnlineBeatmapSetID = beatmap.BeatmapInfo.BeatmapSet?.OnlineBeatmapSetID,
|
||||||
Beatmaps = new List<BeatmapInfo>(),
|
Beatmaps = new List<BeatmapInfo>(),
|
||||||
Hash = computeBeatmapSetHash(reader),
|
Hash = computeBeatmapSetHash(reader),
|
||||||
Metadata = beatmap.Metadata
|
Metadata = beatmap.Metadata,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,10 +151,10 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
protected abstract IReadOnlyList<ICompositionTool> CompositionTools { get; }
|
protected abstract IReadOnlyList<ICompositionTool> CompositionTools { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="HitObjectMask"/> for a specific <see cref="DrawableHitObject"/>.
|
/// Creates a <see cref="SelectionMask"/> for a specific <see cref="DrawableHitObject"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create the overlay for.</param>
|
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create the overlay for.</param>
|
||||||
public virtual HitObjectMask CreateMaskFor(DrawableHitObject hitObject) => null;
|
public virtual SelectionMask CreateMaskFor(DrawableHitObject hitObject) => null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="MaskSelection"/> which outlines <see cref="DrawableHitObject"/>s
|
/// Creates a <see cref="MaskSelection"/> which outlines <see cref="DrawableHitObject"/>s
|
||||||
|
@ -16,31 +16,31 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A mask placed above a <see cref="DrawableHitObject"/> adding editing functionality.
|
/// A mask placed above a <see cref="DrawableHitObject"/> adding editing functionality.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class HitObjectMask : CompositeDrawable, IStateful<SelectionState>
|
public class SelectionMask : CompositeDrawable, IStateful<SelectionState>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when this <see cref="HitObjectMask"/> has been selected.
|
/// Invoked when this <see cref="SelectionMask"/> has been selected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask> Selected;
|
public event Action<SelectionMask> Selected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when this <see cref="HitObjectMask"/> has been deselected.
|
/// Invoked when this <see cref="SelectionMask"/> has been deselected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask> Deselected;
|
public event Action<SelectionMask> Deselected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when this <see cref="HitObjectMask"/> has requested selection.
|
/// Invoked when this <see cref="SelectionMask"/> has requested selection.
|
||||||
/// Will fire even if already selected. Does not actually perform selection.
|
/// Will fire even if already selected. Does not actually perform selection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask, InputState> SelectionRequested;
|
public event Action<SelectionMask, InputState> SelectionRequested;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when this <see cref="HitObjectMask"/> has requested drag.
|
/// Invoked when this <see cref="SelectionMask"/> has requested drag.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask, Vector2, InputState> DragRequested;
|
public event Action<SelectionMask, Vector2, InputState> DragRequested;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="DrawableHitObject"/> which this <see cref="HitObjectMask"/> applies to.
|
/// The <see cref="DrawableHitObject"/> which this <see cref="SelectionMask"/> applies to.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly DrawableHitObject HitObject;
|
public readonly DrawableHitObject HitObject;
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
public override bool HandlePositionalInput => ShouldBeAlive;
|
public override bool HandlePositionalInput => ShouldBeAlive;
|
||||||
public override bool RemoveWhenNotAlive => false;
|
public override bool RemoveWhenNotAlive => false;
|
||||||
|
|
||||||
public HitObjectMask(DrawableHitObject hitObject)
|
public SelectionMask(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
HitObject = hitObject;
|
HitObject = hitObject;
|
||||||
|
|
||||||
@ -83,12 +83,12 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Selects this <see cref="HitObjectMask"/>, causing it to become visible.
|
/// Selects this <see cref="SelectionMask"/>, causing it to become visible.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Select() => State = SelectionState.Selected;
|
public void Select() => State = SelectionState.Selected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deselects this <see cref="HitObjectMask"/>, causing it to become invisible.
|
/// Deselects this <see cref="SelectionMask"/>, causing it to become invisible.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Deselect() => State = SelectionState.NotSelected;
|
public void Deselect() => State = SelectionState.NotSelected;
|
||||||
|
|
||||||
@ -130,12 +130,12 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The screen-space point that causes this <see cref="HitObjectMask"/> to be selected.
|
/// The screen-space point that causes this <see cref="SelectionMask"/> to be selected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual Vector2 SelectionPoint => ScreenSpaceDrawQuad.Centre;
|
public virtual Vector2 SelectionPoint => ScreenSpaceDrawQuad.Centre;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The screen-space quad that outlines this <see cref="HitObjectMask"/> for selections.
|
/// The screen-space quad that outlines this <see cref="SelectionMask"/> for selections.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual Quad SelectionQuad => ScreenSpaceDrawQuad;
|
public virtual Quad SelectionQuad => ScreenSpaceDrawQuad;
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ using OpenTK.Graphics;
|
|||||||
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A layer that handles and displays drag selection for a collection of <see cref="HitObjectMask"/>s.
|
/// A layer that handles and displays drag selection for a collection of <see cref="SelectionMask"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DragLayer : CompositeDrawable
|
public class DragLayer : CompositeDrawable
|
||||||
{
|
{
|
||||||
@ -30,7 +30,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="DragLayer"/>.
|
/// Creates a new <see cref="DragLayer"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="maskContainer">The selectable <see cref="HitObjectMask"/>s.</param>
|
/// <param name="maskContainer">The selectable <see cref="SelectionMask"/>s.</param>
|
||||||
public DragLayer(Action<RectangleF> performSelection)
|
public DragLayer(Action<RectangleF> performSelection)
|
||||||
{
|
{
|
||||||
this.performSelection = performSelection;
|
this.performSelection = performSelection;
|
||||||
|
@ -13,36 +13,36 @@ using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||||
{
|
{
|
||||||
public class MaskContainer : Container<HitObjectMask>
|
public class MaskContainer : Container<SelectionMask>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when any <see cref="HitObjectMask"/> is selected.
|
/// Invoked when any <see cref="SelectionMask"/> is selected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask> MaskSelected;
|
public event Action<SelectionMask> MaskSelected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when any <see cref="HitObjectMask"/> is deselected.
|
/// Invoked when any <see cref="SelectionMask"/> is deselected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask> MaskDeselected;
|
public event Action<SelectionMask> MaskDeselected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when any <see cref="HitObjectMask"/> requests selection.
|
/// Invoked when any <see cref="SelectionMask"/> requests selection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask, InputState> MaskSelectionRequested;
|
public event Action<SelectionMask, InputState> MaskSelectionRequested;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when any <see cref="HitObjectMask"/> requests drag.
|
/// Invoked when any <see cref="SelectionMask"/> requests drag.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<HitObjectMask, Vector2, InputState> MaskDragRequested;
|
public event Action<SelectionMask, Vector2, InputState> MaskDragRequested;
|
||||||
|
|
||||||
private IEnumerable<HitObjectMask> aliveMasks => AliveInternalChildren.Cast<HitObjectMask>();
|
private IEnumerable<SelectionMask> aliveMasks => AliveInternalChildren.Cast<SelectionMask>();
|
||||||
|
|
||||||
public MaskContainer()
|
public MaskContainer()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Add(HitObjectMask drawable)
|
public override void Add(SelectionMask drawable)
|
||||||
{
|
{
|
||||||
if (drawable == null) throw new ArgumentNullException(nameof(drawable));
|
if (drawable == null) throw new ArgumentNullException(nameof(drawable));
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
drawable.DragRequested += onDragRequested;
|
drawable.DragRequested += onDragRequested;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Remove(HitObjectMask drawable)
|
public override bool Remove(SelectionMask drawable)
|
||||||
{
|
{
|
||||||
if (drawable == null) throw new ArgumentNullException(nameof(drawable));
|
if (drawable == null) throw new ArgumentNullException(nameof(drawable));
|
||||||
|
|
||||||
@ -87,33 +87,33 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deselects all selected <see cref="HitObjectMask"/>s.
|
/// Deselects all selected <see cref="SelectionMask"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DeselectAll() => aliveMasks.ToList().ForEach(m => m.Deselect());
|
public void DeselectAll() => aliveMasks.ToList().ForEach(m => m.Deselect());
|
||||||
|
|
||||||
private void onMaskSelected(HitObjectMask mask)
|
private void onMaskSelected(SelectionMask mask)
|
||||||
{
|
{
|
||||||
MaskSelected?.Invoke(mask);
|
MaskSelected?.Invoke(mask);
|
||||||
ChangeChildDepth(mask, 1);
|
ChangeChildDepth(mask, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMaskDeselected(HitObjectMask mask)
|
private void onMaskDeselected(SelectionMask mask)
|
||||||
{
|
{
|
||||||
MaskDeselected?.Invoke(mask);
|
MaskDeselected?.Invoke(mask);
|
||||||
ChangeChildDepth(mask, 0);
|
ChangeChildDepth(mask, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSelectionRequested(HitObjectMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state);
|
private void onSelectionRequested(SelectionMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state);
|
||||||
private void onDragRequested(HitObjectMask mask, Vector2 delta, InputState state) => MaskDragRequested?.Invoke(mask, delta, state);
|
private void onDragRequested(SelectionMask mask, Vector2 delta, InputState state) => MaskDragRequested?.Invoke(mask, delta, state);
|
||||||
|
|
||||||
protected override int Compare(Drawable x, Drawable y)
|
protected override int Compare(Drawable x, Drawable y)
|
||||||
{
|
{
|
||||||
if (!(x is HitObjectMask xMask) || !(y is HitObjectMask yMask))
|
if (!(x is SelectionMask xMask) || !(y is SelectionMask yMask))
|
||||||
return base.Compare(x, y);
|
return base.Compare(x, y);
|
||||||
return Compare(xMask, yMask);
|
return Compare(xMask, yMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Compare(HitObjectMask x, HitObjectMask y)
|
public int Compare(SelectionMask x, SelectionMask y)
|
||||||
{
|
{
|
||||||
// dpeth is used to denote selected status (we always want selected masks to handle input first).
|
// dpeth is used to denote selected status (we always want selected masks to handle input first).
|
||||||
int d = x.Depth.CompareTo(y.Depth);
|
int d = x.Depth.CompareTo(y.Depth);
|
||||||
|
@ -16,19 +16,19 @@ using OpenTK;
|
|||||||
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A box which surrounds <see cref="HitObjectMask"/>s and provides interactive handles, context menus etc.
|
/// A box which surrounds <see cref="SelectionMask"/>s and provides interactive handles, context menus etc.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MaskSelection : CompositeDrawable
|
public class MaskSelection : CompositeDrawable
|
||||||
{
|
{
|
||||||
public const float BORDER_RADIUS = 2;
|
public const float BORDER_RADIUS = 2;
|
||||||
|
|
||||||
private readonly List<HitObjectMask> selectedMasks;
|
private readonly List<SelectionMask> selectedMasks;
|
||||||
|
|
||||||
private Drawable outline;
|
private Drawable outline;
|
||||||
|
|
||||||
public MaskSelection()
|
public MaskSelection()
|
||||||
{
|
{
|
||||||
selectedMasks = new List<HitObjectMask>();
|
selectedMasks = new List<SelectionMask>();
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
AlwaysPresent = true;
|
AlwaysPresent = true;
|
||||||
@ -54,7 +54,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
|
|
||||||
#region User Input Handling
|
#region User Input Handling
|
||||||
|
|
||||||
public void HandleDrag(HitObjectMask m, Vector2 delta, InputState state)
|
public void HandleDrag(SelectionMask m, Vector2 delta, InputState state)
|
||||||
{
|
{
|
||||||
// Todo: Various forms of snapping
|
// Todo: Various forms of snapping
|
||||||
|
|
||||||
@ -82,13 +82,13 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
/// Handle a mask becoming selected.
|
/// Handle a mask becoming selected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mask">The mask.</param>
|
/// <param name="mask">The mask.</param>
|
||||||
public void HandleSelected(HitObjectMask mask) => selectedMasks.Add(mask);
|
public void HandleSelected(SelectionMask mask) => selectedMasks.Add(mask);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle a mask becoming deselected.
|
/// Handle a mask becoming deselected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mask">The mask.</param>
|
/// <param name="mask">The mask.</param>
|
||||||
public void HandleDeselected(HitObjectMask mask)
|
public void HandleDeselected(SelectionMask mask)
|
||||||
{
|
{
|
||||||
selectedMasks.Remove(mask);
|
selectedMasks.Remove(mask);
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
/// Handle a mask requesting selection.
|
/// Handle a mask requesting selection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mask">The mask.</param>
|
/// <param name="mask">The mask.</param>
|
||||||
public void HandleSelectionRequested(HitObjectMask mask, InputState state)
|
public void HandleSelectionRequested(SelectionMask mask, InputState state)
|
||||||
{
|
{
|
||||||
if (state.Keyboard.ControlPressed)
|
if (state.Keyboard.ControlPressed)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user