From 3da59f44b59aa7a098d72769bfca46ff737ae842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 7 Oct 2024 10:28:44 +0200 Subject: [PATCH 1/3] Fix clicking "centre on selected object" button not updating slider state --- osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs b/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs index 4fa8852770..a8331ab4aa 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs @@ -188,6 +188,12 @@ namespace osu.Game.Rulesets.Osu.Edit StartPosition.Value = new Vector2(StartPosition.Value.X, y.NewValue); }, true); + StartPosition.BindValueChanged(pos => + { + StartPositionX.Value = pos.NewValue.X; + StartPositionY.Value = pos.NewValue.Y; + }); + Spacing.BindValueChanged(spacing => { spacingSlider.ContractedLabelText = $"S: {spacing.NewValue:N0}"; From 04c65ad91969e2835e4f382a026a53df07abc215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 7 Oct 2024 10:29:18 +0200 Subject: [PATCH 2/3] Fix "centre on selected object" sometimes remaining disabled after moving grid --- osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs b/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs index a8331ab4aa..dff2347ca5 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs @@ -192,6 +192,7 @@ namespace osu.Game.Rulesets.Osu.Edit { StartPositionX.Value = pos.NewValue.X; StartPositionY.Value = pos.NewValue.Y; + updateEnabledStates(); }); Spacing.BindValueChanged(spacing => From 2b5ddddf4f9d24b000e01d1ef7c8929beaaa3b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 7 Oct 2024 10:29:45 +0200 Subject: [PATCH 3/3] Fix "centre on selected object" button not respecting precision of allowable grid positions --- osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs b/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs index dff2347ca5..972224a230 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -10,6 +11,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; +using osu.Framework.Utils; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; @@ -123,7 +125,8 @@ namespace osu.Game.Rulesets.Osu.Edit if (editorBeatmap.SelectedHitObjects.Count != 1) 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(); }, RelativeSizeAxes = Axes.X, @@ -243,7 +246,7 @@ namespace osu.Game.Rulesets.Osu.Edit { useSelectedObjectPositionButton.Enabled.Value = expandingContainer?.Expanded.Value == true && 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()