@floless/app 0.130.1 → 0.131.0

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.
@@ -0,0 +1,141 @@
1
+ /**
2
+ * reference-session — the live editor state a reference's re-read destroys. Refs #734, design §7.2.
3
+ *
4
+ * `Reload its geometry` and `Load a new version…` both replace a reference's objects wholesale. Three
5
+ * pieces of state the user built up are addressed by exactly what that replaces:
6
+ *
7
+ * the drilled-into object by ARRAY INDEX — migrated a layer down, in `revalidateSubSelection`,
8
+ * which keys on the file's own GlobalId
9
+ * the tree's open groups by POSITION — '2:1' is the second storey's second type; migrated
10
+ * HERE, on the storey/type labels the file supplies
11
+ * the measurement by RAW WORLD POINTS — not migrated, and cannot be; see below
12
+ *
13
+ * WHY THE MEASUREMENT IS NOT MIGRATED, stated here because it is a decision and not an omission.
14
+ * `refMeasureKept` records two world points and no object identity at all, so "keep it if both ends
15
+ * landed on something that did not move" cannot be evaluated from what is stored. Capturing that
16
+ * identity at measure time was costed and rejected on two grounds. First, `xrefSnapPoints` deduplicates
17
+ * its points ACROSS objects on a shared 0.5 mm key, so a corner touched by two objects is attributed to
18
+ * whichever reached it first — an endpoint's recorded owner can name a NEIGHBOUR, and the asymmetry runs
19
+ * the wrong way: dropping a measurement whose owner changed is merely wasteful, while KEEPING one whose
20
+ * recorded owner looks unchanged when the corner really belonged to a changed neighbour presents a wrong
21
+ * dimension as a measured one. Second, and decisively, a reload is not a comparison at all — nothing on
22
+ * that path classifies any object as unchanged, so the test is not hard to evaluate there, it is
23
+ * undefined. So the measurement is dropped on both paths and the drop is SAID. That is the honest half
24
+ * that was missing; what must never ship is the middle road of keeping the segment and hoping.
25
+ *
26
+ * NOTHING HERE TOUCHES THE DOM OR THE EDITOR'S GLOBALS. The impure halves — reading `refGeom`,
27
+ * `refTreeGroups`, the selection and the measurement — live in `web/steel-editor.html`, which calls in.
28
+ */
29
+
30
+ /**
31
+ * Re-key the tree's group state onto a new read, and report what could not be placed.
32
+ *
33
+ * `snapKeys` is the OLD state resolved into labels while the old objects still existed:
34
+ * `[{ storey, type, val }]`, where `type === undefined` marks a STOREY-level key and `val` is the
35
+ * `{ open, q }` the tree stores. `groups` is `groupReferenceObjects(newObjects)`.
36
+ *
37
+ * MATCHED ON THE RAW VALUES, NOT THE WORDS A HEADER SHOWS. Two types inside one storey can share a
38
+ * display word — that is exactly why the tree disambiguates them with the raw IFC token — so matching on
39
+ * words would silently merge two groups the file keeps apart. `null` is itself a real label here ("no
40
+ * storey recorded"), which is why absence is tagged rather than tested for falsiness.
41
+ *
42
+ * Returns `{ keys, lost }`. `lost` names only groups the user had OPEN: an explicit close is state worth
43
+ * migrating, but a vanished group they had collapsed cost them nothing, and naming it turns routine
44
+ * housekeeping into a wall. A missing STOREY is reported once, as the storey, rather than once per type
45
+ * inside it — otherwise dropping one level reports three losses for one event.
46
+ */
47
+ export function migrateGroupKeys(snapKeys, groups) {
48
+ const tag = (v) => (v === null || v === undefined ? '-' : 'v' + v); // present values are 'v'-prefixed, so '-' cannot collide
49
+ const at = new Map();
50
+ (groups || []).forEach((s, si) => at.set(tag(s.storey), si));
51
+ const keys = new Map();
52
+ const lost = [];
53
+ const seenStorey = new Set();
54
+ for (const k of snapKeys || []) {
55
+ const si = at.get(tag(k.storey));
56
+ if (si === undefined) {
57
+ // The whole storey is gone. Reported once however many of its types were open.
58
+ if (k.val && k.val.open && !seenStorey.has(tag(k.storey))) {
59
+ seenStorey.add(tag(k.storey));
60
+ lost.push({ storey: k.storey, type: undefined });
61
+ }
62
+ continue;
63
+ }
64
+ if (k.type === undefined) { keys.set(String(si), k.val); continue; }
65
+ const ti = (groups[si].types || []).findIndex((t) => tag(t.type) === tag(k.type));
66
+ if (ti < 0) { if (k.val && k.val.open) lost.push({ storey: k.storey, type: k.type }); continue; }
67
+ keys.set(si + ':' + ti, k.val);
68
+ }
69
+ return { keys, lost };
70
+ }
71
+
72
+ /**
73
+ * Did the drilled-into object survive into this read — asked of the DATA, not of the 3D layer.
74
+ *
75
+ * The 3D layer migrates the selection itself (`revalidateSubSelection`), and the obvious way to report
76
+ * the loss is to look at whether the editor's index survived that call. It is also wrong: the push that
77
+ * runs it is a no-op whenever the 3D view is not the active one, so a user who switches to 2D while a
78
+ * re-read is in flight leaves the old index standing — which reads as "it survived", and the object is
79
+ * then quietly dropped later when 3D next rebuilds. The report has to be derivable from the objects
80
+ * themselves, in both views, or it is not a report. (Codex review.)
81
+ *
82
+ * The RULE IS THE ONE `revalidateSubSelection` ALREADY APPLIES, restated here rather than reached for:
83
+ * an id that is absent says nothing, and an id that appears twice cannot say which object you were on,
84
+ * so only an id appearing EXACTLY once counts as the same object.
85
+ */
86
+ export function objectSurvives(globalId, objects) {
87
+ if (globalId === null || globalId === undefined || globalId === '') return false;
88
+ let seen = 0;
89
+ for (const o of objects || []) {
90
+ if (o && o.globalId === globalId && ++seen > 1) return false;
91
+ }
92
+ return seen === 1;
93
+ }
94
+
95
+ /** How many lost group names are listed before the rest become a count. */
96
+ export const CARRYOVER_NAME_CAP = 3;
97
+
98
+ /**
99
+ * The one phrase that stands for a set of lost groups — capped, and the cap admits to itself.
100
+ *
101
+ * Listing every name is the failure mode this shares with the change list's own row cap: a re-read that
102
+ * drops a whole storey can lose a dozen groups at once, and a sentence naming all twelve is not read.
103
+ */
104
+ export function groupsFact(labels) {
105
+ const n = (labels || []).length;
106
+ if (!n) return null;
107
+ const shown = labels.slice(0, CARRYOVER_NAME_CAP);
108
+ const rest = n - shown.length;
109
+ return n + ' group' + (n === 1 ? '' : 's') + ' you had open ('
110
+ + shown.join(', ') + (rest > 0 ? ', +' + rest + ' more' : '') + ')';
111
+ }
112
+
113
+ /**
114
+ * One sentence for up to three facts — never three separate boxes.
115
+ *
116
+ * Three stacked notes read as a checklist of problems. This is ordinary housekeeping after an act the
117
+ * user asked for, so it gets one plain sentence in the neutral voice, or — when everything migrated —
118
+ * nothing at all. `null` means SAY NOTHING, and every caller must honour it rather than rendering an
119
+ * empty container.
120
+ *
121
+ * `tail` differs per path on purpose and is not cosmetic: `Load a new version…` really does compare
122
+ * against "the version you had", while `Reload its geometry` re-reads the SAME file and has no earlier
123
+ * version to name. One shared string would make one of the two sentences false.
124
+ */
125
+ export function carryoverSentence(facts, tail) {
126
+ const list = (facts || []).filter(Boolean);
127
+ if (!list.length) return null;
128
+ const lead = list.length === 1 ? 'One thing didn’t carry over' : 'A few things didn’t carry over';
129
+ const words = list.length === 1
130
+ ? list[0]
131
+ : list.slice(0, -1).join(', ') + ' and ' + list[list.length - 1];
132
+ return lead + ' ' + tail + ': ' + words + '.';
133
+ }
134
+
135
+ /** The two tails, kept next to each other so the difference above stays visible. */
136
+ export const CARRYOVER_TAIL = {
137
+ reload: 'into the re-read file',
138
+ version: 'from the version you had',
139
+ };
140
+
141
+ export default { migrateGroupKeys, objectSurvives, groupsFact, carryoverSentence, CARRYOVER_NAME_CAP, CARRYOVER_TAIL };
@@ -147,6 +147,8 @@ let dimDraft3d = null; // { a:[x,y,z] } once the first point is place
147
147
  let dimLastAlt = false; // last-seen Alt state (the hover rAF rebuilds a synthetic event)
