mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 21:12:55 +08:00
let SelectionBox perform flip with scale handles
This commit is contained in:
parent
f277909470
commit
fc4069f794
@ -81,18 +81,12 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
|
||||
if (adjustedRect.Width <= 0 || adjustedRect.Height <= 0)
|
||||
{
|
||||
if (adjustedRect.Width <= 0)
|
||||
{
|
||||
SelectionBox.FlipScaleHandles(Direction.Horizontal);
|
||||
HandleFlip(Direction.Horizontal, false);
|
||||
}
|
||||
Axes toFlip = Axes.None;
|
||||
|
||||
if (adjustedRect.Height <= 0)
|
||||
{
|
||||
SelectionBox.FlipScaleHandles(Direction.Vertical);
|
||||
HandleFlip(Direction.Vertical, false);
|
||||
}
|
||||
if (adjustedRect.Width <= 0) toFlip |= Axes.X;
|
||||
if (adjustedRect.Height <= 0) toFlip |= Axes.Y;
|
||||
|
||||
SelectionBox.PerformFlipFromScaleHandles(toFlip);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -307,7 +308,24 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
return button;
|
||||
}
|
||||
|
||||
public void FlipScaleHandles(Direction direction) => dragHandles.FlipScaleHandles(direction);
|
||||
/// <remarks>
|
||||
/// This method should be called when a selection needs to be flipped
|
||||
/// because of an ongoing scale handle drag that would otherwise cause width or height to go negative.
|
||||
/// </remarks>
|
||||
public void PerformFlipFromScaleHandles(Axes axes)
|
||||
{
|
||||
if (axes.HasFlagFast(Axes.X))
|
||||
{
|
||||
dragHandles.FlipScaleHandles(Direction.Horizontal);
|
||||
OnFlip?.Invoke(Direction.Horizontal, false);
|
||||
}
|
||||
|
||||
if (axes.HasFlagFast(Axes.Y))
|
||||
{
|
||||
dragHandles.FlipScaleHandles(Direction.Vertical);
|
||||
OnFlip?.Invoke(Direction.Vertical, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void addScaleHandle(Anchor anchor)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user