I am implementing a polyline drawing tool in a software for commenting over videos frames.
By polyline I am referring to connected segments forming an open shape.
The usual experience is that the user left click somewhere in the canvas to start the drawing, then each subsequent left click adds a segment. To provide immediate feedback, while the drawing is being created a segment is also drawn from the last point to the current mouse cursor. This is the standard way to do polyline drawings as far as I can tell.
Once the user is finished though, there is a problem on how to "end" the polyline. There is this dangling segment attached to the cursor that the user do not want, and each time you click away it actually adds another point to the polyline.
Some softwares use a right click to mean the end the polyline and the dangling segment is discarded. Google docs use the addition of a point very close to the last point. Other softwares use the Escape key. For the curve editor in Blender I always have to check the documentation.
There may or may not be a polygon tool in the future. For polygons I think the usual way is for the user to create a "closing" point, near the first point of the shape.
I have always found this particular piece of user experience unsatisfying as a user and I have refrained from implementing this drawing tool for this reason.
Right click usually means something else. Adding a nearby point… well what if you really wanted to add a small segment? I already use Escape to switch from the current tool to the pointer tool.
What is the best way to terminate a polyline? Is there a way that is widespread enough so that the user will expect it?