mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 15:33:05 +08:00
Merge pull request #20174 from peppy/fix-storyboard-zero-vector-scale
Fix some storyboard sprites still showing with zero `VectorScale`
This commit is contained in:
commit
edabb0dfe6
@ -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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
@ -73,6 +71,17 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddAssert("origin flipped", () => sprites.All(s => s.Origin == Anchor.BottomRight));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestZeroScale()
|
||||
{
|
||||
const string lookup_name = "hitcircleoverlay";
|
||||
|
||||
AddStep("allow skin lookup", () => storyboard.UseSkinSprites = true);
|
||||
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
|
||||
AddStep("scale sprite", () => sprites.ForEach(s => s.VectorScale = new Vector2(0, 1)));
|
||||
AddAssert("zero width", () => sprites.All(s => s.ScreenSpaceDrawQuad.Width == 0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNegativeScale()
|
||||
{
|
||||
|
@ -56,11 +56,6 @@ namespace osu.Game.Storyboards.Drawables
|
||||
get => vectorScale;
|
||||
set
|
||||
{
|
||||
if (Math.Abs(value.X) < Precision.FLOAT_EPSILON)
|
||||
value.X = Precision.FLOAT_EPSILON;
|
||||
if (Math.Abs(value.Y) < Precision.FLOAT_EPSILON)
|
||||
value.Y = Precision.FLOAT_EPSILON;
|
||||
|
||||
if (vectorScale == value)
|
||||
return;
|
||||
|
||||
|
@ -55,11 +55,6 @@ namespace osu.Game.Storyboards.Drawables
|
||||
get => vectorScale;
|
||||
set
|
||||
{
|
||||
if (Math.Abs(value.X) < Precision.FLOAT_EPSILON)
|
||||
value.X = Precision.FLOAT_EPSILON;
|
||||
if (Math.Abs(value.Y) < Precision.FLOAT_EPSILON)
|
||||
value.Y = Precision.FLOAT_EPSILON;
|
||||
|
||||
if (vectorScale == value)
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user