discontinuedPackage jet_cad_floor_plan has been discontinued and replaced by jet_cad_2d_plan.

DimensionTool class

Spec 11 D12: the Dimension tool (I). A PlacementTool of three clicks per dimension (decision 9), not chained (R-25): after the commit it waits for a new first click, as 10's Separator tool.

  • Points resolve through the drawing tools' chain (05 D4, kDragSnapMask): object snap (F3), then the grid, else the raw point. The third point too (R-22): only its height along the measuring direction's normal, and for a linear kind its side, is used.
  • Shift (R-20): at the second click, 05's ortho from the first point; at the third, linear, with ortho off (orthoBase is null once two points are placed). The tool records Shift from the pointer events and the Shift key before PlacementTool sees them (S-8), since accept does not carry it.
  • Click 2 is ignored when the pair is degenerate (R-23): the two points within wallJoin.linear, or their attach candidates sharing a wall end point. The tool keeps waiting for the second point.
  • Click 3 commits: the kind (kindFor), both ends decided at the commit (decision 22) from candidates gathered afresh against the document as it is then (attachCandidates, decideEnd; decision 23: by position while F3 is on), a FixedEnd where none attaches, and the offset by D6's placement function (offsetFor). One CompoundCommand, the group at the identity and its DimensionParams: one undo step, in which the dimension generates. A refused commit places nothing.
  • Enter does nothing while points are pending (R-33: finish stays the default no-op); Esc and undo are PlacementTool's (05 D3, D5).

The preview (R-24): after click 1 the rubber band from it to the resolved hover point; after click 2 the would-be dimension's five lines in world, for the kind Shift selects now, laid out by the functions generate uses (the plan's Ruling 11-3: kindFor, decideEnd among the memoised candidates, offsetFor, layoutDimension), so it equals the committed children. It is rebuilt only when the resolved point, Shift or the generation changes, into a cached array (debugPreviewBuilds); paintRubberBand draws from it and computes nothing. A dimension that cannot be laid out previews nothing and has no value.

The rings: a kAttachRingPixels circle in the preview colour at each placed or hovered point whose attach candidates are not empty, only while F3 is on; decided on the pointer move, drawn per frame from flags.

The notice (notice): the would-be value while two points are placed, exactly the TEXT's string in the page's unit (4.69); the shell's status line appends it (Dimension — 4.69, S-8). Null otherwise: after the commit, on Esc and on deactivation.

The hover memo (the plan's Ruling 11-8): the attach candidates per distinct resolved point, and T (thickestWall), valid for one generation. The generation moves on each doc.changes event, at the tool's own commit, and on activation. ToolController calls no hook on activation, only cancel on deactivation, so the tool learns it is active at its first event with a context: it subscribes to the document's changes there and moves the generation, and cancel drops the subscription. Every click gathers afresh against the document as it is then, and never reads the memo (debugAttachSearches counts every search, hover or click).

Inheritance

Constructors

DimensionTool()

Properties

acceptingSelf ↔ bool
True only while accept runs 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 by paintWorldOverlay before it calls paintRubberBand (dark theme spec D5).
finalinherited
bandPaint → Paint
finalinherited
cursor → MouseCursor
The pointer's cursor over the layer (spec 03 D5). InteractionLayer rebuilds its MouseRegion when the tool notifies.
no setterinherited
debugAttachSearches ↔ int
How many attachCandidates searches the tool made, for hovers and clicks (spec 11 D12's costs, TL8).
getter/setter pair
debugPreview → List<(Vector2, Vector2)>
The cached preview's five lines in world, as paintRubberBand draws them; empty when none is shown.
no setter
debugPreviewBuilds ↔ int
How many times the preview after click 2 was built (TL5): once per change of the resolved point, Shift or the generation, never per frame.
getter/setter pair
debugPreviewKind → DimKind?
The kind the cached preview was built for, or null before any.
no setter
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
isMidShape → bool
Spec 12a D6: a point placed and the shape not yet finished. The paths that change points here (onPointerDown, Enter and Escape in onKey, cancel) each notify.
no setterinherited
isPending → bool
no setterinherited
markerPoint → Vector2
Where paintOverlay draws 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<String?>
The would-be value while two points are placed, the page's unit (spec 11 D12, S-8); null otherwise. The shell's status line appends it.
no setter
orthoBase → Vector2?
R-20: 05's ortho at the second click; none once two points are placed, so the third point's drag side is where the person dragged, not an ortho-pinned point (M-11ortho3).
no setter
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
touchPress → TouchPress
How a finger's press reaches this tool (spec 14t R-1). TouchPress.lift unless the tool's down and its cancel execute 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, a switch to another tool, the layer's deactivate and dispose): the shape, the rings and the notice go, and the document's changes are no longer heard until the next event.
clearShape() → void
Every placed point is dropped, and with them the preview, the placed points' rings and the notice: after the commit, on Esc and on deactivation.
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. needs is 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 fillable shape, 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, a Shift press or release and a camera change included.
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
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
onPointerUp(ToolPointerEvent e, ToolContext ctx) → void
inherited
paintOverlay(Canvas canvas, ViewportTransform camera, Size viewport, PaperPalette paper) → void
The snap marker, then a ring at each attaching placed or hovered point (decided on the pointer move; nothing is searched here).
paintRubberBand(Canvas canvas, Vector2 origin, double scale) → void
After the first click, the rubber band from it to the resolved hover point, as the Line tool draws it; after the second, the cached preview's five lines (spec 11 D12's preview, R-24). Painted per frame from stored numbers; 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 to canvas must be world − origin (Ruling 03-3). scale is the camera's, for stroke widths. Colours come from paper, 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

Static Methods

kindFor(Vector2 q, Vector2 p0, Vector2 p1, {required bool shift}) → DimKind
The kind a third point q commits for the pair p0, p1 (spec 11 D12, R-21), in world (the tool's group is the identity):