1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 03:02:54 +08:00

move GridFromPointsClicked handler creation code

This commit is contained in:
OliBomby 2023-12-31 19:08:27 +01:00
parent 98505d0bba
commit b54c9a36fe
2 changed files with 9 additions and 3 deletions

View File

@ -22,6 +22,13 @@ namespace osu.Game.Rulesets.Osu.Edit
private Vector2? startPosition;
protected override void LoadComplete()
{
base.LoadComplete();
gridToolboxGroup.GridFromPointsClicked += BeginPlacement;
}
public void BeginPlacement()
{
IsPlacing = true;

View File

@ -63,6 +63,8 @@ namespace osu.Game.Rulesets.Osu.Edit
private Bindable<HitObject> placementObject;
private GridFromPointsTool gridFromPointsTool;
[Cached(typeof(IDistanceSnapProvider))]
protected readonly OsuDistanceSnapProvider DistanceSnapProvider = new OsuDistanceSnapProvider();
@ -99,7 +101,6 @@ namespace osu.Game.Rulesets.Osu.Edit
updateDistanceSnapGrid();
OsuGridToolboxGroup.GridType.BindValueChanged(updatePositionSnapGrid, true);
OsuGridToolboxGroup.GridFromPointsClicked += () => gridFromPointsTool.BeginPlacement();
LayerAboveRuleset.Add(
// Place it above the playfield and blueprints, so it takes priority when handling input.
@ -118,8 +119,6 @@ namespace osu.Game.Rulesets.Osu.Edit
);
}
private GridFromPointsTool gridFromPointsTool;
private void updatePositionSnapGrid(ValueChangedEvent<PositionSnapGridType> obj)
{
if (positionSnapGrid != null)