mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-01 11:12:49 +08:00

* Using publicized mono assemblies * Remaking UI from scratch. Done the Scene Explorer so far.
39 lines
996 B
C#
39 lines
996 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using UnityEngine;
|
|
|
|
namespace UnityExplorer.UI.Widgets.InfiniteScroll
|
|
{
|
|
public static class UIExtension
|
|
{
|
|
public static Vector3[] GetCorners(this RectTransform rectTransform)
|
|
{
|
|
Vector3[] corners = new Vector3[4];
|
|
rectTransform.GetWorldCorners(corners);
|
|
return corners;
|
|
}
|
|
public static float MaxY(this RectTransform rectTransform)
|
|
{
|
|
return rectTransform.GetCorners()[1].y;
|
|
}
|
|
|
|
public static float MinY(this RectTransform rectTransform)
|
|
{
|
|
return rectTransform.GetCorners()[0].y;
|
|
}
|
|
|
|
public static float MaxX(this RectTransform rectTransform)
|
|
{
|
|
return rectTransform.GetCorners()[2].x;
|
|
}
|
|
|
|
public static float MinX(this RectTransform rectTransform)
|
|
{
|
|
return rectTransform.GetCorners()[0].x;
|
|
}
|
|
|
|
}
|
|
}
|