1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-24 17:29:23 +01:00

Preserve texture region names when converting between MLEM and MG.Extended

This commit is contained in:
Ell 2022-01-22 16:55:46 +01:00
parent 3edd593886
commit 58a0f8915a
2 changed files with 7 additions and 3 deletions

View file

@ -31,6 +31,10 @@ Improvements
Fixes
- Fixed paragraph links having incorrect hover locations when using special text alignments
### MLEM.Extended
Improvements
- Preserve texture region names when converting between MLEM and MG.Extended
### MLEM.Data
Improvements
- Rethrow exceptions when no RawContentManager readers could be constructed

View file

@ -23,7 +23,7 @@ namespace MLEM.Extended.Extensions {
/// <param name="region">The nine patch to convert</param>
/// <returns>The converted nine patch</returns>
public static TextureRegion2D ToExtended(this TextureRegion region) {
return new TextureRegion2D(region.Texture, region.U, region.V, region.Width, region.Height);
return new TextureRegion2D(region.Name, region.Texture, region.U, region.V, region.Width, region.Height);
}
/// <summary>
@ -32,7 +32,7 @@ namespace MLEM.Extended.Extensions {
/// <param name="patch">The nine patch to convert</param>
/// <returns>The converted nine patch</returns>
public static NinePatch ToMlem(this NinePatchRegion2D patch) {
return new NinePatch(new TextureRegion(patch.Texture, patch.Bounds), patch.LeftPadding, patch.RightPadding, patch.TopPadding, patch.BottomPadding);
return new NinePatch(((TextureRegion2D) patch).ToMlem(), patch.LeftPadding, patch.RightPadding, patch.TopPadding, patch.BottomPadding);
}
/// <summary>
@ -41,7 +41,7 @@ namespace MLEM.Extended.Extensions {
/// <param name="region">The nine patch to convert</param>
/// <returns>The converted nine patch</returns>
public static TextureRegion ToMlem(this TextureRegion2D region) {
return new TextureRegion(region.Texture, region.Bounds);
return new TextureRegion(region.Texture, region.Bounds) {Name = region.Name};
}
}