mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 13:07:24 +08:00
return grid placement tool to right toolbox
This commit is contained in:
parent
b1e381a391
commit
1c6e42671a
@ -1,9 +1,6 @@
|
||||
// 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.
|
||||
|
||||
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;
|
||||
@ -15,14 +12,8 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
public GridFromPointsTool()
|
||||
: base("Change grid")
|
||||
{
|
||||
TooltipText = """
|
||||
Left click to set the origin.
|
||||
Click and drag to set the origin, rotation and spacing.
|
||||
""";
|
||||
}
|
||||
|
||||
public override Drawable CreateIcon() => new SpriteIcon { Icon = OsuIcon.EditorGridSnap };
|
||||
|
||||
public override PlacementBlueprint CreatePlacementBlueprint() => new GridPlacementBlueprint();
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
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;
|
||||
@ -85,8 +86,11 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
private ExpandableSlider<float> startPositionYSlider = null!;
|
||||
private ExpandableSlider<float> spacingSlider = null!;
|
||||
private ExpandableSlider<float> gridLinesRotationSlider = null!;
|
||||
private RoundedButton gridFromPointsButton = null!;
|
||||
private EditorRadioButtonCollection gridTypeButtons = null!;
|
||||
|
||||
public event Action? GridFromPointsClicked;
|
||||
|
||||
public OsuGridToolboxGroup()
|
||||
: base("grid")
|
||||
{
|
||||
@ -146,6 +150,12 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
Spacing = new Vector2(0f, 10f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
gridFromPointsButton = new RoundedButton
|
||||
{
|
||||
Action = () => GridFromPointsClicked?.Invoke(),
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Grid from points",
|
||||
},
|
||||
gridTypeButtons = new EditorRadioButtonCollection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
@ -211,6 +221,8 @@ 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);
|
||||
|
@ -46,9 +46,10 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
new HitCircleCompositionTool(),
|
||||
new SliderCompositionTool(),
|
||||
new SpinnerCompositionTool(),
|
||||
new GridFromPointsTool(),
|
||||
};
|
||||
|
||||
private readonly GridFromPointsTool gridFromPointsTool = new GridFromPointsTool();
|
||||
|
||||
private readonly Bindable<TernaryState> rectangularGridSnapToggle = new Bindable<TernaryState>();
|
||||
|
||||
protected override Drawable CreateHitObjectInspector() => new OsuHitObjectInspector();
|
||||
@ -98,6 +99,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
updateDistanceSnapGrid();
|
||||
|
||||
OsuGridToolboxGroup.GridType.BindValueChanged(updatePositionSnapGrid, true);
|
||||
OsuGridToolboxGroup.GridFromPointsClicked += () => SetCustomTool(gridFromPointsTool);
|
||||
|
||||
RightToolbox.AddRange(new Drawable[]
|
||||
{
|
||||
|
@ -466,6 +466,14 @@ 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;
|
||||
|
Loading…
Reference in New Issue
Block a user