mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-14 23:56:36 +08:00
WIP
* Using publicized mono assemblies * Remaking UI from scratch. Done the Scene Explorer so far.
This commit is contained in:
38
src/UI/Widgets/InfiniteScroll/UIExtensions.cs
Normal file
38
src/UI/Widgets/InfiniteScroll/UIExtensions.cs
Normal file
@ -0,0 +1,38 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user