discontinuedPackage jet_cad_floor_plan has been discontinued and replaced by jet_cad_2d_plan.
accept method
void
accept(
- Vector2 point,
- ToolContext ctx
)
Implementation
@override
void accept(Vector2 point, ToolContext ctx) {
if (!acceptingSelf) {
// Rebuilt once per click: the change stream delivers after the
// current task, so an edit in the same synchronous task as this
// click would otherwise leave the scan on the old bands.
_bands.invalidate();
final joined = Vector2.zero();
if (_joinBandInto(ctx, point.x, point.y, joined)) point = joined;
}
// Until the next hover, the band ends where this click landed.
_bandEnd.setFrom(point);
if (points.isEmpty) {
points.add(point);
return;
}
if (acceptingSelf) {
// Ruling 05-4: the accepted point *is* the stored first point.
if (_walls >= 2 && identical(point, points.first)) {
_addWall(ctx, points.last, point);
}
clearShape();
return;
}
final start = points.last;
if (_tooShort(start, point)) return;
if (!_addWall(ctx, start, point)) {
clearShape();
return;
}
_walls++;
if (points.length == 1) {
points.add(point);
} else {
points[1] = point;
}
}