148
148
  let hoverTeklaMod = false; // last-seen Ctrl+Shift state — arms the drag-out-to-Tekla cursor hint
149
149
  let pointerOverCanvas = false; // is the cursor actually on the 3D canvas right now (lastHoverXY outlives the pointer leaving)
150
+ let inputActive = true; // does this view own the keyboard? The editor sets it false when the 2D pane
151
+ // is the active one in a split — see setInputActive.
150
152
  let dims3dGroup = null; // THREE.Group of placed-dim lines (+ the live preview line)
151
153
  let dimPreviewLine = null; // reused preview line (point 1 → cursor)
152
154
  let dimLabelHost = null; // fixed-position container for label overlays
@@ -268,7 +270,7 @@ function init(canvas, theApi) {
268
270
  * THE FOUR MODEL-GLUED LABEL HOSTS SIT UNDER THE 3D CHROME, and the numbers below are the whole rule.
269
271
  *
270
272
  * Each is `position:fixed` on `<body>` and projected per frame, so it is painted in the ROOT stacking
271
- * context (`#stagewrap` and `<main>` are `position:relative; z-index:auto`, which creates none) — it
273
+ * context (`#pane3d`, `#stagewrap` and `<main>` are `position:relative; z-index:auto`, which creates none) — it
272
274
  * competes directly with the panels. They shipped at 56/57, above every panel, and a chip landing over
273
275
  * the expanded Objects panel drew ON TOP of it: unreadable itself, and hiding a control the user was
274
276
  * reading. Reported against the 3D property labels, but it was never theirs — the mark/id, dimension
@@ -1254,6 +1256,151 @@ function clearReferencePreview() {
1254
1256
  }
1255
1257
  }
