diff --git a/osu.Game.Rulesets.Osu/Edit/GridFromPointsTool.cs b/osu.Game.Rulesets.Osu/Edit/GridFromPointsTool.cs index f357d3024f..638833f581 100644 --- a/osu.Game.Rulesets.Osu/Edit/GridFromPointsTool.cs +++ b/osu.Game.Rulesets.Osu/Edit/GridFromPointsTool.cs @@ -1,6 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Osu.Edit.Blueprints; @@ -12,8 +15,16 @@ namespace osu.Game.Rulesets.Osu.Edit public GridFromPointsTool() : base("Change grid") { + TooltipText = """ + Left click to set the origin. + Left click again to set the spacing and rotation. + Right click to only set the origin. + Click and drag to set the origin, spacing and rotation. + """; } + public override Drawable? CreateIcon() => new SpriteIcon { Icon = OsuIcon.EditorGridSnap }; + public override PlacementBlueprint CreatePlacementBlueprint() => new GridPlacementBlueprint(); } } diff --git a/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs b/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs index 4ac8d55ec3..f71243a109 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuGridToolboxGroup.cs @@ -7,15 +7,12 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; -using osu.Framework.Localisation; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; -using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Input.Bindings; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.UI; @@ -88,11 +85,8 @@ namespace osu.Game.Rulesets.Osu.Edit private ExpandableSlider startPositionYSlider = null!; private ExpandableSlider spacingSlider = null!; private ExpandableSlider gridLinesRotationSlider = null!; - private RoundedButton gridFromPointsButton = null!; private EditorRadioButtonCollection gridTypeButtons = null!; - public event Action? GridFromPointsClicked; - public OsuGridToolboxGroup() : base("grid") { @@ -152,18 +146,6 @@ namespace osu.Game.Rulesets.Osu.Edit Spacing = new Vector2(0f, 10f), Children = new Drawable[] { - gridFromPointsButton = new TooltipRoundedButton - { - Action = () => GridFromPointsClicked?.Invoke(), - RelativeSizeAxes = Axes.X, - Text = "Grid from points", - TooltipText = """ - Left click to set the origin. - Left click again to set the spacing and rotation. - Right click to only set the origin. - Click and drag to set the origin, spacing and rotation. - """ - }, gridTypeButtons = new EditorRadioButtonCollection { RelativeSizeAxes = Axes.X, @@ -249,8 +231,6 @@ namespace osu.Game.Rulesets.Osu.Edit expandingContainer?.Expanded.BindValueChanged(v => { - gridFromPointsButton.FadeTo(v.NewValue ? 1f : 0f, 500, Easing.OutQuint); - gridFromPointsButton.BypassAutoSizeAxes = !v.NewValue ? Axes.Y : Axes.None; gridTypeButtons.FadeTo(v.NewValue ? 1f : 0f, 500, Easing.OutQuint); gridTypeButtons.BypassAutoSizeAxes = !v.NewValue ? Axes.Y : Axes.None; }, true); @@ -313,11 +293,6 @@ namespace osu.Game.Rulesets.Osu.Edit } } - public partial class TooltipRoundedButton : RoundedButton, IHasTooltip - { - public virtual LocalisableString TooltipText { get; set; } - } - public enum PositionSnapGridType { Square, diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index dcfe6eeca7..7c50558b92 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -46,10 +46,9 @@ namespace osu.Game.Rulesets.Osu.Edit new HitCircleCompositionTool(), new SliderCompositionTool(), new SpinnerCompositionTool(), + new GridFromPointsTool() }; - private readonly GridFromPointsTool gridFromPointsTool = new GridFromPointsTool(); - private readonly Bindable rectangularGridSnapToggle = new Bindable(); protected override Drawable CreateHitObjectInspector() => new OsuHitObjectInspector(); @@ -99,7 +98,6 @@ namespace osu.Game.Rulesets.Osu.Edit updateDistanceSnapGrid(); OsuGridToolboxGroup.GridType.BindValueChanged(updatePositionSnapGrid, true); - OsuGridToolboxGroup.GridFromPointsClicked += () => SetCustomTool(gridFromPointsTool); RightToolbox.AddRange(new Drawable[] { diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 1c6bed5fa8..b52228ccb9 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -466,14 +466,6 @@ namespace osu.Game.Rulesets.Edit public void SetSelectTool() => toolboxCollection.Items.First().Select(); - protected void SetCustomTool(CompositionTool tool) - { - foreach (var toolBoxRadioButton in toolboxCollection.Items) - toolBoxRadioButton.Deselect(); - - toolSelected(tool); - } - private void toolSelected(CompositionTool tool) { BlueprintContainer.CurrentTool = tool;