mirror of
https://github.com/ppy/osu
synced 2024-12-24 15:53:37 +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);
|
base.UpdatePosition(screenSpacePosition);
|
||||||
|
|
||||||
if (PlacementBegun)
|
if (PlacementActive)
|
||||||
{
|
{
|
||||||
var endTime = TimeAt(screenSpacePosition);
|
var endTime = TimeAt(screenSpacePosition);
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
|
|
||||||
public override void UpdatePosition(Vector2 screenSpacePosition)
|
public override void UpdatePosition(Vector2 screenSpacePosition)
|
||||||
{
|
{
|
||||||
if (!PlacementBegun)
|
if (!PlacementActive)
|
||||||
Column = ColumnAt(screenSpacePosition);
|
Column = ColumnAt(screenSpacePosition);
|
||||||
|
|
||||||
if (Column == null) return;
|
if (Column == null) return;
|
||||||
|
@ -126,7 +126,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
|
|
||||||
private void beginCurve()
|
private void beginCurve()
|
||||||
{
|
{
|
||||||
BeginPlacement();
|
BeginPlacement(commitStart: true);
|
||||||
setState(PlacementState.Body);
|
setState(PlacementState.Body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
|
|||||||
if (e.Button != MouseButton.Left)
|
if (e.Button != MouseButton.Left)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BeginPlacement();
|
BeginPlacement(commitStart: true);
|
||||||
piece.FadeTo(1f, 150, Easing.OutQuint);
|
piece.FadeTo(1f, 150, Easing.OutQuint);
|
||||||
|
|
||||||
isPlacingEnd = true;
|
isPlacingEnd = true;
|
||||||
|
@ -28,9 +28,9 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
public event Action<PlacementState> StateChanged;
|
public event Action<PlacementState> StateChanged;
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public bool PlacementBegun { get; private set; }
|
public bool PlacementActive { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="HitObject"/> that is being placed.
|
/// 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.
|
/// Signals that the placement of <see cref="HitObject"/> has started.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="startTime">The start time of <see cref="HitObject"/> at the placement point. If null, the current clock time is used.</param>
|
/// <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;
|
HitObject.StartTime = startTime ?? EditorClock.CurrentTime;
|
||||||
placementHandler.BeginPlacement(HitObject);
|
placementHandler.BeginPlacement(HitObject);
|
||||||
PlacementBegun = true;
|
PlacementActive |= commitStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Signals that the placement of <see cref="HitObject"/> has finished.
|
/// 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>
|
/// </summary>
|
||||||
/// <param name="commit">Whether the object should be committed.</param>
|
/// <param name="commit">Whether the object should be committed.</param>
|
||||||
public void EndPlacement(bool commit)
|
public void EndPlacement(bool commit)
|
||||||
{
|
{
|
||||||
if (!PlacementBegun)
|
if (!PlacementActive)
|
||||||
BeginPlacement();
|
BeginPlacement();
|
||||||
placementHandler.EndPlacement(HitObject, commit);
|
placementHandler.EndPlacement(HitObject, commit);
|
||||||
|
PlacementActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -107,7 +107,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
if (composer.CursorInPlacementArea)
|
if (composer.CursorInPlacementArea)
|
||||||
currentPlacement.State = PlacementState.Shown;
|
currentPlacement.State = PlacementState.Shown;
|
||||||
else if (currentPlacement?.PlacementBegun == false)
|
else if (currentPlacement?.PlacementActive == false)
|
||||||
currentPlacement.State = PlacementState.Hidden;
|
currentPlacement.State = PlacementState.Hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user