1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +08:00

Implement UprightUnscaledContainer

This commit is contained in:
HiddenNode 2022-08-07 13:18:29 +01:00
parent b46bc5d65b
commit 0bfa6fa975

View 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();
}
}
}
}