mirror of
https://github.com/ppy/osu
synced 2024-12-23 23:33:36 +00:00
Fix blueprint showing even when mouse outside of container
This commit is contained in:
parent
c080ebcc50
commit
0fe41fd50a
@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||
{
|
||||
base.UpdatePosition(screenSpacePosition);
|
||||
|
||||
if (PlacementBegun)
|
||||
if (PlacementActive)
|
||||
{
|
||||
var endTime = TimeAt(screenSpacePosition);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -126,7 +126,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
|
||||
private void beginCurve()
|
||||
{
|
||||
BeginPlacement();
|
||||
BeginPlacement(commitStart: true);
|
||||
setState(PlacementState.Body);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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>
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user