Add `Size` to serialised components of a `SerialisedDrawableInfo`

This commit is contained in:
Dean Herbert 2023-11-10 14:15:42 +09:00
parent 1a8636638d
commit b0c5b3cb10
No known key found for this signature in database
2 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,7 @@
using osu.Framework.Graphics.Containers;
using osu.Game.Configuration;
using osu.Game.Extensions;
using osuTK;
namespace osu.Game.Skinning
{
@ -18,6 +19,8 @@ public static void ApplySerialisedInfo(this Drawable component, SerialisedDrawab
// todo: can probably make this better via deserialisation directly using a common interface.
component.Position = drawableInfo.Position;
component.Rotation = drawableInfo.Rotation;
if (drawableInfo.Size != Vector2.Zero && (component as CompositeDrawable)?.AutoSizeAxes == Axes.None)
component.Size = drawableInfo.Size;
component.Scale = drawableInfo.Scale;
component.Anchor = drawableInfo.Anchor;
component.Origin = drawableInfo.Origin;

View File

@ -35,6 +35,8 @@ public sealed class SerialisedDrawableInfo
public Vector2 Scale { get; set; }
public Vector2 Size { get; set; }
public Anchor Anchor { get; set; }
public Anchor Origin { get; set; }
@ -62,6 +64,7 @@ public SerialisedDrawableInfo(Drawable component)
Position = component.Position;
Rotation = component.Rotation;
Scale = component.Scale;
Size = component.Size;
Anchor = component.Anchor;
Origin = component.Origin;