A game framework written with osu! in mind.
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2// See the LICENCE file in the repository root for full licence text.
3
4using System;
5
6namespace osu.Framework.Graphics.Containers
7{
8 /// <summary>
9 /// A container which is rounded (via automatic corner-radius and corner-exponent=2) on the shortest edge.
10 /// </summary>
11 public class CircularContainer : Container
12 {
13 internal override DrawNode GenerateDrawNodeSubtree(ulong frame, int treeIndex, bool forceNewDrawNode)
14 {
15 // this shouldn't have to be done here, but it's the only place it works correctly.
16 // see https://github.com/ppy/osu-framework/pull/1666
17 CornerRadius = Math.Min(DrawSize.X, DrawSize.Y) / 2f;
18
19 return base.GenerateDrawNodeSubtree(frame, treeIndex, forceNewDrawNode);
20 }
21 }
22}