Add basic structure for new rotation handler

This commit is contained in:
Bartłomiej Dach 2023-07-23 18:09:07 +02:00
parent 4622255cc7
commit ba8ebefb50
No known key found for this signature in database
2 changed files with 40 additions and 0 deletions

View File

@ -55,6 +55,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
[Resolved(CanBeNull = true)]
protected IEditorChangeHandler ChangeHandler { get; private set; }
protected SelectionRotationHandler RotationHandler { get; private set; }
protected SelectionHandler()
{
selectedBlueprints = new List<SelectionBlueprint<T>>();
@ -66,6 +68,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
[BackgroundDependencyLoader]
private void load()
{
RotationHandler = CreateRotationHandler();
InternalChild = SelectionBox = CreateSelectionBox();
SelectedItems.CollectionChanged += (_, _) =>
@ -132,6 +136,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <returns>Whether any items could be rotated.</returns>
public virtual bool HandleRotation(float angle) => false;
/// <summary>
/// Creates the handler to use for rotation operations.
/// </summary>
public virtual SelectionRotationHandler CreateRotationHandler() => new SelectionRotationHandler();
/// <summary>
/// Handles the selected items being scaled.
/// </summary>

View File

@ -0,0 +1,31 @@
// 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.Bindables;
using osuTK;
namespace osu.Game.Screens.Edit.Compose.Components
{
/// <summary>
/// Base handler for editor rotation operations.
/// </summary>
public class SelectionRotationHandler
{
/// <summary>
/// Whether the rotation can currently be performed.
/// </summary>
public Bindable<bool> CanRotate { get; private set; } = new BindableBool();
public virtual void Begin()
{
}
public virtual void Update(float rotation, Vector2 origin)
{
}
public virtual void Commit()
{
}
}
}