end method
Ends path at given point
.
Implementation
bool end({Offset? point}) {
if (point != null) {
add(point);
}
if (_points.isEmpty) {
return false;
}
if (_points.length < 3) {
if (_points.length == 1 || _points[0].distanceTo(points[1]) == 0.0) {
_addDot(CubicLine(
start: _points[0],
cpStart: _points[0],
cpEnd: _points[0],
end: _points[0],
));
} else {
_addLine(CubicLine(
start: _points[0],
cpStart: _points[0],
cpEnd: _points[1],
end: _points[1],
));
}
} else {
final i = _points.length - 3;
if (_points[i + 1].distanceTo(points[i + 2]) > 0.0) {
_addLine(CubicLine(
start: _points[i + 1],
cpStart: _points[i + 1],
cpEnd: _points[i + 2],
end: _points[i + 2],
));
}
}
return true;
}