mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:23:22 +08:00
Update DrawableStoryboardSprite
to use helper method
This commit is contained in:
parent
740a72e16d
commit
c1697c7621
@ -69,7 +69,8 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
|
|
||||||
public override bool RemoveWhenNotAlive => false;
|
public override bool RemoveWhenNotAlive => false;
|
||||||
|
|
||||||
protected override Vector2 DrawScale => new Vector2(FlipH ? -base.DrawScale.X : base.DrawScale.X, FlipV ? -base.DrawScale.Y : base.DrawScale.Y) * VectorScale;
|
protected override Vector2 DrawScale
|
||||||
|
=> new Vector2(FlipH ? -base.DrawScale.X : base.DrawScale.X, FlipV ? -base.DrawScale.Y : base.DrawScale.Y) * VectorScale;
|
||||||
|
|
||||||
public override Anchor Origin => StoryboardExtensions.AdjustOrigin(base.Origin, VectorScale, FlipH, FlipV);
|
public override Anchor Origin => StoryboardExtensions.AdjustOrigin(base.Origin, VectorScale, FlipH, FlipV);
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.EnumExtensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
@ -73,33 +72,7 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
protected override Vector2 DrawScale
|
protected override Vector2 DrawScale
|
||||||
=> new Vector2(FlipH ? -base.DrawScale.X : base.DrawScale.X, FlipV ? -base.DrawScale.Y : base.DrawScale.Y) * VectorScale;
|
=> new Vector2(FlipH ? -base.DrawScale.X : base.DrawScale.X, FlipV ? -base.DrawScale.Y : base.DrawScale.Y) * VectorScale;
|
||||||
|
|
||||||
public override Anchor Origin
|
public override Anchor Origin => StoryboardExtensions.AdjustOrigin(base.Origin, VectorScale, FlipH, FlipV);
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var origin = base.Origin;
|
|
||||||
|
|
||||||
// Either flip horizontally or negative X scale, but not both.
|
|
||||||
if (FlipH ^ (VectorScale.X < 0))
|
|
||||||
{
|
|
||||||
if (origin.HasFlagFast(Anchor.x0))
|
|
||||||
origin = Anchor.x2 | (origin & (Anchor.y0 | Anchor.y1 | Anchor.y2));
|
|
||||||
else if (origin.HasFlagFast(Anchor.x2))
|
|
||||||
origin = Anchor.x0 | (origin & (Anchor.y0 | Anchor.y1 | Anchor.y2));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Either flip vertically or negative Y scale, but not both.
|
|
||||||
if (FlipV ^ (VectorScale.Y < 0))
|
|
||||||
{
|
|
||||||
if (origin.HasFlagFast(Anchor.y0))
|
|
||||||
origin = Anchor.y2 | (origin & (Anchor.x0 | Anchor.x1 | Anchor.x2));
|
|
||||||
else if (origin.HasFlagFast(Anchor.y2))
|
|
||||||
origin = Anchor.y0 | (origin & (Anchor.x0 | Anchor.x1 | Anchor.x2));
|
|
||||||
}
|
|
||||||
|
|
||||||
return origin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool IsPresent
|
public override bool IsPresent
|
||||||
=> !float.IsNaN(DrawPosition.X) && !float.IsNaN(DrawPosition.Y) && base.IsPresent;
|
=> !float.IsNaN(DrawPosition.X) && !float.IsNaN(DrawPosition.Y) && base.IsPresent;
|
||||||
|
Loading…
Reference in New Issue
Block a user