public static float RotationSlider(int id, Vector3 cornerPos, float rotation, Vector3 pivot, Vector3 handleDir, Vector3 outwardsDir1, Vector3 outwardsDir2, float handleSize, Handles.DrawCapFunction drawFunc, Vector2 snap)
{
Vector3 b = outwardsDir1 + outwardsDir2;
Vector2 vector = HandleUtility.WorldToGUIPoint(cornerPos);
Vector2 b2 = (HandleUtility.WorldToGUIPoint(cornerPos + b) - vector).normalized * 15f;
RectHandles.RaycastGUIPointToWorldHit(vector + b2, new Plane(handleDir, cornerPos), out cornerPos);
Event current = Event.current;
Vector3 a = Handles.Slider2D(id, cornerPos, handleDir, outwardsDir1, outwardsDir2, handleSize, drawFunc, Vector2.zero);
if (current.type == EventType.MouseMove)
{
RectHandles.DetectCursorChange(id);
}
if (current.type == EventType.Repaint && ((HandleUtility.nearestControl == id && GUIUtility.hotControl == 0) || GUIUtility.hotControl == id))
{
Rect position = new Rect(current.mousePosition.x - 100f, current.mousePosition.y - 100f, 200f, 200f);
EditorGUIUtility.AddCursorRect(position, MouseCursor.RotateArrow);
}
return(rotation - RectHandles.AngleAroundAxis(a - pivot, cornerPos - pivot, handleDir));
}