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
4#nullable enable
5
6using osu.Framework.Extensions.EnumExtensions;
7using osu.Framework.Graphics.Shapes;
8using osuTK;
9
10namespace osu.Framework.Graphics.UserInterface
11{
12 public class BasicPopover : Popover
13 {
14 public BasicPopover()
15 {
16 Background.Colour = FrameworkColour.GreenDark;
17 Content.Padding = new MarginPadding(10);
18 }
19
20 protected override Drawable CreateArrow() => new EquilateralTriangle
21 {
22 Colour = FrameworkColour.GreenDark,
23 Origin = Anchor.TopCentre
24 };
25
26 protected override void AnchorUpdated(Anchor anchor)
27 {
28 base.AnchorUpdated(anchor);
29
30 bool isCenteredAnchor = anchor.HasFlagFast(Anchor.x1) || anchor.HasFlagFast(Anchor.y1);
31 Body.Margin = new MarginPadding(isCenteredAnchor ? 10 : 3);
32 Arrow.Size = new Vector2(isCenteredAnchor ? 12 : 15);
33 }
34 }
35}