mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09: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)
|
public void BeginPlacement(HitObject hitObject)
|
||||||
{
|
{
|
||||||
|
hitObject.StartTime = GetSnappedTime(hitObject.StartTime, inputManager.CurrentState.Mouse.Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EndPlacement(HitObject hitObject) => EditorBeatmap.Add(hitObject);
|
public void EndPlacement(HitObject hitObject) => EditorBeatmap.Add(hitObject);
|
||||||
|
@ -152,7 +152,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
if (currentPlacement != null)
|
if (currentPlacement != null)
|
||||||
{
|
{
|
||||||
currentPlacement.UpdatePosition(e.ScreenSpaceMousePosition);
|
updatePlacementPosition(e.ScreenSpaceMousePosition);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,10 +187,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
placementBlueprintContainer.Child = currentPlacement = blueprint;
|
placementBlueprintContainer.Child = currentPlacement = blueprint;
|
||||||
|
|
||||||
// Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame
|
// 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>
|
/// <summary>
|
||||||
/// Select all masks in a given rectangle selection area.
|
/// Select all masks in a given rectangle selection area.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user