1256
1258
 
1259
+ // ── GHOSTS: where an object USED to be (#734, design §6.4) ──
1260
+ //
1261
+ // A `removed` row in the change list names an object that is in the previous version of a reference and
1262
+ // not in the new one. These are its shapes, re-read from that previous file, drawn where it stood.
1263
+ //
1264
+ // A SIBLING OF `xrefGroup`, NEVER A CHILD, for exactly the reason the preview above is one — and here the
1265
+ // requirement is sharper, because "never snappable and never counted in bounds" is a promise this feature
1266
+ // makes explicitly. Every reference-interaction entry point reads that group or `xrefById` directly:
1267
+ // `pickReferenceAt` raycasts `xrefGroup.children`, `referenceCandidates` and `referenceBounds` walk
1268
+ // `xrefById`, and `visibleWorldBox` — what Fit, Home, the ViewCube and the work-area box all measure —
1269
+ // unions `sceneBox` with `xrefGroup.children` and nothing else. Parented outside both, a ghost cannot be
1270
+ // picked, cannot be snapped to and cannot drag the Fit box out to a building that is no longer there. A
1271
+ // rule someone has to remember would not survive; this is structural.
1272
+ //
1273
+ // ONE MATERIAL, in the `removed` chip's own ink, so the shape on the canvas and the badge in the list are
1274
+ // visibly the same fact. Transparent and `depthWrite:false` behind the model, like every other borrowed
1275
+ // geometry here — a deletion must never occlude the steel you are checking it against.
1276
+
1277
+ /**
1278
+ * `--err` AS THE DARK THEME DRAWS IT (#fca5a5) — the same value the change list's `removed` chip takes,
1279
+ * so the shape on the canvas and the badge in the list read as one fact.
1280
+ *
1281
+ * A COPY, AND IT DOES NOT FOLLOW `[data-theme=light]`, which is correct rather than an oversight twice
1282
+ * over: WebGL cannot read a CSS custom property, and this canvas is dark in BOTH themes anyway —
1283
+ * `scene.background` is a fixed 0x020817 and `#stage3d` is in the light theme's re-anchor list, which
1284
+ * restates the dark tokens for exactly this subtree. On light, the chip moves to `--err`'s light stop
1285
+ * and the ghost stays where the canvas it sits on stayed.
1286
+ */
1287
+ const XREF_GHOST_COLOR = 0xfca5a5;
1288
+ const XREF_GHOST_OPACITY = 0.3;
1289
+ let xrefGhostGroup = null; // the ghosts' meshes, or null when none are drawn
1290
+ let xrefGhostMat = null; // its ONE material — ghosts are uniform, so one is enough
1291
+ let xrefGhostRef = null; // which reference these belong to, so a stale set cannot outlive it
1292
+ const xrefGhostById = new Map(); // globalId -> mesh, so one ghost can be framed
1293
+
1294
+ /**
1295
+ * Draw ghosts for one reference, appending to whatever is already there.
1296
+ *
1297
+ * APPENDS rather than rebuilds, because they arrive lazily — the panel asks only for the removed rows a
1298
+ * user has actually scrolled to, so a revision with 3,000 deletions never tessellates 3,000 objects.
1299
+ * A different `refId` clears first: ghosts belong to one reference's history, and two sets overlaid would
1300
+ * be two buildings' deletions with nothing on screen saying which is which.
1301
+ *
1302
+ * `placement` is the reference's own, applied to the group exactly as the real one's is, so a ghost sits
1303
+ * where the object stood rather than at the world origin.
1304
+ */
1305
+ function setReferenceGhosts(refId, objects, placement) {
1306
+ // THE OWNERSHIP CHECK COMES FIRST, before the empty-list guard. The other order leaves the PREVIOUS
1307
+ // reference's ghosts standing — under the previous reference's placement matrix — whenever a
1308
+ // different reference asks with nothing to draw. Not reachable from today's single caller, which
1309
+ // guards on `objects.length` itself, and that is exactly what makes it worth closing: this branch is
1310
+ // the same latent seam mismatch review already caught once on this change. (Review.)
1311
+ if (xrefGhostRef !== null && xrefGhostRef !== refId) clearReferenceGhosts();
1312
+ if (!scene || !Array.isArray(objects) || !objects.length) return { drawn: 0, skipped: 0 };
1313
+ if (!xrefGhostGroup) {
1314
+ xrefGhostGroup = new THREE.Group();
1315
+ xrefGhostGroup.renderOrder = -1;
1316
+ xrefGhostGroup.applyMatrix4(xrefMatrix(placement));
1317
+ scene.add(xrefGhostGroup);
1318
+ xrefGhostMat = newXrefMaterial(XREF_GHOST_COLOR, XREF_GHOST_OPACITY);
1319
+ xrefGhostMat.opacity = XREF_GHOST_OPACITY;
1320
+ xrefGhostRef = refId;
1321
+ }
1322
+ // COUNTED PER CALL, NOT CUMULATIVELY, and both halves are returned. `xrefGhostById.size` is a running
1323
+ // total, so a caller reading it could not tell "I drew nothing" from "I drew nothing NEW" — and the
1324
+ // two skips below are silent by construction: an object whose tessellation came back empty, and one
1325
+ // with no `globalId` (which gets a mesh but can never be framed, because framing is by id). The
1326
+ // caller reconciles this against what it asked for, so a shortfall is stated rather than looking
1327
+ // like a smaller deletion. (Review.)
1328
+ let drawn = 0, skipped = 0;
1329
+ for (const o of objects) {
1330
+ if (!o || !Array.isArray(o.positions) || !o.positions.length) { skipped++; continue; }
1331
+ const gid = (o && typeof o.globalId === 'string' && o.globalId) ? o.globalId : null;
1332
+ if (!gid) { skipped++; continue; } // unframeable and uncountable — drawing it would be a shape nothing can reach
1333
+ // ALREADY DRAWN IS NOT DRAWN AGAIN. The panel can legitimately ask for a row twice — scroll away and
1334
+ // back — and a second mesh at the same coordinates doubles the fill and leaves the first unreachable.
1335
+ if (xrefGhostById.has(gid)) continue;
1336
+ const g = new THREE.BufferGeometry();
1337
+ g.setAttribute('position', new THREE.Float32BufferAttribute(o.positions, 3));
1338
+ if (Array.isArray(o.indices) && o.indices.length) g.setIndex(o.indices);
1339
+ g.computeVertexNormals();
1340
+ const mesh = new THREE.Mesh(g, xrefGhostMat);
1341
+ // NOT PICKABLE EVEN IF SOMETHING EVER RAYCASTS THE WHOLE SCENE. The parenting above is what makes
1342
+ // this true today; this is the belt to that pair of braces, and it costs one field.
1343
+ mesh.raycast = () => {};
1344
+ mesh.userData.ghost = true;
1345
+ mesh.userData.globalId = gid;
1346
+ xrefGhostById.set(gid, mesh);
1347
+ xrefGhostGroup.add(mesh);
1348
+ drawn++;
1349
+ }
1350
+ return { drawn, skipped };
1351
+ }
1352
+
1353
+ /**
1354
+ * What the ghosts are ACTUALLY painted in, read off the material the renderer will use.
1355
+ *
1356
+ * The same reason `referenceProbe` exists: a screenshot cannot distinguish the authored colour from a
1357
+ * plausible one, and 30% alpha over a dark canvas makes every pale ink look alike. The rendered value is
1358
+ * the only thing entitled to answer "is this drawn in the `removed` chip's ink". `parent` is here because
1359
+ * the whole promise of this layer — never snappable, never in the Fit box — rests on WHERE the group is
1360
+ * parented, and that is otherwise unobservable from outside.
1361
+ */
1362
+ function referenceGhostPaint() {
1363
+ if (!xrefGhostGroup || !xrefGhostMat) return null;
1364
+ return {
1365
+ color: `#${xrefGhostMat.color.getHexString()}`,
1366
+ opacity: xrefGhostMat.opacity,
1367
+ meshes: xrefGhostGroup.children.length,
1368
+ /** 'scene' is correct; 'xref' would mean the ghosts had become snappable, pickable and framed. */
1369
+ parent: xrefGhostGroup.parent === scene ? 'scene' : xrefGhostGroup.parent === xrefGroup ? 'xref' : 'other',
1370
+ };
1371
+ }
1372
+
1373
+ /** Frame one ghost — what a click on a `removed` row asks for, since there is nothing to select. */
1374
+ function frameReferenceGhost(globalId) {
1375
+ const mesh = xrefGhostById.get(globalId);
1376
+ if (!mesh) return false;
1377
+ const box = new THREE.Box3().setFromObject(mesh);
1378
+ if (box.isEmpty()) return false;
1379
+ fitCamera(box);
1380
+ return true;
1381
+ }
1382
+
1383
+ /**
1384
+ * Remove every ghost and free what they hold. Idempotent — every terminal path in the panel calls it.
1385
+ *
1386
+ * The RESET IS IN `finally` for the reason the preview's is: a half-disposed group that stays referenced
1387
+ * is worse than a leak, because the next `setReferenceGhosts` would see a live group, skip its init, and
1388
+ * append a new reference's deletions into the old one's placement matrix.
1389
+ */
1390
+ function clearReferenceGhosts() {
1391
+ if (!xrefGhostGroup) { xrefGhostById.clear(); xrefGhostRef = null; return; }
1392
+ try {
1393
+ xrefGhostGroup.traverse((o) => { o.geometry?.dispose?.(); });
1394
+ scene?.remove(xrefGhostGroup);
1395
+ xrefGhostMat?.dispose?.();
1396
+ } finally {
1397
+ xrefGhostGroup = null;
1398
+ xrefGhostMat = null;
1399
+ xrefGhostRef = null;
1400
+ xrefGhostById.clear();
1401
+ }
1402
+ }
1403
+
1257
1404
  /** Unique world points for snapping, quantised so a tessellated corner is one target and not thirty. */
