mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-03 20:12:33 +08:00
Fix RectTransform.GetWorldCorners in il2cpp
This commit is contained in:
@ -8,31 +8,22 @@ namespace UnityExplorer.UI.Widgets.InfiniteScroll
|
|||||||
{
|
{
|
||||||
public static class UIExtension
|
public static class UIExtension
|
||||||
{
|
{
|
||||||
public static Vector3[] GetCorners(this RectTransform rectTransform)
|
public static void GetCorners(this RectTransform rect, Vector3[] corners)
|
||||||
{
|
{
|
||||||
Vector3[] corners = new Vector3[4];
|
Vector3 bottomLeft = new Vector3(rect.position.x, rect.position.y - rect.rect.height, 0);
|
||||||
rectTransform.GetWorldCorners(corners);
|
|
||||||
return corners;
|
corners[0] = bottomLeft;
|
||||||
}
|
corners[1] = bottomLeft + new Vector3(0, rect.rect.height, 0);
|
||||||
public static float MaxY(this RectTransform rectTransform)
|
corners[2] = bottomLeft + new Vector3(rect.rect.width, rect.rect.height, 0);
|
||||||
{
|
corners[3] = bottomLeft + new Vector3(rect.rect.width, 0, 0);
|
||||||
return rectTransform.GetCorners()[1].y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float MinY(this RectTransform rectTransform)
|
public static float MaxY(this RectTransform rect) => rect.position.y - rect.rect.height;
|
||||||
{
|
|
||||||
return rectTransform.GetCorners()[0].y;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float MaxX(this RectTransform rectTransform)
|
public static float MinY(this RectTransform rect) => rect.position.y;
|
||||||
{
|
|
||||||
return rectTransform.GetCorners()[2].x;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float MinX(this RectTransform rectTransform)
|
public static float MaxX(this RectTransform rect) => rect.position.x - rect.rect.width;
|
||||||
{
|
|
||||||
return rectTransform.GetCorners()[0].x;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public static float MinX(this RectTransform rect) => rect.position.x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user