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) {
inputs.invalidate();
final verdict = _verdictAt(_raw, contours: false);
_show(verdict);
if (verdict != _Verdict.room) return;
final seed = _raw.clone();
try {
commit(ctx, () {
final doc = ctx.document;
final name = _nextName(doc);
final h = doc.handleSeed.next();
return CompoundCommand([
AddNodeCommand(GroupNode(
handle: h,
parent: doc.rootHandle,
transform: Transform2.identity(),
children: const [])),
SetComponentCommand<RoomParams>(h, RoomParams(seed.x, seed.y, name)),
// Spec 12b D2: a new object takes the current layer.
SetComponentCommand<ObjectLayer>(h, ObjectLayer(drawingLayer(doc))),
], label: 'Add room');
}, needs: const {
Capability.structure,
Capability.components,
Capability.geometry,
});
} on ArgumentError {
// Refused: nothing is placed.
} on StateError {
// Likewise.
}
// The pointer still hovers the face, which now holds the new room.
inputs.invalidate();
_show(_verdictAt(_raw, contours: false));
}