mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 04:42:58 +08:00
MaskSelection -> SelectionBox
This commit is contained in:
parent
65bb91dcf7
commit
ad2836a61e
@ -28,7 +28,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
typeof(MaskSelection),
|
typeof(SelectionBox),
|
||||||
typeof(DragBox),
|
typeof(DragBox),
|
||||||
typeof(HitObjectComposer),
|
typeof(HitObjectComposer),
|
||||||
typeof(OsuHitObjectComposer),
|
typeof(OsuHitObjectComposer),
|
||||||
|
@ -165,10 +165,10 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
public virtual SelectionMask 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="SelectionBox"/> which outlines <see cref="DrawableHitObject"/>s
|
||||||
/// and handles hitobject pattern adjustments.
|
/// and handles hitobject pattern adjustments.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual MaskSelection CreateMaskSelection() => new MaskSelection();
|
public virtual SelectionBox CreateMaskSelection() => new SelectionBox();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="ScalableContainer"/> which provides a layer above or below the <see cref="Playfield"/>.
|
/// Creates a <see cref="ScalableContainer"/> which provides a layer above or below the <see cref="Playfield"/>.
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
public class BlueprintContainer : CompositeDrawable
|
public class BlueprintContainer : CompositeDrawable
|
||||||
{
|
{
|
||||||
private SelectionBlueprintContainer selectionBlueprints;
|
private SelectionBlueprintContainer selectionBlueprints;
|
||||||
private MaskSelection maskSelection;
|
private SelectionBox selectionBox;
|
||||||
|
|
||||||
private IEnumerable<SelectionMask> aliveMasks => selectionBlueprints.Children.Where(c => c.IsAlive);
|
private IEnumerable<SelectionMask> aliveMasks => selectionBlueprints.Children.Where(c => c.IsAlive);
|
||||||
|
|
||||||
@ -33,16 +33,16 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
maskSelection = composer.CreateMaskSelection();
|
selectionBox = composer.CreateMaskSelection();
|
||||||
maskSelection.DeselectAll = deselectAll;
|
selectionBox.DeselectAll = deselectAll;
|
||||||
|
|
||||||
var dragBox = new DragBox(select);
|
var dragBox = new DragBox(select);
|
||||||
dragBox.DragEnd += () => maskSelection.UpdateVisibility();
|
dragBox.DragEnd += () => selectionBox.UpdateVisibility();
|
||||||
|
|
||||||
InternalChildren = new[]
|
InternalChildren = new[]
|
||||||
{
|
{
|
||||||
dragBox,
|
dragBox,
|
||||||
maskSelection,
|
selectionBox,
|
||||||
selectionBlueprints = new SelectionBlueprintContainer { RelativeSizeAxes = Axes.Both },
|
selectionBlueprints = new SelectionBlueprintContainer { RelativeSizeAxes = Axes.Both },
|
||||||
dragBox.CreateProxy()
|
dragBox.CreateProxy()
|
||||||
};
|
};
|
||||||
@ -117,19 +117,19 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
|
|
||||||
private void onMaskSelected(SelectionMask mask)
|
private void onMaskSelected(SelectionMask mask)
|
||||||
{
|
{
|
||||||
maskSelection.HandleSelected(mask);
|
selectionBox.HandleSelected(mask);
|
||||||
selectionBlueprints.ChangeChildDepth(mask, 1);
|
selectionBlueprints.ChangeChildDepth(mask, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMaskDeselected(SelectionMask mask)
|
private void onMaskDeselected(SelectionMask mask)
|
||||||
{
|
{
|
||||||
maskSelection.HandleDeselected(mask);
|
selectionBox.HandleDeselected(mask);
|
||||||
selectionBlueprints.ChangeChildDepth(mask, 0);
|
selectionBlueprints.ChangeChildDepth(mask, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSelectionRequested(SelectionMask mask, InputState state) => maskSelection.HandleSelectionRequested(mask, state);
|
private void onSelectionRequested(SelectionMask mask, InputState state) => selectionBox.HandleSelectionRequested(mask, state);
|
||||||
|
|
||||||
private void onDragRequested(SelectionMask mask, Vector2 delta, InputState state) => maskSelection.HandleDrag(mask, delta, state);
|
private void onDragRequested(SelectionMask mask, Vector2 delta, InputState state) => selectionBox.HandleDrag(mask, delta, state);
|
||||||
|
|
||||||
private class SelectionBlueprintContainer : Container<SelectionMask>
|
private class SelectionBlueprintContainer : Container<SelectionMask>
|
||||||
{
|
{
|
||||||
|
@ -46,7 +46,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
{
|
{
|
||||||
Masking = true,
|
Masking = true,
|
||||||
BorderColour = Color4.White,
|
BorderColour = Color4.White,
|
||||||
BorderThickness = MaskSelection.BORDER_RADIUS,
|
BorderThickness = SelectionBox.BORDER_RADIUS,
|
||||||
Child = new Box
|
Child = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A box which surrounds <see cref="SelectionMask"/>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 SelectionBox : CompositeDrawable
|
||||||
{
|
{
|
||||||
public const float BORDER_RADIUS = 2;
|
public const float BORDER_RADIUS = 2;
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IPlacementHandler placementHandler { get; set; }
|
private IPlacementHandler placementHandler { get; set; }
|
||||||
|
|
||||||
public MaskSelection()
|
public SelectionBox()
|
||||||
{
|
{
|
||||||
selectedMasks = new List<SelectionMask>();
|
selectedMasks = new List<SelectionMask>();
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates whether this <see cref="MaskSelection"/> is visible.
|
/// Updates whether this <see cref="SelectionBox"/> is visible.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal void UpdateVisibility()
|
internal void UpdateVisibility()
|
||||||
{
|
{
|
Loading…
Reference in New Issue
Block a user