RoomTool class
Spec 10 D19: the Room tool (M). A PlacementTool whose one click
commits one room; it stays active, and Escape (with nothing pending,
ever) returns to the select tool.
-
The seed is the raw pointer, unsnapped (R-18; 08's Ruling 08-14): a snap would pull it onto a wall's vertex or face, where the room dissolves at once. So no snap marker is drawn (paintOverlay): the pointer is not snapped, as when nothing snaps.
-
The verdict for a point, hover and click alike, the same code (
_verdictAt), over the shell's RoomInputs (Ruling 10-11):- outside
inputs.bounds, the bounding box of every place box (T-1: not their union, which leaves out every room's interior when its walls are axis-aligned),Unboundedwithout a trace (S-5); - inside the band of the last
SeedInWallverdict's wall: reused; - inside the cached face (its outer ring, in none of its holes; an allocation-free point-in-ring test): reused;
- inside no component's outer contour (outerContours of every
input, built once per generation on the first hover that reaches
this step):
Unboundedwithout a trace (the re-review's T-8 cache, adopted at execution). This is a point outside the building but inside the box, between it and a garden wall or along a non-rectangular footprint. The contours are the tracer's own arrangement of the same inputs, tested with its own crossing number (pointInRingXY), so a point they answer isUnboundedfor the tracer too, bar a point within rounding ofroomTrace.linearof an input, which the tracer callsSeedInWall: no room either way. A point inside a contour, a courtyard included, is traced. Hovers only: a click and the re-read after a document change skip this step and trace (Task 15's review), since each runs among inputs just invalidated and needs only the trace (debugContourBuilds is unchanged across them); - otherwise
traceRoomAmong(p, inputs), the tracegeneratemakes (RI1,LZ1), and cached.
Every cache is dropped when the inputs' RoomInputs.generation moves: on each document change, and on each RoomInputs.invalidate.
- outside
-
Occupied (decision 26, R-19): the face holds a live room's world seed. No room, no preview, and the click does nothing; notice names the lowest-handle such room.
-
The commit: one
CompoundCommand, the room's group at the identity and its RoomParams (the raw seed, the next freeRoom N, the label auto), needing structure, components and geometry: one undo step, in which the room regenerates. Its handle is allocated inside the build, never predicted. A refused commit places nothing. -
The preview: the would-be face's outer ring and holes, in world, as open polylines (each ring's first point repeated), built once per new face and painted from the cached payloads, so the frame path gains no allocation.
The inputs are invalidated at every click, before its verdict (as 08's opening tools rebuild their band scan, Ruling 08-13): the document's change stream delivers after the current task, and a click must never trace among inputs the document no longer has. They are invalidated again right after the commit, so the next query in the same handler sees the new room.
While it shows a preview or a notice, a document change (an undo, an edit elsewhere) re-reads the verdict at the pointer's last point, so neither outlives the face it describes until the next pointer move.
- Inheritance
-
- Object
- ChangeNotifier
- RoomTool
Constructors
- RoomTool(RoomInputs inputs, {FloorPlanStrings strings() = _english})
Properties
- acceptingSelf ↔ bool
-
True only while
acceptruns on a self-snap's stored point (Ruling 05-4).getter/setter pairinherited - band → Path
-
Spec 05 D12: reset each frame, never reallocated.
bandPaint's colour and width are set bypaintWorldOverlaybefore it callspaintRubberBand(dark theme spec D5).finalinherited - bandPaint → Paint
-
finalinherited
- cursor → MouseCursor
-
The pointer's cursor over the layer (spec 03 D5).
InteractionLayerrebuilds itsMouseRegionwhen the tool notifies.no setterinherited - debugContourBuilds ↔ int
-
How many times the outer contours were built: once per generation at
most.
getter/setter pair
-
debugPreview
→ List<
GeometryPayload> -
The preview, in world: the outer ring, then each hole, each an open
polyline whose last point repeats its first.
no setter
- debugPreviewBuilds ↔ int
-
How many hover previews were built (Ruling 10-18): once per new face.
getter/setter pair
- debugTraces ↔ int
-
How many times the tool traced (
traceRoomAmong): a trace that ends inSeedInWalltakes in no segment, sodebugTracedSegmentsalone cannot see a band's verdict reused.getter/setter pair -
fill
→ ValueListenable<
bool> ? -
Spec 05 D13: the shell's Fill toggle. Null, or false: outlines only.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- hoverKind → SnapKind?
-
no setterinherited
- hoverPoint → Vector2
-
no setterinherited
- hoverVisible → bool
-
no setterinherited
- inputs → RoomInputs
-
The shell's document adapter, shared with the Separator tool and the
separator grips (Ruling 10-11). The tool never disposes it.
final
- isMidShape → bool
-
Spec 12a D6: a point placed and the shape not yet finished. The paths
that change
pointshere (onPointerDown, Enter and Escape inonKey,cancel) each notify.no setterinherited - isPending → bool
-
no setterinherited
- markerPoint → Vector2
-
Where
paintOverlaydraws the snap marker: the resolved hover point. A tool that places its shape somewhere derived from that point overrides it (spec 08 D15, Ruling 08-14: an opening tool marks the point projected onto its host's centreline). Read per frame: an override returns a stored point and allocates nothing.no setterinherited - name → String
-
no setter
-
notice
→ ValueListenable<
RoomOccupied?> -
The room the hovered face already holds, and after a click there
(decision 26, R-29); null otherwise, and cleared when the tool
deactivates. The shell's status line words it (spec 14d L5:
Already a room: <name>).no setter - orthoBase → Vector2?
-
Spec 05 D4: the last placed point, or none.
no setterinherited
- phase → ToolPhase
-
no setterinherited
-
points
→ List<
Vector2> -
The placed points, as exact world values (invariant 1).
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectionPreviewTransform → Transform2?
-
The world transform a live move or rotate would apply, for the
overlay's preview (spec 03 D7); null otherwise.
no setterinherited
- strings → FloorPlanStrings Function()
-
The words of the moment, read when a room is named (spec 14d L7).
final
- touchPress → TouchPress
-
How a finger's press reaches this tool (spec 14t R-1).
TouchPress.liftunless the tool's down and itscancelexecute nothing.no setterinherited
Methods
-
accept(
Vector2 point, ToolContext ctx) → void -
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
cancel(
ToolContext ctx) → void - Every cancel path (Escape with a shape pending never happens here; a switch to another tool, the layer's deactivate and dispose) clears the notice and the preview (R-29).
-
clearShape(
) → void -
inherited
-
commit(
ToolContext ctx, DraftCommand build(), {Set< Capability> needs = const {Capability.geometry}}) → bool -
Ruling 05-3: the permission check runs before
build, so a denied shape allocates no handle.needsis every capability the built command will need (spec 06 D13, Ruling 06-10); 05's shapes need geometry alone. Returns whether the command ran.inherited -
commitShape(
ToolContext ctx, EntityKind kind, GeometryPayload payload, {bool fillable = false}) → bool -
Spec 05 D13: with Fill on and a
fillableshape, one region when the boundary can fill, and the plain boundary when it cannot.inherited -
dispose(
) → void - Discards any resources used by the object.
-
finish(
ToolContext ctx) → void -
Enter while a shape is pending.
inherited
-
hovered(
Vector2 raw) → void -
Runs after every hover's resolution; the room reads
rawonly. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
onKey(
KeyEvent event, ToolContext ctx) → KeyEventResult -
inherited
-
onPointerDown(
ToolPointerEvent e, ToolContext ctx) → void -
onPointerExit(
ToolContext ctx) → void -
The shape stays: placement is click by click, not a drag.
inherited
-
onPointerMove(
ToolPointerEvent e, ToolContext ctx) → void -
inherited
-
onPointerUp(
ToolPointerEvent e, ToolContext ctx) → void -
inherited
-
paintOverlay(
Canvas canvas, ViewportTransform camera, Size viewport, PaperPalette paper) → void -
The plain, no-snap glyph, which is none (
drawSnapMarkerof no kind and no grid): the seed is the raw pointer (R-18), so a snapped kind's marker, wherever drawn, would claim a snap that does not happen. -
paintRubberBand(
Canvas canvas, Vector2 origin, double scale) → void - The would-be face's rings, from the payloads the last pointer move chose; nothing is computed here.
-
paintWorldOverlay(
Canvas canvas, Vector2 origin, double scale, PaperPalette paper) → void -
Paints under the overlay's rebased world matrix,
worldToScreen ∘ translate(origin), so coordinates handed tocanvasmust beworld − origin(Ruling 03-3).scaleis the camera's, for stroke widths. Colours come frompaper, as in paintOverlay.inherited -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
selfSnap(
Vector2 raw, double apertureWorld) → Vector2? -
A stored placed point this raw point should land on exactly, or null.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited