mirror of https://github.com/ppy/osu
Merge pull request #30134 from bdach/center-button-breakage
Fix "Center on selected object" button not changing grid coordinates
This commit is contained in:
commit
5cb106e8e6
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
@ -10,6 +11,7 @@
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
@ -123,7 +125,8 @@ private void load()
|
||||||
if (editorBeatmap.SelectedHitObjects.Count != 1)
|
if (editorBeatmap.SelectedHitObjects.Count != 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
StartPosition.Value = ((IHasPosition)editorBeatmap.SelectedHitObjects.Single()).Position;
|
var position = ((IHasPosition)editorBeatmap.SelectedHitObjects.Single()).Position;
|
||||||
|
StartPosition.Value = new Vector2(MathF.Round(position.X), MathF.Round(position.Y));
|
||||||
updateEnabledStates();
|
updateEnabledStates();
|
||||||
},
|
},
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
@ -188,6 +191,13 @@ protected override void LoadComplete()
|
||||||
StartPosition.Value = new Vector2(StartPosition.Value.X, y.NewValue);
|
StartPosition.Value = new Vector2(StartPosition.Value.X, y.NewValue);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
StartPosition.BindValueChanged(pos =>
|
||||||
|
{
|
||||||
|
StartPositionX.Value = pos.NewValue.X;
|
||||||
|
StartPositionY.Value = pos.NewValue.Y;
|
||||||
|
updateEnabledStates();
|
||||||
|
});
|
||||||
|
|
||||||
Spacing.BindValueChanged(spacing =>
|
Spacing.BindValueChanged(spacing =>
|
||||||
{
|
{
|
||||||
spacingSlider.ContractedLabelText = $"S: {spacing.NewValue:N0}";
|
spacingSlider.ContractedLabelText = $"S: {spacing.NewValue:N0}";
|
||||||
|
@ -236,7 +246,7 @@ private void updateEnabledStates()
|
||||||
{
|
{
|
||||||
useSelectedObjectPositionButton.Enabled.Value = expandingContainer?.Expanded.Value == true
|
useSelectedObjectPositionButton.Enabled.Value = expandingContainer?.Expanded.Value == true
|
||||||
&& editorBeatmap.SelectedHitObjects.Count == 1
|
&& editorBeatmap.SelectedHitObjects.Count == 1
|
||||||
&& StartPosition.Value != ((IHasPosition)editorBeatmap.SelectedHitObjects.Single()).Position;
|
&& !Precision.AlmostEquals(StartPosition.Value, ((IHasPosition)editorBeatmap.SelectedHitObjects.Single()).Position, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void nextGridSize()
|
private void nextGridSize()
|
||||||
|
|
Loading…
Reference in New Issue