mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Implement placement snapping
This commit is contained in:
parent
cb301a4661
commit
463079e148
@ -240,6 +240,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
public void BeginPlacement(HitObject hitObject)
|
||||
{
|
||||
hitObject.StartTime = GetSnappedTime(hitObject.StartTime, inputManager.CurrentState.Mouse.Position);
|
||||
}
|
||||
|
||||
public void EndPlacement(HitObject hitObject) => EditorBeatmap.Add(hitObject);
|
||||
|
@ -152,7 +152,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
if (currentPlacement != null)
|
||||
{
|
||||
currentPlacement.UpdatePosition(e.ScreenSpaceMousePosition);
|
||||
updatePlacementPosition(e.ScreenSpaceMousePosition);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -187,10 +187,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
placementBlueprintContainer.Child = currentPlacement = blueprint;
|
||||
|
||||
// Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame
|
||||
blueprint.UpdatePosition(inputManager.CurrentState.Mouse.Position);
|
||||
updatePlacementPosition(inputManager.CurrentState.Mouse.Position);
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePlacementPosition(Vector2 screenSpacePosition) => currentPlacement.UpdatePosition(ToScreenSpace(composer.GetSnappedPosition(ToLocalSpace(screenSpacePosition))));
|
||||
|
||||
/// <summary>
|
||||
/// Select all masks in a given rectangle selection area.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user