1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 19:27:24 +08:00

Fix blueprint showing even when mouse outside of container

This commit is contained in:
Dean Herbert 2020-02-13 09:03:48 +09:00
parent c080ebcc50
commit 0fe41fd50a
6 changed files with 13 additions and 11 deletions

View File

@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
{
base.UpdatePosition(screenSpacePosition);
if (PlacementBegun)
if (PlacementActive)
{
var endTime = TimeAt(screenSpacePosition);

View File

@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
public override void UpdatePosition(Vector2 screenSpacePosition)
{
if (!PlacementBegun)
if (!PlacementActive)
Column = ColumnAt(screenSpacePosition);
if (Column == null) return;

View File

@ -126,7 +126,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
private void beginCurve()
{
BeginPlacement();
BeginPlacement(commitStart: true);
setState(PlacementState.Body);
}

View File

@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
if (e.Button != MouseButton.Left)
return false;
BeginPlacement();
BeginPlacement(commitStart: true);
piece.FadeTo(1f, 150, Easing.OutQuint);
isPlacingEnd = true;

View File

@ -28,9 +28,9 @@ namespace osu.Game.Rulesets.Edit
public event Action<PlacementState> StateChanged;
/// <summary>
/// Whether the <see cref="HitObject"/> is currently being placed, but has not necessarily finished being placed.
/// Whether the <see cref="HitObject"/> is currently mid-placement, but has not necessarily finished being placed.
/// </summary>
public bool PlacementBegun { get; private set; }
public bool PlacementActive { get; private set; }
/// <summary>
/// The <see cref="HitObject"/> that is being placed.
@ -92,23 +92,25 @@ namespace osu.Game.Rulesets.Edit
/// Signals that the placement of <see cref="HitObject"/> has started.
/// </summary>
/// <param name="startTime">The start time of <see cref="HitObject"/> at the placement point. If null, the current clock time is used.</param>
protected void BeginPlacement(double? startTime = null)
/// <param name="commitStart">Whether this call is committing a value for HitObject.StartTime and continuing with further adjustments.</param>
protected void BeginPlacement(double? startTime = null, bool commitStart = false)
{
HitObject.StartTime = startTime ?? EditorClock.CurrentTime;
placementHandler.BeginPlacement(HitObject);
PlacementBegun = true;
PlacementActive |= commitStart;
}
/// <summary>
/// Signals that the placement of <see cref="HitObject"/> has finished.
/// This will destroy this <see cref="PlacementBlueprint"/>, and add the <see cref="HitObject"/> to the <see cref="Beatmap"/>.
/// This will destroy this <see cref="PlacementBlueprint"/>, and add the HitObject.StartTime to the <see cref="Beatmap"/>.
/// </summary>
/// <param name="commit">Whether the object should be committed.</param>
public void EndPlacement(bool commit)
{
if (!PlacementBegun)
if (!PlacementActive)
BeginPlacement();
placementHandler.EndPlacement(HitObject, commit);
PlacementActive = false;
}
/// <summary>

View File

@ -107,7 +107,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
if (composer.CursorInPlacementArea)
currentPlacement.State = PlacementState.Shown;
else if (currentPlacement?.PlacementBegun == false)
else if (currentPlacement?.PlacementActive == false)
currentPlacement.State = PlacementState.Hidden;
}
}