OpeningTool class
Spec 08 D14: the Door (D), Window (N) and Gap (G) tools, one class and
three instances. A PlacementTool whose first click commits one
opening; the tool stays active, so a run of doors is a run of clicks,
and Escape (with nothing pending, ever) returns to the select tool.
- The host is the wall whose band contains the raw pointer, the lowest handle when several do: WallBands.hostAt, shared with the Wall tool. The scan is not gated on object snap (Ruling 08-11): finding the host is not a snap. Only a wall the user can see and select hosts (spec 12b S-11, isUsableHost): its object layer must be visible and unlocked; another wall is passed over, as if it had no band. No wall under the pointer: no preview, and a click does nothing.
- The position is
uof the resolved point (the snap chain's) projected onto the host's centreline in its local space, unless an edge snap wins (D15, selfSnap): with object snap on, an edge of the would-be opening at the raw point's projection within the aperture of one of the host's stretch ends or of its other openings' drawn cut edges (edgeSnap) puts that edge on it, outright. What is stored is the centre of the cut the opening would get there (D8):uitself when it fits there, the clamped centre (storedCentreOf) when it had to move into a stretch, anduclamped to[0, L]when it is no-fit (D6: the tools only produce positions on the wall; the slide grip clamps the same way). - A door's swing is the side of the band's midline the raw
click lies on (D14 as amended, Ruling 08-23):
leftwhen(p − s)·n − (lOff + rOff)/2 ≥ 0. Its hinge isstartwhen the stored centre is at mostL/2,endotherwise. A window or a gap is writtenstartandleft. - The commit is one
CompoundCommand: the opening's group at the identity, then itsOpeningParams. One undo step, in which the host regenerates. A refused one (a malformed host from a file) places nothing.
The snap marker (markerPoint, Ruling 08-14) is drawn at the projected point on the host's centreline, not at the chain's point.
The frame cache (Ruling 08-13): the hovered host's frame, stretches, other openings and their drawn cuts, from the document adapter (wallsInDocument). It is rebuilt only when the hovered host changes, when the document reports a change (WallBands.generation), and at every click. A pointer move over the same host costs a projection, a placement and the preview's few points.
- Inheritance
-
- Object
- ChangeNotifier
- OpeningTool
Constructors
-
OpeningTool(OpeningKind kind, ValueNotifier<
OpeningSettings> settings, {WallBands? bands}) -
bandsis the band cache the shell shares with the Wall tool; without one the tool keeps its own.
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 - debugFrameBuilds ↔ int
-
How many times the frame cache was rebuilt.
getter/setter pair
-
debugPreview
→ List<
(EntityKind, GeometryPayload)> -
The hover preview, in world.
no setter
- debugPreviewBuilds ↔ int
-
How many hover previews were built.
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
- 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
- kind → OpeningKind
-
final
- markerPoint → Vector2
-
The snap marker sits at the projected point on the hovered host's
centreline (Ruling 08-14); elsewhere, at the chain's point.
no setter
- name → String
-
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
-
settings
→ ValueNotifier<
OpeningSettings> -
Owned by the shell; the tool only reads it, at each hover and click.
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,
ToolController.activate, the layer's deactivate and dispose) drops the pending shape and never touches the document (invariant 3).inherited -
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, so
hoverPointis the resolved point andrawthe pointer's. -
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 -
onPointerUp(
ToolPointerEvent e, ToolContext ctx) → void -
inherited
-
paintOverlay(
Canvas canvas, ViewportTransform camera, Size viewport, PaperPalette paper) → void -
Paints in screen space, after paintWorldOverlay. Every colour comes
from
paper, the overlay's own set for the paper under it (dark theme spec D5); none is kept in a field initialiser.inherited -
paintRubberBand(
Canvas canvas, Vector2 origin, double scale) → void - The would-be symbol and cut, from the payloads the last pointer move built; 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? -
Spec 08 D15's edge snap, as 05 D4's self-snap: it wins outright over
the chain. With object snap on and a host under
raw, the raw point is projected onto the host's centreline and edgeSnap is applied there; on a hit, the snapped centre's world point on the centreline. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited