// 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.Bindables; using osu.Framework.Graphics; using osuTK; namespace osu.Game.Screens.Edit.Compose.Components { /// /// Base handler for editor rotation operations. /// public partial class SelectionRotationHandler : Component { /// /// Whether the rotation can currently be performed. /// public Bindable CanRotate { get; private set; } = new BindableBool(); /// /// Performs a single, instant, atomic rotation operation. /// /// /// This method is intended to be used in atomic contexts (such as when pressing a single button). /// For continuous operations, see the -- flow. /// /// Rotation to apply in degrees. /// /// The origin point to rotate around. /// If the default value is supplied, a sane implementation-defined default will be used. /// public void Rotate(float rotation, Vector2? origin = null) { Begin(); Update(rotation, origin); Commit(); } /// /// Begins a continuous rotation operation. /// /// /// This flow is intended to be used when a rotation operation is made incrementally (such as when dragging a rotation handle or slider). /// For instantaneous, atomic operations, use the convenience method. /// public virtual void Begin() { } /// /// Updates a continuous rotation operation. /// Must be preceded by a call. /// /// /// /// This flow is intended to be used when a rotation operation is made incrementally (such as when dragging a rotation handle or slider). /// As such, the values of and supplied should be relative to the state of the objects being rotated /// when was called, rather than instantaneous deltas. /// /// /// For instantaneous, atomic operations, use the convenience method. /// /// /// Rotation to apply in degrees. /// /// The origin point to rotate around. /// If the default value is supplied, a sane implementation-defined default will be used. /// public virtual void Update(float rotation, Vector2? origin = null) { } /// /// Ends a continuous rotation operation. /// Must be preceded by a call. /// /// /// This flow is intended to be used when a rotation operation is made incrementally (such as when dragging a rotation handle or slider). /// For instantaneous, atomic operations, use the convenience method. /// public virtual void Commit() { } } }