The constrained draw was constraining the polygon size to fit the
existing points rather than extending the existing points to fit the
user's intent.
This adds a 90° double-joint for the completion polygon that allows the
user to complete common constrained polygons visually based on the
preview with a double-click to finish.
When creating the zone cutout, we delete the old zone and add a new one
with each cutout. This requires resetting the source zone and clearing
our previous selection if we would like to continue using the cutout
tool on the new zone.
Fixes: lp:1812339
* https://bugs.launchpad.net/kicad/+bug/1812339
Graphic lines and polygons are drawn to fit specific areas for which it
is helpful to have the endpoint controlled by the cursor even when
constraining the angle.
Fixes: lp:1805502
* https://bugs.launchpad.net/kicad/+bug/1805502
If the client tool indicates it isn't happy for us to continue
(because, for instance, the user has cancelled the Zone Properties
dialog), then make sure we don't capture the mouse.
Fixes: lp: 1740780
* https://bugs.launchpad.net/kicad/+bug/1740780
The zone creation in DRAWING_TOOL was a complex event loop whici
simultaneously managed the event handling, construction of the preview
polygon and the creation and commiting of the zone, all in the same
scope. This has been broken into several pieces:
* POLYGON_ITEM preview item, used to preview the polygon in progress
* POLYGON_GEOM_MANAGER is a class that collects points from user input
and used them to describe a polygon's geometry, including calculation
of 45-degree constrained leader lines
* ZONE_CREATE_HELPER is a class which deals with creating zones based on
geometry from a geometry manager and parameters from the DRAWING_TOOL
* The (much simpler) event loop in DRAWING_TOOL drives the
POLYGON_GEOM_MANAGER. With a minor refactor, this loop can be reused
in future for other polygonal tools if wanted.
The polygon preview now has a translucent fill which makes it easier to
visualise the zone.
This also adds the Close Zone Outline and Delete Last Corner actions as
part of the new event loop.
Fixes: lp:1663885
* https://bugs.launchpad.net/kicad/+bug/1663885
Fixes: lp:1667885
* https://bugs.launchpad.net/kicad/+bug/1667885