1258
1405
  function xrefSnapPoints(objects) {
1259
1406
  const seen = new Set(); const out = [];
@@ -1688,6 +1835,19 @@ function setReferencePlacement(id, placement) {
1688
1835
  entry.group.position.set(0, 0, 0); entry.group.quaternion.identity(); entry.group.scale.set(1, 1, 1);
1689
1836
  entry.group.applyMatrix4(xrefMatrix(placement));
1690
1837
  entry.group.updateMatrixWorld(true);
1838
+ // THE GHOSTS MOVE WITH THE REFERENCE THEY BELONG TO. Their group takes the same matrix at creation
1839
+ // and would otherwise keep it forever — so Scale, "move it next to your model", or the heuristic's
1840
+ // fix button would leave red shapes standing at coordinates the removed objects never occupied,
1841
+ // which is precisely the "geometry asserting something nothing says" the ghost layer's own header
1842
+ // argues against. Newly REACHABLE because the change list is deliberately non-modal: the panel
1843
+ // floats over a live canvas, so a placement can change while ghosts are on screen. Batches that
1844
+ // arrive afterwards then land in the corrected matrix too, so one layer cannot hold two placements.
1845
+ if (xrefGhostGroup && xrefGhostRef === id) {
1846
+ xrefGhostGroup.matrix.identity();
1847
+ xrefGhostGroup.position.set(0, 0, 0); xrefGhostGroup.quaternion.identity(); xrefGhostGroup.scale.set(1, 1, 1);
1848
+ xrefGhostGroup.applyMatrix4(xrefMatrix(placement));
1849
+ xrefGhostGroup.updateMatrixWorld(true);
1850
+ }
1691
1851
  invalidateClipFloor(); // this reference just MOVED, so any floor measured from where it used to be is now wrong
1692
1852
  if (refMeasure3d && refMeasure3d.refId === id) {
1693
1853
  // The cache holds points BAKED through the old matrix, so every one of them now points at where
@@ -1977,6 +2137,28 @@ function frameReference(id) {
1977
2137
  return true;
1978
2138
  }
1979
2139
 
2140
+ /**
2141
+ * Frame ONE object inside a reference (#734, the change list's row click).
2142
+ *
2143
+ * `selectReferenceObject` lights an object; it does not move the camera, which is right for Ctrl+click —
2144
+ * you are already looking at the thing you clicked. It is wrong for a row in a list: "56 changed" is a
2145
+ * list of objects the user has NOT found yet, and highlighting one somewhere off-screen answers nothing.
2146
+ *
2147
+ * SEPARATE FROM THE SELECTION rather than folded into it, so the canvas gesture keeps its behaviour
2148
+ * exactly: two callers, two questions, and the panel is the only one that asks the camera to move.
2149
+ * Returns false when the index does not name a mesh — the same refusal, for the same reason, as
2150
+ * `selectReferenceObject`: quietly framing something else is worse than not moving.
2151
+ */
2152
+ function frameReferenceObject(refId, index) {
2153
+ const entry = xrefById.get(refId);
2154
+ const mesh = entry && Number.isInteger(index) && index >= 0 ? entry.group.children[index] : null;
2155
+ if (!mesh || !mesh.isMesh) return false;
2156
+ const box = new THREE.Box3().setFromObject(mesh);
2157
+ if (box.isEmpty()) return false;
2158
+ fitCamera(box);
2159
+ return true;
2160
+ }
2161
+
1980
2162
  /**
1981
2163
  * The reference snap candidates for a drag, in the shape `snapPoint` consumes.
1982
2164
  *
@@ -3605,7 +3787,11 @@ function panView(dx, dy) { // dx/dy in "steps" along the camera's screen right/u
3605
3787
  const ARROWS = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, 1], ArrowDown: [0, -1] };
3606
3788
  const VIEW_KEYS = { t: 'top', f: 'front', r: 'right', b: 'back', l: 'left' }; // single-key ortho views, mirrors the ViewCube + AWARE viewer-3d
3607
3789
  function onKey(e) {
3608
- if (!renderer || !canvasEl || canvasEl.style.display === 'none') return; // only when 3D is active
3790
+ // NOT "is the canvas visible" — that predicate was written when 2D and 3D were mutually exclusive,
3791
+ // where visible and active were the same fact. In a split both canvases are on screen at once, and a
3792
+ // visibility test would let an arrow key orbit the model while the user is dimensioning the plan, and
3793
+ // let Escape in the 2D pane cancel an in-flight clip-handle drag in here. The editor owns the answer.
3794
+ if (!renderer || !canvasEl || canvasEl.style.display === 'none' || !inputActive) return;
3609
3795
  const ae = document.activeElement; if (ae && /^(INPUT|SELECT|TEXTAREA)$/.test(ae.tagName)) return;
3610
3796
  // Esc mid-drag-out → nothing is sent, even if the pointer is then released over Tekla: ending the
3611
3797
  // gesture here leaves the release with no drag to complete. (A native HTML5 drag never delivered
@@ -6369,6 +6555,9 @@ function hide() {
6369
6555
  endTeklaDrag(); // and a live drag-out to Tekla — a stranded one would leave its badge on screen and swallow every later pointer move
6370
6556
  if (canvasEl) canvasEl.style.display = 'none'; if (hoverChipShell) hoverChipShell.style.display = 'none'; else if (hoverChip) hoverChip.style.display = 'none'; if (rafId) { cancelAnimationFrame(rafId); rafId = null; }
6371
6557
  }
6558
+ // The editor's active-pane state, pushed in. Defaults true so every existing caller — and vector-3d.html,
6559
+ // which has no split and never calls this — keeps today's behaviour with no change.
6560
+ function setInputActive(on) { inputActive = on !== false; }
6372
6561
  function isReady() { return built; }
6373
6562
 
6374
6563
  function dispose() {
@@ -6420,6 +6609,9 @@ function dispose() {
6420
6609
  // The reference layer owns real GPU buffers — a whole tessellated building's worth. Leaving them
6421
6610
  // attached to a torn-down scene is the kind of leak that only shows up after the fifth 2D↔3D switch.
6422
6611
  if (xrefGroup) { disposeReferenceMaterials(); xrefGroup.traverse((o) => { o.geometry?.dispose?.(); }); if (scene) scene.remove(xrefGroup); }
6612
+ // The ghost layer owns real buffers too, and it is a SIBLING of that group rather than a child — which
6613
+ // is the whole point of it, and also the reason the sweep above cannot reach it.
6614
+ clearReferenceGhosts();
6423
6615
  xrefGroup = null; xrefById.clear(); xrefSelected = null;
6424
6616
  xrefSubSelected = null; xrefSubMesh = null; xrefSubMats = null;
6425
6617
  clearStructGrid();
@@ -6563,7 +6755,7 @@ function gridSegmentsScreen() {
6563
6755
  }
6564
6756
  function gridBubblesScreen(){if(!gridLabelGroup)return [];const rect=canvasEl.getBoundingClientRect();return gridLabelGroup.children.filter(s=>s.visible&&s.userData.gridId).map(s=>{const p=s.getWorldPosition(new THREE.Vector3()).project(camera);return {id:s.userData.gridId,x:rect.left+(p.x*.5+.5)*rect.width,y:rect.top+(-p.y*.5+.5)*rect.height};});}
6565
6757
  window.Steel3DView = {
6566
- init, show, hide, rebuild, setSelection, setGridSelection, isReady, dispose,
6758
+ init, show, hide, setInputActive, rebuild, setSelection, setGridSelection, isReady, dispose,
6567
6759
  setProjection, projection, setDisplayMode, mode: () => displayMode, frameAll, frameSelection, applyView,
6568
6760
  setRefLine, refLine: () => refLineOn,
6569
6761
  setInsertMode, insertMode: insertModeOn, // arm/query the detail-placement pick (Slice 4)
@@ -6584,6 +6776,16 @@ window.Steel3DView = {
6584
6776
  // Stage A: drilling into ONE object inside a reference. `selectReferenceObject` is what Ctrl+click and
6585
6777
  // (later) an object-tree row both call, so the two routes cannot drift into different selections.
6586
6778
  selectReferenceObject, selectedReferenceObject,
6779
+ // …and framing one, which the change list's rows need and Ctrl+click deliberately does not do.
6780
+ frameReferenceObject,
6781
+ // The GHOST layer (#734): where removed objects used to be. A third sibling group, outside `xrefById`
6782
+ // and outside `xrefGroup`, which is what makes "never snappable, never in the Fit box" structural.
6783
+ // `referenceGhostCount` and `referenceGhostIds` are test probes — a function having been called is not
6784
+ // evidence that anything was drawn, and the E2E has to be able to assert both halves of that promise.
6785
+ setReferenceGhosts, clearReferenceGhosts, frameReferenceGhost,
6786
+ referenceGhostCount: () => xrefGhostById.size,
6787
+ referenceGhostIds: () => [...xrefGhostById.keys()],
6788
+ referenceGhostPaint,
6587
6789
  // Stage D: the two-point measure. `armRefMeasure3d(id)` arms it, `armRefMeasure3d(null)` disarms;
6588
6790
  // `clearRefMeasure3d()` drops the kept segment. The three probes below are what the E2E asserts against,
6589
6791
  // because "a function was called" is not evidence that anything was drawn.