1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-12 18:47:19 +08:00

HitObjectSelectionBox -> SelectionDragger

This commit is contained in:
smoogipoo 2018-02-12 16:03:59 +09:00
parent cfb2b3f1e8
commit 1adbe3585c
5 changed files with 24 additions and 24 deletions

View File

@ -22,7 +22,7 @@ namespace osu.Game.Tests.Visual
public override IReadOnlyList<Type> RequiredTypes => new[] public override IReadOnlyList<Type> RequiredTypes => new[]
{ {
typeof(HitObjectCapturer), typeof(HitObjectCapturer),
typeof(HitObjectSelectionBox), typeof(SelectionDragger),
typeof(SelectionLayer) typeof(SelectionLayer)
}; };

View File

@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection
{ {
/// <summary> /// <summary>
/// Represents a marker visible on the border of a <see cref="HandleContainer"/> which exposes /// Represents a marker visible on the border of a <see cref="HandleContainer"/> which exposes
/// properties that are used to resize a <see cref="HitObjectSelectionBox"/>. /// properties that are used to resize a <see cref="SelectionDragger"/>.
/// </summary> /// </summary>
public class Handle : CompositeDrawable public class Handle : CompositeDrawable
{ {

View File

@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection
/// <summary> /// <summary>
/// A box that represents a drag selection. /// A box that represents a drag selection.
/// </summary> /// </summary>
public class HitObjectSelectionBox : CompositeDrawable public class SelectionDragger : CompositeDrawable
{ {
private readonly Container borderMask; private readonly Container borderMask;
private readonly Drawable background; private readonly Drawable background;
@ -27,9 +27,9 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection
private RectangleF dragRectangle; private RectangleF dragRectangle;
/// <summary> /// <summary>
/// Creates a new <see cref="HitObjectSelectionBox"/>. /// Creates a new <see cref="SelectionDragger"/>.
/// </summary> /// </summary>
public HitObjectSelectionBox() public SelectionDragger()
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {

View File

@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
} }
private HitObjectSelectionBox selectionBox; private SelectionDragger selectionDragger;
private HitObjectCapturer capturer; private HitObjectCapturer capturer;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -32,15 +32,15 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection
capturer.HitObjectCaptured += hitObjectCaptured; capturer.HitObjectCaptured += hitObjectCaptured;
} }
private void hitObjectCaptured(DrawableHitObject hitObject) => selectionBox.AddCaptured(hitObject); private void hitObjectCaptured(DrawableHitObject hitObject) => selectionDragger.AddCaptured(hitObject);
protected override bool OnDragStart(InputState state) protected override bool OnDragStart(InputState state)
{ {
// Hide the previous drag box - we won't be working with it any longer // Hide the previous drag box - we won't be working with it any longer
selectionBox?.Hide(); selectionDragger?.Hide();
selectionBox?.Expire(); selectionDragger?.Expire();
AddInternal(selectionBox = new HitObjectSelectionBox()); AddInternal(selectionDragger = new SelectionDragger());
return true; return true;
} }
@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection
var screenSpaceDragQuad = new Quad(dragStartPosition.X, dragStartPosition.Y, dragPosition.X - dragStartPosition.X, dragPosition.Y - dragStartPosition.Y); var screenSpaceDragQuad = new Quad(dragStartPosition.X, dragStartPosition.Y, dragPosition.X - dragStartPosition.X, dragPosition.Y - dragStartPosition.Y);
selectionBox.SetDragRectangle(screenSpaceDragQuad.AABBFloat); selectionDragger.SetDragRectangle(screenSpaceDragQuad.AABBFloat);
capturer.CaptureQuad(screenSpaceDragQuad); capturer.CaptureQuad(screenSpaceDragQuad);
return true; return true;
@ -62,16 +62,16 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection
{ {
// Due to https://github.com/ppy/osu-framework/issues/1382, we may get here after OnClick has set the selectionBox to null // Due to https://github.com/ppy/osu-framework/issues/1382, we may get here after OnClick has set the selectionBox to null
// In the case that the user dragged within the click distance out of an object // In the case that the user dragged within the click distance out of an object
if (selectionBox == null) if (selectionDragger == null)
return true; return true;
selectionBox.FinishCapture(); selectionDragger.FinishCapture();
// If there are no hitobjects, remove the selection box // If there are no hitobjects, remove the selection box
if (!selectionBox.HasCaptured) if (!selectionDragger.HasCaptured)
{ {
selectionBox.Expire(); selectionDragger.Expire();
selectionBox = null; selectionDragger = null;
} }
return true; return true;
@ -80,20 +80,20 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection
protected override bool OnClick(InputState state) protected override bool OnClick(InputState state)
{ {
// We could be coming here without a previous selection box // We could be coming here without a previous selection box
if (selectionBox == null) if (selectionDragger == null)
AddInternal(selectionBox = new HitObjectSelectionBox { Position = ToLocalSpace(state.Mouse.NativeState.Position), Alpha = 0 }); AddInternal(selectionDragger = new SelectionDragger { Position = ToLocalSpace(state.Mouse.NativeState.Position), Alpha = 0 });
// If we're coming here with a previous selection, unselect those hitobjects // If we're coming here with a previous selection, unselect those hitobjects
selectionBox.ClearCaptured(); selectionDragger.ClearCaptured();
if (capturer.CapturePoint(state.Mouse.NativeState.Position)) if (capturer.CapturePoint(state.Mouse.NativeState.Position))
{ {
selectionBox.Alpha = 1; selectionDragger.Alpha = 1;
selectionBox.FinishCapture(true); selectionDragger.FinishCapture(true);
} }
else else
{ {
selectionBox.Hide(); selectionDragger.Hide();
selectionBox = null; selectionDragger = null;
} }
return true; return true;

View File

@ -353,7 +353,7 @@
<Compile Include="Screens\Select\ImportFromStablePopup.cs" /> <Compile Include="Screens\Select\ImportFromStablePopup.cs" />
<Compile Include="Overlays\Settings\SettingsButton.cs" /> <Compile Include="Overlays\Settings\SettingsButton.cs" />
<Compile Include="Rulesets\Edit\Layers\Selection\OriginHandle.cs" /> <Compile Include="Rulesets\Edit\Layers\Selection\OriginHandle.cs" />
<Compile Include="Rulesets\Edit\Layers\Selection\HitObjectSelectionBox.cs" /> <Compile Include="Rulesets\Edit\Layers\Selection\SelectionDragger.cs" />
<Compile Include="Rulesets\Edit\Layers\Selection\Handle.cs" /> <Compile Include="Rulesets\Edit\Layers\Selection\Handle.cs" />
<Compile Include="Rulesets\Edit\Layers\Selection\HandleContainer.cs" /> <Compile Include="Rulesets\Edit\Layers\Selection\HandleContainer.cs" />
<Compile Include="Rulesets\Edit\Layers\Selection\SelectionInfo.cs" /> <Compile Include="Rulesets\Edit\Layers\Selection\SelectionInfo.cs" />