using UnityEngine;
namespace UnityEditor.U2D.Path.GUIFramework
{
///
/// Represents the layout of a GUI element in a custom editor.
///
public struct LayoutData
{
///
/// The layout's index.
///
public int index;
///
/// The distance from the layout to the camera.
///
public float distance;
///
/// The layout's world-space position.
///
public Vector3 position;
///
/// The layout's world-space forward vector.
///
public Vector3 forward;
///
/// The layout's world-space up vector.
///
public Vector3 up;
///
/// The layout's world-space right vector.
///
public Vector3 right;
///
/// The layout's user data.
///
public object userData;
///
/// Zero definition of LayoutData.
///
public static readonly LayoutData zero = new LayoutData() { index = 0, distance = float.MaxValue, position = Vector3.zero, forward = Vector3.forward, up = Vector3.up, right = Vector3.right };
///
/// Gets the layout that is closest to the camera,
///
/// The current layout.
/// The new layout to compare with.
/// Returns the closest layout to the camera. If `currentData` is closest to the camera, returns `currentData`. Otherwise, if `newData` is closest to the camera, returns `newData`.
public static LayoutData Nearest(LayoutData currentData, LayoutData newData)
{
if (newData.distance <= currentData.distance)
return newData;
return currentData;
}
}
}