Personal website
It turns out I forgot about two “minor” feature I should add before the two major features I mentioned in the previous post.
Polylines and Polygons currently have a set number of “segments”. To allow
changing this, I will add a new LinearSegment class that allows splitting
itself to increase the number of segments in a Polyline or Polygon.
The existing Segment class will be refactored into a base class
Segment and a subclass PathSegment. All functionality related to
arcs and curves will only be in PathSegment, and that is the class
that will be used directly by Paths. The clicked method will continue
to use Segment.
A new class LinearSegment will be created subclassing Segment that
will be used by Polylines and Polygons.
options method will return an option to Split, which replaces
the segment with two segments divided in the center of the original.
This can be undone.Segment into PathSegmentPath now use PathSegmentSegmentLinearSegmentPolygon use a closed loop of LinearSegmentsPolyline use a sequence of LinearSegmentsPolygons and Polylines can still be clickedLinearSegment undoableMost elements (not yet Lines and Polylines) have equivalent Path versions. It would be useful in many cases to allow converting elements to a more general format.
The following context menu options will be added:
Line:
Polyline:
Close Loop
This adds a LinearSegment between the end points of the line and
creates a Polygon from the new closed loop.
Polygon:
Rectangle:
Convert to Polygon
This option only exists when not rounded.
Convert to Path
This option only exists when rounded.
Ellipse:
Convert to Path
Arc segments are difficult, so this will replace the element with one of the following:
Path with a single Arc segmentPath with two Arc segments, divided along the x axisPath with two Arc segments, divided along the x axis, with
degenerate Line segments between themCircle:
All of these options replace the element with an equivalent element of a
more general type. Only the most specific more general element type is an
option, so converting a Circle to a Path, for example, requires
converting to an Ellipse first.
Converting an element keeps the transform, fill, and stroke of the original.
All of these actions can be undone.