Free-polygon tool specification
Contents
intro
This is the specification for the straight cross between the free selection tool and the new polygon selection tool, developed by Martin Nordholts. One can look at the combined tool as:
- a polygon selection tool with the option to insert freely traced segments in between;
- a free selection tool that connects free segments by polygons.
The free-polygon selection tool is meant to replace both the free and polygon selection tools.
between the lines
In principle the tool is used to build up a polygon, where the nodes shall be one of two types:
- a polygon point, which shall be created by a single click;
- a free segment which shall be created by a drag, in the same way as in the current free selection tool.
The free segment shall have two polygon points incorporated: one at the start (the coordinate where the mouse went down) and on at the end (the coordinate where the mouse went up).
The polygon points shall be displayed as in the new polygon select tool (also the two of a free segment)
straight to the point
The sequence of nodes in a polygon shall be interconnected by straight lines. For a free segment, the start polygon point shall be connected to the previous polygon point and the end polygon point shall be connected to the next polygon point.
Between creating nodes of a free-polygon, the tool shall rubber-band a straight line from the last (end) polygon point created to the mouse pointer coordinate.
start and finish
The creation of a free-polygon shall be able to be started by creating either node type.
The free-polygon shall be completed and closed by the following means:
- clicking on the first (start) polygon point that initiated the creation of this free-polygon;
- hitting the return key; this shall connect the last (end) polygon point with the first (start) polygon point that initiated the creation of this free-polygon by a straight line;
- double clicking; this shall create a final polygon point at the coordinate where the mouse went down the first time of the double click and connect it with the first (start) polygon point that initiated the creation of this free-polygon by a straight line;
on the fly
Before the creation of a free-polygon has been completed, some editing of the intermediate result is possible:
- Hitting the backspace or delete key shall delete the last created node, whether polygon point or free segment. If only one node existed, then the whole free-polygon creation the shall be terminated, as if it never happened (for instance: not replace another selection);
- every existing polygon point in the free-polygon shall highlight when the mouse pointer is closer than 7 times their diameter to their mid-point and the mouse button is up. It shall be able to be grab an existing polygon point within its diameter and move it, rubber-banding and adjusting the attached straight-line segments;
- For the free segments, grabbing either polygon point shall rotate the free segment along the two attached polygon points’ axis and scale it in the dimension perpendicular to it, as well as adjusting the attached straight-line segment.
- when hovering the mouse within the radius display circle of a polygon point the display circle shall be shown and the line rubber-banding to the mouse coordinate temporarily suspended.
modifier keys
The usual add/subtract/intersect modes of selection creation shall be supported, including the use of shift and control modifier keys. As with the rectangle/oval select tools, what counts is whether the shift/control key was down at the moment selection creation commenced, which is here at the moment the mouse goes down to create the first node.
While creating free-polygon, when the mouse button is up and the control key is down, the angle of the rubber-banded line shall be constrainted to 15° increments, starting at 12 o’clock (north) with regard to the previous polygon point in polygon. New node creation shall be constrained by these 15° angles.
While moving a polygon point, when the control key is down, the angle of the rubber-banded line shall be constrainted to 15° increments, starting at 12 o’clock (north) with regard to the previous polygon point in polygon. Node placement shall be constrained by these 15° angles.
While creating free-polygon, when the mouse button is up and the shift key is down, no polygon point shall highlight nor shall it be able to grab an existing polygon point. This allows to create new nodes on or near existing ones (shift equals add).
further tool options
- Antialiasing and Feather edges