剧情
This commit is contained in:
@@ -89,5 +89,15 @@ namespace Ichni
|
||||
// 最后赋值 target.anchoredPosition = localPos;
|
||||
return localPos;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取目标 RectTransform 在目标空间 RectTransform 中的本地位置
|
||||
/// </summary>
|
||||
public static Vector2 GetLocalUIPosition(RectTransform targetRect, RectTransform targetSpace)
|
||||
{
|
||||
Vector2 screenPos = RectTransformUtility.WorldToScreenPoint(null, targetRect.position);
|
||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(targetSpace, screenPos, null, out Vector2 localPos);
|
||||
return localPos;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user