mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 00:43:21 +08:00
Implement GrowToFitContainer
This commit is contained in:
parent
15fb4d8dd5
commit
8618d9ea0d
22
osu.Game/Graphics/Containers/GrowToFitContainer.cs
Normal file
22
osu.Game/Graphics/Containers/GrowToFitContainer.cs
Normal file
@ -0,0 +1,22 @@
|
||||
// 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 System;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
/// <summary>
|
||||
/// A container that grows in size to fit its child and retains its size when its child shrinks
|
||||
/// </summary>
|
||||
public class GrowToFitContainer : Container
|
||||
{
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
Height = Math.Max(Child.Height, Height);
|
||||
Width = Math.Max(Child.Width, Width);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user