I write editor extension for drawing vectors (using Handles class).
I use Handles.FreeMoveHandle with two SphereCap at the edges of vector for moving and scaling.
How i can detect onClick event on SphereCap?
I found this code, but it not working:
var newId = GUIUtility.GetControlID(vectorObj.Hash, FocusType.Passive);
switch (e.GetTypeForControl(newId))
{
case EventType.Layout:
HandleUtility.AddControl(newId, 0.05f);
HandleUtility.AddDefaultControl(newId);
break;
case EventType.MouseUp:
Debug.Log("id: " + newId + " nearest: " + HandleUtility.nearestControl); // newId != HandleUtility.nearestControl i don't know how to fix it
break;
}
for now, i can detect vector selection only if one of SphereCap was moved, but i want catch it onClick. any ideas?