mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-15 15:57:52 +08:00
rename "InfiniteScrollRect" to "ScrollPool"
This commit is contained in:
31
src/UI/Widgets/ScrollPool/UIExtensions.cs
Normal file
31
src/UI/Widgets/ScrollPool/UIExtensions.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityExplorer.UI.Widgets
|
||||
{
|
||||
public static class UIExtension
|
||||
{
|
||||
public static void GetCorners(this RectTransform rect, Vector3[] corners)
|
||||
{
|
||||
Vector3 bottomLeft = new Vector3(rect.position.x, rect.position.y - rect.rect.height, 0);
|
||||
|
||||
corners[0] = bottomLeft;
|
||||
corners[1] = bottomLeft + new Vector3(0, rect.rect.height, 0);
|
||||
corners[2] = bottomLeft + new Vector3(rect.rect.width, rect.rect.height, 0);
|
||||
corners[3] = bottomLeft + new Vector3(rect.rect.width, 0, 0);
|
||||
}
|
||||
|
||||
// again, using position and rect instead of
|
||||
|
||||
public static float MaxY(this RectTransform rect) => rect.position.y - rect.rect.height;
|
||||
|
||||
public static float MinY(this RectTransform rect) => rect.position.y;
|
||||
|
||||
public static float MaxX(this RectTransform rect) => rect.position.x - rect.rect.width;
|
||||
|
||||
public static float MinX(this RectTransform rect) => rect.position.x;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user