Adding drag function to a polygon editor

Hi, Im writing a onscenegui polygon editor, trying to mimic the polygoncollider2D editor. I am using a FreeMoveHandle for each vertex (green) and there is a dotcap handle (shown in cyan) to show where new vertices would be placed

33384-untitled.png

A new vertex is placed when the cyan dotcap handle is visible and the mouse button is clicked. This means i have to click to place, then click to drag the FreeMoveHandle of the new vertex.

This is pretty cumbersome and I really would like to just click and drag. Does anyone know how i could achieve this?

The code to add a new vertex is as follows;

                             Handles.color = Color.cyan;
					Vector3 closestPoint = HandleUtility.ClosestPointToPolyLine(polygonArray);
Handles.DotCap(0,closestPoint,Quaternion.identity,handleSize);

					if(e.type == EventType.mouseDown && e.button == 0)
					{
						AddPoint(closestPoint);
					}

					Handles.color = Color.green;

and

private void AddPoint(Vector3 pointToAdd)
{
	m_PointCount.intValue++;

	int[] polygonEdge = FindEdgeByPoint(pointToAdd);

	for(int i = m_PointCount.intValue-2 ; i >= polygonEdge[1] ;i--)
	{
		SetPointArray(i+1, GetPointAtIndex(i));
	}

	SetPointArray(polygonEdge[1], pointToAdd);
}

without posting code it is hard to really tell what is going on but from what I understand this could be a solution:

When you check the mouse button the click for placing a new vtx, make it check MouseButtonDown and then create the vtx. Flag that vtx as the active editing vtx that same frame, and the update method where you are handling dragging, it should automatically begin to start updating that vtx’s position until the mouse button is released and un flagging the vtx.