Always show rectangular grid in osu! composer

This commit is contained in:
Bartłomiej Dach
2021-09-20 20:13:06 +02:00
parent cdef6d0cf5
commit b5af01f456

View File

@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.Edit
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
}, },
rectangularPositionSnapGridContainer = new Container rectangularPositionSnapGrid = new OsuRectangularPositionSnapGrid(EditorBeatmap.BeatmapInfo.GridSize)
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
} }
@ -89,8 +89,6 @@ namespace osu.Game.Rulesets.Osu.Edit
gridSnapToggle.ValueChanged += _ => gridSnapToggle.ValueChanged += _ =>
{ {
updateRectangularPositionSnapGrid();
if (gridSnapToggle.Value == TernaryState.True) if (gridSnapToggle.Value == TernaryState.True)
distanceSnapToggle.Value = TernaryState.False; distanceSnapToggle.Value = TernaryState.False;
}; };
@ -111,6 +109,8 @@ namespace osu.Game.Rulesets.Osu.Edit
private readonly Cached distanceSnapGridCache = new Cached(); private readonly Cached distanceSnapGridCache = new Cached();
private double? lastDistanceSnapGridTime; private double? lastDistanceSnapGridTime;
private RectangularPositionSnapGrid rectangularPositionSnapGrid;
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
@ -298,21 +298,5 @@ namespace osu.Game.Rulesets.Osu.Edit
return new OsuDistanceSnapGrid((OsuHitObject)sourceObject, (OsuHitObject)targetObject); return new OsuDistanceSnapGrid((OsuHitObject)sourceObject, (OsuHitObject)targetObject);
} }
private Container rectangularPositionSnapGridContainer;
private RectangularPositionSnapGrid rectangularPositionSnapGrid;
private void updateRectangularPositionSnapGrid()
{
rectangularPositionSnapGridContainer.Clear();
if (gridSnapToggle.Value == TernaryState.True)
{
rectangularPositionSnapGridContainer.Add(rectangularPositionSnapGrid = new OsuRectangularPositionSnapGrid(EditorBeatmap.BeatmapInfo.GridSize)
{
RelativeSizeAxes = Axes.Both
});
}
}
} }
} }