mirror of
https://github.com/ppy/osu
synced 2025-04-01 22:48:33 +00:00
Remove handles for now (will be re-implemented)
This commit is contained in:
parent
e10bb2db05
commit
c3212d36ef
@ -1,105 +0,0 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Primitives;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Input;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit.Layers.Selection
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a marker visible on the border of a <see cref="HandleContainer"/> which exposes
|
|
||||||
/// properties that are used to resize a <see cref="SelectionDragger"/>.
|
|
||||||
/// </summary>
|
|
||||||
public class Handle : CompositeDrawable
|
|
||||||
{
|
|
||||||
private const float marker_size = 10;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when this <see cref="Handle"/> requires the current drag rectangle.
|
|
||||||
/// </summary>
|
|
||||||
public Func<RectangleF> GetDragRectangle;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when this <see cref="Handle"/> wants to update the drag rectangle.
|
|
||||||
/// </summary>
|
|
||||||
public Action<RectangleF> UpdateDragRectangle;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when this <see cref="Handle"/> has finished updates to the drag rectangle.
|
|
||||||
/// </summary>
|
|
||||||
public Action FinishDrag;
|
|
||||||
|
|
||||||
private Color4 normalColour;
|
|
||||||
private Color4 hoverColour;
|
|
||||||
|
|
||||||
public Handle()
|
|
||||||
{
|
|
||||||
Size = new Vector2(marker_size);
|
|
||||||
|
|
||||||
InternalChild = new CircularContainer
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Masking = true,
|
|
||||||
Child = new Box { RelativeSizeAxes = Axes.Both }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
Colour = normalColour = colours.Yellow;
|
|
||||||
hoverColour = colours.YellowDarker;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnDragStart(InputState state) => true;
|
|
||||||
|
|
||||||
protected override bool OnDrag(InputState state)
|
|
||||||
{
|
|
||||||
var currentRectangle = GetDragRectangle();
|
|
||||||
|
|
||||||
float left = currentRectangle.Left;
|
|
||||||
float right = currentRectangle.Right;
|
|
||||||
float top = currentRectangle.Top;
|
|
||||||
float bottom = currentRectangle.Bottom;
|
|
||||||
|
|
||||||
// Apply modifications to the capture rectangle
|
|
||||||
if ((Anchor & Anchor.y0) > 0)
|
|
||||||
top += state.Mouse.Delta.Y;
|
|
||||||
else if ((Anchor & Anchor.y2) > 0)
|
|
||||||
bottom += state.Mouse.Delta.Y;
|
|
||||||
|
|
||||||
if ((Anchor & Anchor.x0) > 0)
|
|
||||||
left += state.Mouse.Delta.X;
|
|
||||||
else if ((Anchor & Anchor.x2) > 0)
|
|
||||||
right += state.Mouse.Delta.X;
|
|
||||||
|
|
||||||
UpdateDragRectangle(RectangleF.FromLTRB(left, top, right, bottom));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnDragEnd(InputState state)
|
|
||||||
{
|
|
||||||
FinishDrag();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnHover(InputState state)
|
|
||||||
{
|
|
||||||
this.FadeColour(hoverColour, 100);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnHoverLost(InputState state)
|
|
||||||
{
|
|
||||||
this.FadeColour(normalColour, 100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,92 +0,0 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Primitives;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit.Layers.Selection
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A <see cref="CompositeDrawable"/> that has <see cref="Handle"/>s around its border.
|
|
||||||
/// </summary>
|
|
||||||
public class HandleContainer : CompositeDrawable
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when a <see cref="Handle"/> requires the current drag rectangle.
|
|
||||||
/// </summary>
|
|
||||||
public Func<RectangleF> GetDragRectangle;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when a <see cref="Handle"/> wants to update the drag rectangle.
|
|
||||||
/// </summary>
|
|
||||||
public Action<RectangleF> UpdateDragRectangle;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when a <see cref="Handle"/> has finished updates to the drag rectangle.
|
|
||||||
/// </summary>
|
|
||||||
public Action FinishDrag;
|
|
||||||
|
|
||||||
public HandleContainer()
|
|
||||||
{
|
|
||||||
InternalChildren = new Drawable[]
|
|
||||||
{
|
|
||||||
new Handle
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopLeft,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
},
|
|
||||||
new Handle
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
},
|
|
||||||
new Handle
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
},
|
|
||||||
new Handle
|
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreLeft,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
},
|
|
||||||
new Handle
|
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
},
|
|
||||||
new Handle
|
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreRight,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
},
|
|
||||||
new Handle
|
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomRight,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
},
|
|
||||||
new Handle
|
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomCentre,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
},
|
|
||||||
new OriginHandle
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
InternalChildren.OfType<Handle>().ForEach(m =>
|
|
||||||
{
|
|
||||||
m.GetDragRectangle = () => GetDragRectangle();
|
|
||||||
m.UpdateDragRectangle = r => UpdateDragRectangle(r);
|
|
||||||
m.FinishDrag = () => FinishDrag();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using OpenTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit.Layers.Selection
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents the origin of a <see cref="HandleContainer"/>.
|
|
||||||
/// </summary>
|
|
||||||
public class OriginHandle : CompositeDrawable
|
|
||||||
{
|
|
||||||
private const float marker_size = 10;
|
|
||||||
private const float line_width = 2;
|
|
||||||
|
|
||||||
public OriginHandle()
|
|
||||||
{
|
|
||||||
Size = new Vector2(marker_size);
|
|
||||||
|
|
||||||
InternalChildren = new[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = line_width
|
|
||||||
},
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Width = line_width
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
Colour = colours.Yellow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -352,9 +352,6 @@
|
|||||||
<Compile Include="Rulesets\UI\Scrolling\ScrollingRulesetContainer.cs" />
|
<Compile Include="Rulesets\UI\Scrolling\ScrollingRulesetContainer.cs" />
|
||||||
<Compile Include="Screens\Select\ImportFromStablePopup.cs" />
|
<Compile Include="Screens\Select\ImportFromStablePopup.cs" />
|
||||||
<Compile Include="Overlays\Settings\SettingsButton.cs" />
|
<Compile Include="Overlays\Settings\SettingsButton.cs" />
|
||||||
<Compile Include="Rulesets\Edit\Layers\Selection\OriginHandle.cs" />
|
|
||||||
<Compile Include="Rulesets\Edit\Layers\Selection\Handle.cs" />
|
|
||||||
<Compile Include="Rulesets\Edit\Layers\Selection\HandleContainer.cs" />
|
|
||||||
<Compile Include="Rulesets\Edit\Layers\Selection\SelectionBox.cs" />
|
<Compile Include="Rulesets\Edit\Layers\Selection\SelectionBox.cs" />
|
||||||
<Compile Include="Rulesets\Edit\Layers\Selection\SelectionLayer.cs" />
|
<Compile Include="Rulesets\Edit\Layers\Selection\SelectionLayer.cs" />
|
||||||
<Compile Include="Screens\Edit\Components\BottomBarContainer.cs" />
|
<Compile Include="Screens\Edit\Components\BottomBarContainer.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user