1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 02:13:29 +08:00

work in progress

This commit is contained in:
2025-04-20 20:36:52 +08:00
parent f32b11f49a
commit 78379165e8
11 changed files with 433 additions and 103 deletions

View File

@@ -19,6 +19,20 @@ public static class Util
return rect;
}
public static RectTransform NormalizeRectWithTopRight(Component cmp, float right, float top, Transform parent = null)
{
if (cmp.transform is not RectTransform rect) return null;
if (parent != null)
{
rect.SetParent(parent, false);
}
rect.anchorMax = new Vector2(1f, 1f);
rect.anchorMin = new Vector2(1f, 1f);
rect.pivot = new Vector2(1f, 1f);
rect.anchoredPosition3D = new Vector3(-right, -top, 0f);
return rect;
}
public static RectTransform NormalizeRectWithBottomLeft(Component cmp, float left, float bottom, Transform parent = null)
{
if (cmp.transform is not RectTransform rect) return null;