@floless/app 0.119.0 → 0.120.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floless-server.cjs +1503 -733
- package/dist/schemas/steel.model.v2.schema.json +43 -0
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +87 -10
- package/dist/web/app.css +38 -4
- package/dist/web/aware.js +5 -0
- package/dist/web/steel-3d-core.js +21 -0
- package/dist/web/steel-3d-view.js +359 -1
- package/dist/web/steel-editor.html +782 -5
- package/package.json +2 -1
|
@@ -38,6 +38,49 @@
|
|
|
38
38
|
"dims3d": { "type": "array", "items": { "$ref": "#/$defs/dim3" }, "description": "Draft-only 3D dimensions, world mm. Model-global. NOT baked into the lock / IFC / BOM." },
|
|
39
39
|
"detail_placements": { "type": "array", "items": { "$ref": "#/$defs/detailPlacement" }, "description": "Draft-only placed 2D detail images. Ids are SHEET-unique, not global." },
|
|
40
40
|
"views": { "type": "array", "items": { "$ref": "#/$defs/view" }, "description": "Draft-only saved views. Editor state, model-global. NOT baked." },
|
|
41
|
+
"reference_models": {
|
|
42
|
+
"type": "array",
|
|
43
|
+
"description": "BORROWED GEOMETRY WE NEVER OWN — external models (an architect's IFC) overlaid in the 3D editor so you can see them, snap to them and build against them. Each entry is a POINTER plus how it is placed and displayed; the GEOMETRY is never here. It is tessellated into the project's reserved internal cache and rebuilt on open, because the contract is persisted, versioned and re-sent on every 3D rebuild. A reference never reaches a BOM, an export of our steel, a connection, or the lock (contract-bake strips this key). Converting a reference CREATES a native member and leaves the reference untouched. Draft-and-display state, like `views`.",
|
|
44
|
+
"items": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"required": ["id", "file", "name"],
|
|
48
|
+
"properties": {
|
|
49
|
+
"id": { "type": "string", "minLength": 1 },
|
|
50
|
+
"file": { "type": "string", "minLength": 1, "description": "Project-RELATIVE path to the copied original. Never absolute: an absolute path leaks the author's disk and breaks on any other machine. Traversal is rejected at the route, not merely by convention." },
|
|
51
|
+
"name": { "type": "string", "description": "The file's display name — NOT the authoring path embedded in the IFC header, which is somebody's OneDrive layout." },
|
|
52
|
+
"placement": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"additionalProperties": false,
|
|
55
|
+
"description": "Applied in the order scale -> rotate -> move, pivoting on the insertion point so changing scale after positioning does not make the model run away.",
|
|
56
|
+
"properties": {
|
|
57
|
+
"origin": { "type": "array", "items": { "type": "number" }, "minItems": 3, "maxItems": 3, "description": "World mm." },
|
|
58
|
+
"rotation": { "type": "number", "description": "Degrees about Z." },
|
|
59
|
+
"scale": { "type": "number", "exclusiveMinimum": 0, "description": "UNIFORM only. One factor for X, Y and Z — non-uniform scale on a 3D model is almost always a broken export, and it silently corrupts every profile and angle." }
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"units": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"additionalProperties": false,
|
|
65
|
+
"description": "What the file said about its units. PROVENANCE, not a conversion factor: web-ifc reads IfcUnitAssignment itself and normalises geometry before floless sees a vertex (measured 2026-07-25), so nothing scales the mesh by this.",
|
|
66
|
+
"properties": {
|
|
67
|
+
"declared": { "type": ["string", "null"], "description": "Verbatim, e.g. \"MILLI.METRE\". null means the file did not say." },
|
|
68
|
+
"override": { "type": ["string", "null"], "description": "Set only when the user overrode a file that LIES about its units." }
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"display": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"additionalProperties": false,
|
|
74
|
+
"properties": {
|
|
75
|
+
"visible": { "type": "boolean" },
|
|
76
|
+
"opacity": { "type": "number", "minimum": 0, "maximum": 1 },
|
|
77
|
+
"locked": { "type": "boolean", "description": "Freezes move/rotate/scale/delete/reload. Does NOT affect visibility or snapping — lock means 'do not let me move this by mistake', not 'stop using it'." },
|
|
78
|
+
"snap": { "type": "boolean", "description": "INDEPENDENT of `visible`. A hidden reference still snaps unless this is false: hiding is a visual act (get it out of my way) and you still want to land on their grid intersection." }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
41
84
|
"prop_labels": { "$ref": "#/$defs/propLabels", "description": "Draft-only display state: which member properties render as text chips. CLOSED because `ids` holds member ids." },
|
|
42
85
|
"dim_overlays": { "type": "object", "additionalProperties": true, "description": "Draft-only per-overlay toggles (bolt_pitch, edge_clearance, …). Booleans only, no ids." },
|
|
43
86
|
"dim_style": { "type": "object", "additionalProperties": true, "description": "Draft-only dimension style (end/bg/place). No ids." },
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: floless-app-steel-takeoff
|
|
3
3
|
description: Read a structural steel drawing into an editable steel.takeoff/v1 contract in floless.app — the "Steel Takeoff" reader. Triggers on a pending floless `rebake` request for the `steel-model` app (queued from its "Re-read & re-bake ▸" button), or asks like "read this framing plan into a takeoff", "turn this structural drawing into a takeoff", "bake my drawing into steel-model", "extract members from this PDF". Teaches the host AI to READ a steel drawing (PDF/image) with its own vision at COMPOSE time, build a steel.takeoff/v1 contract (members + profiles + elevations + weights from AISC lookup), write it to the contract store, and hand control to the editor — no model in the run path, no API key.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.
|
|
5
|
+
version: 0.15.0
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Steel Takeoff — read a drawing into a steel.takeoff/v1 contract
|
|
@@ -315,7 +315,12 @@ text layer. You CAN read them: you already have vision on the sheet. So:
|
|
|
315
315
|
onto the other, silently. The 1b write already happened, and the user's next Filter-node Save writes
|
|
316
316
|
back the contract *it loaded*; an unwritten grid (and its vision-read labels) would be silently dropped.
|
|
317
317
|
|
|
318
|
-
|
|
318
|
+
**Do not "skip silently" a gridless sheet — the same trap as the registration one below.** A plan with
|
|
319
|
+
no `grid` raises `grid-missing` at severity **block**, which refuses the ENTIRE first read exactly as a
|
|
320
|
+
missing control does. If a framing plan genuinely prints no grid bubbles (rare), it cannot be presented
|
|
321
|
+
as a plan at all: leave it out of `plans[]`, follow *Registration is mandatory on every plan sheet*
|
|
322
|
+
(§1d) — including its warning that an omitted sheet's MEMBERS are dropped with it — and tell the user
|
|
323
|
+
which sheet and why.
|
|
319
324
|
|
|
320
325
|
### 1d. Model datum — ASK which grid intersection is global 0,0,0
|
|
321
326
|
|
|
@@ -388,15 +393,75 @@ Same flat shape as the datum above — a point plus which intersection it is:
|
|
|
388
393
|
baseline, the smaller the angular error. Diagonally opposite is ideal.
|
|
389
394
|
- Same reading rules as the datum: take the labels from `labels_x` / `labels_y`, never guess from
|
|
390
395
|
appearance, never invent an intersection the sheet does not print.
|
|
391
|
-
- **When the sheet prints only one labelled intersection
|
|
392
|
-
|
|
396
|
+
- **When the sheet prints only one labelled intersection, you cannot omit these and carry on.** Earlier
|
|
397
|
+
guidance here said to omit both fields and say so; that is now wrong, and following it fails the whole
|
|
398
|
+
read. `control2_at` and `control2_ref` are REQUIRED on every plan sheet — see *Registration is
|
|
399
|
+
mandatory* immediately below for what to do instead.
|
|
393
400
|
- Do NOT ask the user for this one — unlike the datum, it is not a project decision. It is a second
|
|
394
401
|
reading of something already printed, so read it.
|
|
395
402
|
|
|
396
|
-
- **Any intersection is a valid datum** — verified: the choice moves registration by under 1 mm.
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
403
|
+
- **Any intersection is a valid datum** — verified: the choice moves registration by under 1 mm. Pick
|
|
404
|
+
one for the model and prefer it on every sheet that prints it, because a shared datum makes the set
|
|
405
|
+
easiest to reason about. But sheets do NOT have to agree: `planTransform` resolves each sheet's own
|
|
406
|
+
`datum_ref` against the model grid, so a sheet that cannot print the chosen intersection may name a
|
|
407
|
+
different one and still register correctly. (An earlier version of this line said every sheet must use
|
|
408
|
+
the same one, which contradicted the `datum_ref` mechanism three paragraphs above.)
|
|
409
|
+
- Never guess a datum, and never substitute an unlabelled crossing. When a sheet prints no labelled
|
|
410
|
+
intersection at all, see *Registration is mandatory* below — you cannot simply leave `datum_at` unset
|
|
411
|
+
and continue.
|
|
412
|
+
### Registration is MANDATORY on every plan sheet — an unregistered sheet fails the whole read
|
|
413
|
+
|
|
414
|
+
**`datum_at`, `control2_at` and `control2_ref` are required on every sheet you present as a framing
|
|
415
|
+
plan.** Not best-effort, not "record it when the sheet prints it". A first read composes a
|
|
416
|
+
`steel.takeoff/v1` staging document, and the server converts it to `steel.model/v2` inside one
|
|
417
|
+
transaction. That conversion runs `planTransform` over every plan sheet, and a sheet missing any of
|
|
418
|
+
those three is refused with `plan-uneditable:registration-incomplete` — which **fails the entire read**.
|
|
419
|
+
Nothing is published: no model, no version, no partial import. One unregistered sheet in a twenty-sheet
|
|
420
|
+
set costs you all twenty.
|
|
421
|
+
|
|
422
|
+
(That is why the older advice above — "omit both fields and say so", "leave `datum_at` unset and say
|
|
423
|
+
which sheets are unregistered" — no longer holds. It predates the born-v2 transaction and, followed
|
|
424
|
+
literally, guarantees a 400.)
|
|
425
|
+
|
|
426
|
+
**When the drawing genuinely will not give you two labelled intersections on a sheet:**
|
|
427
|
+
|
|
428
|
+
1. **Look harder first, in this order.** Grid bubbles are often outside the framing area — check the
|
|
429
|
+
full page, not the crop. Continuation/match lines carry axis labels. An enlarged plan usually prints
|
|
430
|
+
at least one bubble pair even when the main crop does not. A second control does not have to be near
|
|
431
|
+
the steel; furthest-apart is better.
|
|
432
|
+
2. **If it still prints only one, or none: do NOT present that sheet as a plan.** Leave it out of
|
|
433
|
+
`plans[]` for this read and record why in `read_notes` — name the sheet and say what was missing.
|
|
434
|
+
The rest of the set then imports normally, and the user gets a model instead of a refusal.
|
|
435
|
+
|
|
436
|
+
**An omitted sheet contributes NOTHING — not just its registration, but its members.** The read only
|
|
437
|
+
ever sees the plans you submit, so nothing from that sheet reaches the model. Registering it in the
|
|
438
|
+
editor afterwards cannot recover members that were never read: the sheet needs a fresh read once it
|
|
439
|
+
can be registered. Say that to the user, or they will assume the steel is there and unpositioned.
|
|
440
|
+
|
|
441
|
+
**AND CLEAR EVERY MODEL-LEVEL REFERENCE TO THOSE MEMBERS, or the read still fails.** v1 stores
|
|
442
|
+
members inside their plan, but several blocks point AT them from the document root, and a dangling
|
|
443
|
+
reference is its own blocking issue — you escape `registration-incomplete` straight into
|
|
444
|
+
`prop-label-unresolved`, `joint-ref-unresolved` or `candidate-references-broken`, which is more
|
|
445
|
+
cryptic and, because no candidate gets built, names **no sheet at all**. Before dropping a sheet,
|
|
446
|
+
remove every id belonging to it from:
|
|
447
|
+
|
|
448
|
+
`prop_labels.ids` · `joints[].main` and `joints[].secondaries` · `views[].objects` ·
|
|
449
|
+
`detail_placements[].sheet` · any cross-sheet `dims` reference.
|
|
450
|
+
3. **If it is the ONLY framing plan in the set, there is no way through.** A read with no plans is
|
|
451
|
+
refused with `no-plans`. Say so and stop — do not invent a datum to get past the gate.
|
|
452
|
+
4. **Tell the user plainly which sheets you left out and why**, so they can decide: mark up the drawing
|
|
453
|
+
with a labelled control and re-read, or accept the omission. That is their call, not yours to make
|
|
454
|
+
silently either way.
|
|
455
|
+
|
|
456
|
+
**Never** invent a datum, reuse another sheet's coordinates, or fabricate `control2_ref` labels to get
|
|
457
|
+
past the gate. A registration that is wrong is worse than a sheet that is absent: every member read
|
|
458
|
+
from that sheet lands in the wrong place, and nothing downstream can tell.
|
|
459
|
+
|
|
460
|
+
If a read is refused anyway, the error names the sheets — e.g.
|
|
461
|
+
`plan-uneditable:registration-incomplete on sheets S-203, S-207`. Fix or drop exactly those and re-read.
|
|
462
|
+
(Verified against the message the server actually produces — `steel-takeoff-skill-registration.test.ts`
|
|
463
|
+
pins the two in step, because an example the AI cannot find in the error is worse than no example.)
|
|
464
|
+
|
|
400
465
|
- **Say so when a sheet is rotated or mirrored** relative to the others (a plan drawn at a skew, or a
|
|
401
466
|
reversed-hand view). A datum point fixes translation only; it cannot correct orientation, and
|
|
402
467
|
registering such a sheet as if it were square would silently distort every member read from it.
|
|
@@ -743,15 +808,22 @@ excluded from the average and counted separately as the headline drag).
|
|
|
743
808
|
**The score endpoint is your gauge — call it, don't guess:**
|
|
744
809
|
|
|
745
810
|
```
|
|
746
|
-
POST http://localhost:<port>/api/contract/steel-model/score
|
|
811
|
+
POST http://localhost:<port>/api/contract/steel-model/score?project=<projectId>
|
|
747
812
|
Content-Type: application/json
|
|
748
813
|
{ "contract": <your draft contract>, "target": <target_confidence, e.g. 70> }
|
|
749
814
|
```
|
|
750
815
|
|
|
816
|
+
**Pass `?project=` whenever you are working inside a project.** It scopes the fallback read and the
|
|
817
|
+
confidence target to that project. Without it — and this route used to IGNORE the parameter entirely
|
|
818
|
+
(#511) — a body-less call scores the APP-level document instead: a confidence answer about a model you
|
|
819
|
+
did not ask about, returned with no error. This route is the gauge the read-loop uses to decide when to
|
|
820
|
+
STOP reading, so a confident number about the wrong model is the worst possible answer. It is safe to
|
|
821
|
+
omit only when there is genuinely no project.
|
|
822
|
+
|
|
751
823
|
Returns `{ score, target, meetsTarget, gap, rfiCount, counts, worklist, filterMissing }` — the SAME
|
|
752
824
|
aggregate the editor's Confidence chip shows. `worklist` is the rfi/low/med members dragging the score,
|
|
753
825
|
worst-first (heaviest first within a band), each with a `reason`. (Omit `contract` to score the stored
|
|
754
|
-
one.)
|
|
826
|
+
one — that is the read the `?project=` scope governs.)
|
|
755
827
|
|
|
756
828
|
**`filterMissing` is the completeness gate — independent of the confidence score.** `true` means the
|
|
757
829
|
contract has no usable `filter` block: step 1b never ran, so the members were bound by the length
|
|
@@ -1259,6 +1331,11 @@ So the re-read must keep identity stable:
|
|
|
1259
1331
|
> that was stored. If the staging cannot be converted the answer is a `400` naming the reason
|
|
1260
1332
|
> (`v1-staging-exit`, e.g. `grid-lines-unmigrated` or `plan-uneditable:registration-incomplete`) and
|
|
1261
1333
|
> **nothing is published** — no contract, no activation, no version. Fix the read and re-post.
|
|
1334
|
+
>
|
|
1335
|
+
> **`plan-uneditable:registration-incomplete` or `grid-missing` → go back to
|
|
1336
|
+
> §1d *Registration is mandatory on every plan sheet*.** The message names the sheets. That section
|
|
1337
|
+
> is where the fix is, and it is 900 lines above this one — this pointer exists because this 400 is
|
|
1338
|
+
> where you will be standing when you need it.
|
|
1262
1339
|
|
|
1263
1340
|
> **On a `steel.model/v2` project compose a `steel.model/v2` document instead** — check the `type`
|
|
1264
1341
|
> of the contract you GET-ed in step 1. Members live in one root `members[]` in world millimetres,
|
package/dist/web/app.css
CHANGED
|
@@ -2621,6 +2621,40 @@
|
|
|
2621
2621
|
[data-theme="light"] .trace .lvl.err { color: #dc2626; }
|
|
2622
2622
|
[data-theme="light"] .dag-label-bg { fill: var(--bg); stroke: var(--border); }
|
|
2623
2623
|
|
|
2624
|
+
/* Scrollbars — BOTH engines, globally: the same TECHNIQUE the four standalone surfaces
|
|
2625
|
+
(steel-editor / steel-filter / vector-editor / vector-3d) have always used.
|
|
2626
|
+
|
|
2627
|
+
The technique, not the values. Those four declare `width:10px`, `border-radius:6px`, a
|
|
2628
|
+
hard-coded #475569/#5b6b85 and a `content-box` inset; this surface keeps its own baseline
|
|
2629
|
+
numbers (8px, 4px) and its tokens (var(--border-strong)), because the aware-demo extraction
|
|
2630
|
+
fixed those for the 19 containers here that already set the standard properties. Matching a
|
|
2631
|
+
DIFFERENT locked surface's pixels would itself be a baseline deviation.
|
|
2632
|
+
|
|
2633
|
+
The `::-webkit-scrollbar` block below is Chromium/Safari only; it carries NOTHING to Firefox,
|
|
2634
|
+
which reads the standard `scrollbar-width`/`scrollbar-color`. Without the `*` rule those
|
|
2635
|
+
properties had to be repeated on every scroll container by hand, and 20 of the 39 containers on
|
|
2636
|
+
this surface never got them — `.messages` (the chat pane), `.dashboard`, `.wf-list`, `pre.code`,
|
|
2637
|
+
`html`/`body` among them — so Firefox drew its native light bar straight through the dark theme.
|
|
2638
|
+
Three CSS comments and two specs in docs/superpowers record maintainers hitting this and
|
|
2639
|
+
patching ONE container each time; the `*` rule is the root fix, and CLAUDE.md asks for exactly
|
|
2640
|
+
it ("prefer a global `*` scrollbar rule per surface so new containers inherit it").
|
|
2641
|
+
|
|
2642
|
+
Keep BOTH blocks. The standard properties do not reach Safari before 18.2, and the webkit block
|
|
2643
|
+
does not reach Firefox at all — neither is redundant.
|
|
2644
|
+
|
|
2645
|
+
WHAT THIS COSTS, measured in Chromium 141 rather than assumed. Where a browser supports both,
|
|
2646
|
+
the standard properties suppress the ENTIRE `::-webkit-scrollbar*` block below, not just its
|
|
2647
|
+
width. So on Chromium: the gutter goes 8px → 10px, the thumb 8px → 6px with an inset, and
|
|
2648
|
+
`::-webkit-scrollbar-thumb:hover { background: var(--text-dim) }` stops applying — hover becomes
|
|
2649
|
+
Chromium's own rgb(92,103,119) instead of the authored --text-dim. The resting thumb colour is
|
|
2650
|
+
unchanged (`--border-strong`, via scrollbar-color).
|
|
2651
|
+
|
|
2652
|
+
That is a real change to the locked baseline, and it is accepted deliberately: the 19 containers
|
|
2653
|
+
that already set the standard properties have rendered exactly this way all along, as have all
|
|
2654
|
+
four standalone surfaces. This rule makes the remaining 20 MATCH them rather than introducing a
|
|
2655
|
+
new look — the alternative, keeping the webkit hover on those 20, is precisely the per-container
|
|
2656
|
+
divergence that left Firefox unthemed for three repairs running. */
|
|
2657
|
+
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
|
|
2624
2658
|
::-webkit-scrollbar { width: 8px; height: 8px; }
|
|
2625
2659
|
::-webkit-scrollbar-track { background: transparent; }
|
|
2626
2660
|
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
|
|
@@ -2707,10 +2741,10 @@ body {
|
|
|
2707
2741
|
#compile-btn:hover { color: var(--text); border-color: var(--accent); }
|
|
2708
2742
|
#compile-btn:disabled { color: var(--text-dim); border-color: var(--border-strong); cursor: default; opacity: 0.6; }
|
|
2709
2743
|
|
|
2710
|
-
/* Bake into agent
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2744
|
+
/* (The #bake-btn "Bake into agent" header button left the header with the Graft UI
|
|
2745
|
+
— 668cae68, "Bake is REMOVED from the header" — and is #menu-bake-item in the ≡ menu
|
|
2746
|
+
now, so its toolbar styles were removed with it. NOT #149: that one moved Agents,
|
|
2747
|
+
Routines and the view toggle, which is what the two sibling comments above cite.) */
|
|
2714
2748
|
/* Bake modal preview: agent name + inputs chips (mirror the canvas node-input chips). */
|
|
2715
2749
|
#bake-modal .bake-name code { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
|
|
2716
2750
|
#bake-modal .bake-inputs { display: flex; flex-wrap: wrap; gap: 6px; }
|
package/dist/web/aware.js
CHANGED
|
@@ -5831,6 +5831,11 @@
|
|
|
5831
5831
|
return 'AWARE requires Node.js, which was not found on this machine. Install Node.js (nodejs.org), then try again.';
|
|
5832
5832
|
case 'eacces':
|
|
5833
5833
|
return "Couldn't install because this location requires administrator permissions. Run FloLess as administrator, or install Node.js globally yourself and try again.";
|
|
5834
|
+
case 'toolchain-unverified':
|
|
5835
|
+
// Deliberately NOT the no-node copy: the check never finished, so we have no
|
|
5836
|
+
// idea whether Node.js is missing. Telling someone to install what they already
|
|
5837
|
+
// have is the exact bug this reason exists to prevent.
|
|
5838
|
+
return "Couldn't check whether Node.js is installed — the check didn't finish, which usually means the machine was busy. Nothing is necessarily missing; try again.";
|
|
5834
5839
|
case 'offline':
|
|
5835
5840
|
return 'No network connection was detected. Connect to the internet, then try again.';
|
|
5836
5841
|
case 'smoke-failed':
|
|
@@ -305,12 +305,32 @@ function closestOnSeg(p, a, b) {
|
|
|
305
305
|
return [a[0] + ab[0] * t, a[1] + ab[1] * t, a[2] + ab[2] * t];
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
+
// Once per candidate TYPE, not once per session: a single global latch meant the first malformed kind
|
|
309
|
+
// silenced every later one, so a second, unrelated breakage would arrive with no trace at all. Keyed by
|
|
310
|
+
// type because that is what identifies the producer, and the set cannot grow per pointer move.
|
|
311
|
+
const warnedSkipped = new Set();
|
|
308
312
|
/** The 3D point a candidate proposes for the dragged point. */
|
|
309
313
|
function candidatePoint(c, dragged) {
|
|
310
314
|
if (c.type === 'vertex' || c.type === 'intersection' || c.type === 'midpoint' || c.type === 'level' || c.type === 'origin' || c.type === 'origin-grid') return c.p; // fixed points (origin-grid = a quantized lattice node, UCS Stage 6)
|
|
311
315
|
if (c.type === 'vertical-axis') return [c.p[0], c.p[1], dragged[2]]; // lock plan X/Y to the axis, keep dragged Z
|
|
312
316
|
if (c.type === 'grid-int') return [c.p[0], c.p[1], dragged[2]]; // grid steers PLAN only — never yanks the elevation
|
|
313
317
|
if (c.type === 'grid-line') { const q = closestOnSeg(dragged, c.a, c.b); return [q[0], q[1], dragged[2]]; }
|
|
318
|
+
// A CANDIDATE WITH NO SEGMENT IS NOT A SEGMENT. The fall-through treats anything unrecognised as a
|
|
319
|
+
// centreline and dereferences `a`/`b`; a candidate carrying only a point (an unknown or mistyped
|
|
320
|
+
// `type`) therefore threw INSIDE the pointer-move handler, killing the whole draw preview — which is
|
|
321
|
+
// exactly what a mistyped reference candidate did until the QA pass found it. The caller already
|
|
322
|
+
// promises that a reference "must never break member dragging"; that promise cannot be kept from the
|
|
323
|
+
// caller alone, because this throw happens later, in `snapPoint`, outside its try.
|
|
324
|
+
//
|
|
325
|
+
// SKIPPED, NOT SUBSTITUTED. The first cut returned `c.p || dragged`, and review was right that this is
|
|
326
|
+
// worse than the throw for a genuine centreline built without its `b`: falling back to `dragged` puts
|
|
327
|
+
// the candidate at distance ZERO from the cursor, so it wins on the spot and reports a confident snap
|
|
328
|
+
// that moved nothing — and, placed first, beats the valid centreline behind it. A candidate we cannot
|
|
329
|
+
// evaluate must lose, not win. `null` is the "no opinion" answer; `snapPoint` drops it.
|
|
330
|
+
if (!c.a || !c.b) {
|
|
331
|
+
if (!warnedSkipped.has(c.type)) { warnedSkipped.add(c.type); console.warn('[snap] skipping a malformed candidate — no segment to measure', c.type); }
|
|
332
|
+
return null;
|
|
333
|
+
}
|
|
314
334
|
return closestOnSeg(dragged, c.a, c.b); // centerline
|
|
315
335
|
}
|
|
316
336
|
|
|
@@ -325,6 +345,7 @@ export function snapPoint(dragged, candidates, toScreen, tolPx) {
|
|
|
325
345
|
let best = null, bestPt = null, bestPrec = Infinity, bestD = Infinity;
|
|
326
346
|
for (const c of candidates || []) {
|
|
327
347
|
const pt = candidatePoint(c, dragged);
|
|
348
|
+
if (!pt) continue; // structurally unevaluable — it must lose, not snap to the cursor
|
|
328
349
|
const s = toScreen(pt);
|
|
329
350
|
const d = Math.hypot(s.x - ds.x, s.y - ds.y);
|
|
330
351
|
if (d > tolPx) continue;
|