mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:47:26 +08:00
Implement UprightUnscaledContainer
This commit is contained in:
parent
b46bc5d65b
commit
0bfa6fa975
32
osu.Game/Graphics/Containers/UprightContainer.cs
Normal file
32
osu.Game/Graphics/Containers/UprightContainer.cs
Normal file
@ -0,0 +1,32 @@
|
||||
// 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.Containers;
|
||||
using osu.Framework.Layout;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
/// <summary>
|
||||
/// A container that prevents itself and its children from getting rotated, scaled or flipped with its Parent.
|
||||
/// </summary>
|
||||
public class UprightUnscaledContainer : Container
|
||||
{
|
||||
public UprightUnscaledContainer()
|
||||
{
|
||||
AddLayout(layout);
|
||||
}
|
||||
|
||||
private LayoutValue layout = new LayoutValue(Invalidation.DrawInfo);
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
if (!layout.IsValid)
|
||||
{
|
||||
Extensions.DrawableExtensions.KeepUprightAndUnscaled(this);
|
||||
layout.Validate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user