1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

Apply NRT to LogoTrackingContainer

This commit is contained in:
Dean Herbert 2024-02-18 23:35:26 +08:00
parent 882f11bf79
commit 6b6a6aea54
No known key found for this signature in database
2 changed files with 3 additions and 5 deletions

View File

@ -282,7 +282,7 @@ namespace osu.Game.Tests.Visual.UserInterface
/// <summary>
/// Check that the logo is tracking the position of the facade, with an acceptable precision lenience.
/// </summary>
public bool IsLogoTracking => Precision.AlmostEquals(Logo.Position, ComputeLogoTrackingPosition());
public bool IsLogoTracking => Precision.AlmostEquals(Logo!.Position, ComputeLogoTrackingPosition());
}
}
}

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -19,7 +17,7 @@ namespace osu.Game.Graphics.Containers
{
public Facade LogoFacade => facade;
protected OsuLogo Logo { get; private set; }
protected OsuLogo? Logo { get; private set; }
private readonly InternalFacade facade = new InternalFacade();
@ -76,7 +74,7 @@ namespace osu.Game.Graphics.Containers
/// <remarks>Will only be correct if the logo's <see cref="Drawable.RelativePositionAxes"/> are set to Axes.Both</remarks>
protected Vector2 ComputeLogoTrackingPosition()
{
var absolutePos = Logo.Parent!.ToLocalSpace(LogoFacade.ScreenSpaceDrawQuad.Centre);
var absolutePos = Logo!.Parent!.ToLocalSpace(LogoFacade.ScreenSpaceDrawQuad.Centre);
return new Vector2(absolutePos.X / Logo.Parent!.RelativeToAbsoluteFactor.X,
absolutePos.Y / Logo.Parent!.RelativeToAbsoluteFactor.Y);