@floless/app 0.130.0 → 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.
- package/dist/floless-server.cjs +1422 -867
- package/dist/schemas/steel.model.v2.schema.json +28 -8
- package/dist/web/reference-changes.js +224 -0
- package/dist/web/reference-session.js +141 -0
- package/dist/web/steel-3d-view.js +533 -35
- package/dist/web/steel-editor.html +2124 -209
- package/dist/web/steel-split-view.js +169 -0
- package/package.json +1 -1
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
#m3dLegendCollapse/#m3dLegendLauncher hang off the pinned-dark legend, so they are in; #panelToggle
|
|
120
120
|
hangs off the light inspector rail, so it is out — each reads as part of the thing it opens, even
|
|
121
121
|
though both straddle the same seam. */
|
|
122
|
-
[data-theme="light"] #stage,[data-theme="light"] #stage3d,[data-theme="light"] #
|
|
122
|
+
[data-theme="light"] #stage,[data-theme="light"] #stage3d,[data-theme="light"] #pane2d,[data-theme="light"] #pane3d,
|
|
123
123
|
[data-theme="light"] #zoombar,[data-theme="light"] #connCrumb,[data-theme="light"] #bottomDock,
|
|
124
124
|
[data-theme="light"] #selFly,[data-theme="light"] #m3dBar,[data-theme="light"] #m3dLegend,
|
|
125
125
|
[data-theme="light"] #m3dLegendCollapse,[data-theme="light"] #m3dLegendLauncher,
|
|
@@ -202,15 +202,46 @@
|
|
|
202
202
|
#roRibbon{display:none;align-items:center;gap:8px;padding:7px 14px;background:var(--panel);border-bottom:1px solid var(--line);color:var(--mut);font-size:12px}
|
|
203
203
|
body.model-ro #roRibbon{display:flex}
|
|
204
204
|
#roRibbon b{color:var(--text);font-weight:600}
|
|
205
|
-
/* The 2D empty state. SCOPED to #stage — deliberately not showEmpty(), which does
|
|
206
|
-
document.body.replaceChildren and would blank the header and the Grid panel with it. */
|
|
207
|
-
#ro2d{position:absolute;inset:0;display:none;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:24px;text-align:center;color:var(--mut);pointer-events:none}
|
|
208
|
-
body.model-ro:not(.v3d) #ro2d{display:flex}
|
|
209
|
-
#ro2d b{color:var(--text);font-size:14px}
|
|
210
|
-
#ro2d p{margin:0;max-width:44ch;line-height:1.5}
|
|
211
205
|
main{flex:1;display:flex;min-width:0;min-height:0;width:100%;max-width:100%;overflow:hidden;position:relative}
|
|
212
|
-
|
|
206
|
+
/* THE STAGE IS TWO PANES AND A DIVIDER (F10a). Each canvas gets its own positioning context, so its
|
|
207
|
+
floating chrome is laid out against the pane it belongs to rather than against the whole stage —
|
|
208
|
+
which is what a split needs, and is a no-op while only one pane is ever on screen.
|
|
209
|
+
--split-divider is the ONE definition of the divider's width. The JS reads it back via
|
|
210
|
+
getComputedStyle rather than repeating the number, because clampRatio's denominator
|
|
211
|
+
(stageWidth - divider) has to be the same quantity this calc() subtracts — two 7s that drift
|
|
212
|
+
apart would put the panes and their minimum-width rule quietly out of step. */
|
|
213
|
+
#stagewrap{flex:1;position:relative;min-width:0;display:flex;--split-ratio:.5;--split-divider:7px}
|
|
214
|
+
/* THE PANES MUST STAY position:relative WITH NO z-index (and no opacity<1, transform or filter).
|
|
215
|
+
That is what keeps them from establishing a stacking context, so the chrome inside them still
|
|
216
|
+
competes in the ROOT context against #bottomDock (z:8) and #selFly — which stay on #stagewrap
|
|
217
|
+
precisely because they address both canvases. Give a pane a z-index for a drag affordance and
|
|
218
|
+
every one of those numbers silently re-shuffles. */
|
|
219
|
+
#pane2d{position:relative;min-width:0;flex:1 1 auto;display:flex}
|
|
220
|
+
#pane3d{position:relative;min-width:0;flex:1 1 auto;display:none}
|
|
221
|
+
body.split-view #pane2d{flex:0 0 calc((100% - var(--split-divider)) * var(--split-ratio))}
|
|
222
|
+
body.split-view #pane3d{flex:0 0 calc((100% - var(--split-divider)) * (1 - var(--split-ratio)))}
|
|
213
223
|
#stage{flex:1;overflow:auto;background:#0b1220;display:flex;align-items:safe center;justify-content:safe center}
|
|
224
|
+
/* position:absolute;inset:0 is load-bearing, not tidy-uppable: the 3D engine sizes itself from
|
|
225
|
+
canvasEl.parentElement and ResizeObserves it (steel-3d-view.js), so the canvas fills #pane3d and
|
|
226
|
+
follows it without the engine knowing panes exist. */
|
|
227
|
+
#stage3d{position:absolute;inset:0;width:100%;height:100%;display:none;outline:none}
|
|
228
|
+
/* The divider reuses #panelResizer's recipe verbatim — same width, same inset hairline, same brand
|
|
229
|
+
hover — so the stage's two seams read as one control language. Hidden until Split is entered. */
|
|
230
|
+
#splitBar{flex:none;width:var(--split-divider);cursor:col-resize;background:transparent;position:relative;z-index:6;touch-action:none;align-self:stretch;display:none}
|
|
231
|
+
/* A RESTING hairline, unlike #panelResizer's fully transparent one, and the difference is load-bearing:
|
|
232
|
+
that seam sits against `aside`'s real border-left, so something always marks it. These two panes carry
|
|
233
|
+
no border at all, so a transparent divider between two dark canvases leaves nothing on screen saying
|
|
234
|
+
a drag boundary exists — the whole point of split mode. Same var(--line) the aside seam uses; brand
|
|
235
|
+
only on interaction, so it still reads as a handle rather than as "selected". (UX review.) */
|
|
236
|
+
#splitBar::before{content:"";position:absolute;inset:0 3px;border-radius:2px;background:var(--line);transition:background-color .12s}
|
|
237
|
+
#splitBar:hover::before,#splitBar.drag::before{background:var(--brand)}
|
|
238
|
+
#splitBar:focus-visible{outline:none}
|
|
239
|
+
#splitBar:focus-visible::before{background:var(--brand)}
|
|
240
|
+
body.split-view #splitBar{display:block}
|
|
241
|
+
/* Which pane owns the tools. Only ever shown in split — in a single mode there is nothing to
|
|
242
|
+
disambiguate. Reuses the selected-row recipe (.lsel/.selrow/.refobjrow.sel) verbatim: same token,
|
|
243
|
+
same inset bar, so no new colour enters the baseline. */
|
|
244
|
+
body.split-view #pane2d.pane-active::after,body.split-view #pane3d.pane-active::after{content:"";position:absolute;inset:0;pointer-events:none;box-shadow:inset 0 0 0 2px var(--brand);border-radius:2px;z-index:7}
|
|
214
245
|
svg{display:block;touch-action:none;flex:none}
|
|
215
246
|
#zoombar{position:absolute;left:12px;bottom:12px;display:flex;align-items:center;gap:8px;background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:6px 10px;box-shadow:0 4px 14px rgba(0,0,0,.45);z-index:5}
|
|
216
247
|
#zoombar button{padding:1px 9px;font-size:15px}
|
|
@@ -568,12 +599,26 @@
|
|
|
568
599
|
#moreMenu .msnap-sub input{width:92px;height:24px;background:var(--bg);color:var(--text);border:1px solid var(--line);border-radius:5px;padding:0 7px;font:12px system-ui;box-sizing:border-box}
|
|
569
600
|
#moreMenu .msnap-sub input:focus{outline:none;border-color:var(--brand)}
|
|
570
601
|
#moreMenu .msnap-sub .oghint{flex-basis:100%;color:var(--mut);font-size:11px;line-height:1.4;margin-top:2px} /* nudge shown only when the grid is on but no local frame is set yet */
|
|
602
|
+
/* A settings row under a Display toggle — label, slider, readout. Deliberately NOT .msnap-sub: that one
|
|
603
|
+
is hidden unless its parent toggle is on AND the view is 3D, and grid label size applies always, in
|
|
604
|
+
both views. The slider itself is themed by the global input[type=range] rule; only sizing lives here. */
|
|
605
|
+
/* WRAPPED, label on its own line. The menu is 210px wide and this row is indented 26px with 12px of
|
|
606
|
+
right padding, so it has ~172px to work in — while "Grid label size" + a slider + a readout on ONE
|
|
607
|
+
line needs ~227px. Laid out flat, the readout was pushed past the panel's own right edge and (in 3D
|
|
608
|
+
at a 1600px window) off the screen with it: the DOM value was right, so it read correct to a probe,
|
|
609
|
+
while the user saw "2" of "26 px". */
|
|
610
|
+
#moreMenu .mrow{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;padding:2px 12px 8px 26px;max-width:100%;box-sizing:border-box}
|
|
611
|
+
#moreMenu .mrow .mlbl{color:var(--mut);font-size:11px;flex:0 0 100%}
|
|
612
|
+
#moreMenu .mrow input[type=range]{flex:1 1 60px;min-width:0}
|
|
613
|
+
#moreMenu .mrow .mval{color:var(--mut);font-size:11px;flex:none;min-width:38px;text-align:right;font-variant-numeric:tabular-nums}
|
|
571
614
|
/* Pointer-behaviour bars, bottom-right of the canvas (both views): [ Select filter ] [ Snap ]. Both reuse the brand-fill "on" toolbar language. */
|
|
572
615
|
/* One bottom dock owns both sides of the canvas chrome. The hint may shrink; Select/Snap never do, so
|
|
573
616
|
the two surfaces cannot overlap at narrower widths. In 3D the whole dock stops before the world-axis
|
|
574
617
|
triad, preserving the old 104px clearance without independently-positioned bars. */
|
|
575
618
|
#bottomDock{position:absolute;left:12px;right:12px;bottom:12px;z-index:8;display:flex;align-items:flex-end;gap:8px;min-width:0;pointer-events:none}
|
|
576
|
-
|
|
619
|
+
/* Clearance for the world-axis TRIAD, which is drawn whenever the 3D pane is on screen — so this keys
|
|
620
|
+
off pane visibility, not off which pane owns the tools. */
|
|
621
|
+
body.pane3d-shown #bottomDock{right:104px}
|
|
577
622
|
#bottomDockLeft{display:flex;align-items:center;gap:8px;flex:1;min-width:0;pointer-events:none}
|
|
578
623
|
#ptrBars{position:static;z-index:auto;display:flex;align-items:flex-end;gap:8px;flex:none;pointer-events:auto}
|
|
579
624
|
#canvasStatus{display:none;align-items:center;gap:0;flex:1;min-width:0;pointer-events:auto}
|
|
@@ -997,12 +1042,26 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
997
1042
|
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
|
|
998
1043
|
/* 2D|3D view toggle — segmented, far-left; active segment filled (--panel) with a --brand underline */
|
|
999
1044
|
#viewToggle{display:inline-flex;border:1px solid var(--line);border-radius:6px;overflow:hidden;flex:none}
|
|
1045
|
+
/* The anchor for #vtSplitWhy below. It cannot hang off #viewToggle itself: that carries overflow:hidden
|
|
1046
|
+
to clip its segments' corners, which would also clip the reason chip out of existence. */
|
|
1047
|
+
#viewToggleWrap{position:relative;display:inline-flex;flex:none}
|
|
1048
|
+
/* The too-narrow reason, ANCHORED to the toggle and out of header flow. Inline it reflowed every stat
|
|
1049
|
+
chip after it and pushed the header between one and two rows the moment the window crossed the
|
|
1050
|
+
threshold — a layout jump caused by the very resize it is describing. Reuses the floating-chip recipe
|
|
1051
|
+
(--panel/--line/--shadow-float), so no new visual vocabulary. The span stays in the DOM permanently
|
|
1052
|
+
and only its text changes: several screen readers only announce mutations of an aria-live element
|
|
1053
|
+
that already existed. (UX review.) */
|
|
1054
|
+
#vtSplitWhy{position:absolute;top:calc(100% + 6px);left:0;z-index:9;white-space:nowrap;background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:6px 10px;box-shadow:var(--shadow-float)}
|
|
1055
|
+
#vtSplitWhy[hidden]{display:none}
|
|
1000
1056
|
#viewToggle .seg{padding:5px 11px;margin:0;border:0;border-radius:0;background:transparent;color:var(--mut);font:600 12px system-ui;cursor:pointer}
|
|
1001
1057
|
#viewToggle .seg+.seg{border-left:1px solid var(--line)}
|
|
1002
|
-
#viewToggle .seg:hover{color:var(--text)}
|
|
1058
|
+
#viewToggle .seg:hover:not(:disabled){color:var(--text)}
|
|
1059
|
+
/* The segment's own `cursor:pointer` outranks the global button:disabled rule by specificity, so a
|
|
1060
|
+
disabled Split still brightened on hover and offered a pointer — a dead control advertising itself
|
|
1061
|
+
as live. Its transparent background is already correct (the ID selector wins there too, which is
|
|
1062
|
+
why no background override is needed here). (Code review.) */
|
|
1063
|
+
#viewToggle .seg:disabled{cursor:default}
|
|
1003
1064
|
#viewToggle .seg.on{background:var(--panel);color:var(--text);box-shadow:inset 0 -2px 0 var(--brand)}
|
|
1004
|
-
#stagewrap{position:relative}
|
|
1005
|
-
#stage3d{position:absolute;inset:0;width:100%;height:100%;display:none;outline:none}
|
|
1006
1065
|
/* yellow = START (end 1), magenta = END (end 2) — also the drag handles. Same colours in 3D. */
|
|
1007
1066
|
circle.handle.ep-start{fill:#facc15;stroke:#0b1220;stroke-width:2}
|
|
1008
1067
|
circle.handle.ep-end{fill:#f472b6;stroke:#0b1220;stroke-width:2}
|
|
@@ -1276,10 +1335,10 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1276
1335
|
(unchecked box, :checked, indeterminate, :focus-visible, forced-colors). */
|
|
1277
1336
|
#riPickToggle{margin-top:10px}
|
|
1278
1337
|
#refImportModal .reftree{max-height:168px;overflow:auto;border:1px solid var(--line);border-radius:7px;background:var(--bg);padding:3px 2px;margin-bottom:8px}
|
|
1279
|
-
#refImportModal .ripick-row{display:flex;align-items:center;gap:6px;padding:2px 4px;border-radius:5px;font-size:11.5px;color:var(--text);cursor:pointer;user-select:none}
|
|
1280
|
-
#refImportModal .ripick-row:hover{background:var(--hover-soft)}
|
|
1281
|
-
#refImportModal .ripick-row .rpname{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
|
|
1282
|
-
#refImportModal .ripick-row .rpcount{flex:none;color:var(--mut);font-variant-numeric:tabular-nums;font-size:10px}
|
|
1338
|
+
#refImportModal .ripick-row,#refVersionModal .ripick-row{display:flex;align-items:center;gap:6px;padding:2px 4px;border-radius:5px;font-size:11.5px;color:var(--text);cursor:pointer;user-select:none}
|
|
1339
|
+
#refImportModal .ripick-row:hover,#refVersionModal .ripick-row:hover{background:var(--hover-soft)}
|
|
1340
|
+
#refImportModal .ripick-row .rpname,#refVersionModal .ripick-row .rpname{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
|
|
1341
|
+
#refImportModal .ripick-row .rpcount,#refVersionModal .ripick-row .rpcount{flex:none;color:var(--mut);font-variant-numeric:tabular-nums;font-size:10px}
|
|
1283
1342
|
/* The storey-less row. NOT a disabled checkbox — a disabled control says "you may not do this yet",
|
|
1284
1343
|
and the truth is that the reader cannot express it at all, so there is no control to disable. */
|
|
1285
1344
|
#refImportModal .ripick-row--fixed{cursor:default}
|
|
@@ -1298,6 +1357,122 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1298
1357
|
#riFootNote{display:none;flex:1;align-self:center;font-size:11px;line-height:1.4;text-align:left}
|
|
1299
1358
|
#riFootNote.warn{color:var(--warn)} #riFootNote.refuse{color:var(--err)}
|
|
1300
1359
|
#riInsert[disabled]{opacity:.5;cursor:not-allowed}
|
|
1360
|
+
/* ── The new-version modal (#refVersionModal) and its change list (#734, design §7.3) — #refImportModal's
|
|
1361
|
+
recipe under its own ids, a sibling for the reason that modal gives for not being a stage of
|
|
1362
|
+
#connImportModal: its last screen is "confirm the one thing you are about to add", and this one's is
|
|
1363
|
+
"here is what changed between two versions of it", which is a different question wearing the same
|
|
1364
|
+
clothes. The upload stages ARE the same question, so they wear the same chrome.
|
|
1365
|
+
|
|
1366
|
+
ONE SCROLL CONTAINER — `.rvbody` — owns the whole panel (design pass, decision K). Nothing below opens
|
|
1367
|
+
a second SCROLLPORT: a nested one is both where a native bar leaks in and a worse interaction. (The
|
|
1368
|
+
remedy picker's `.rfpick .reftree` does name both properties, to NEUTRALISE the import picker's
|
|
1369
|
+
bounded-scroll recipe it inherits — `max-height:none;overflow:visible` opens nothing.) `.rvbody` carries no padding of its own so the sticky header can sit at `top:0`
|
|
1370
|
+
without a strip of content scrolling behind it; each stage pads itself instead.
|
|
1371
|
+
|
|
1372
|
+
NO SCROLLBAR CSS IS NEEDED — the page's global `*{scrollbar-width…}` and `*::-webkit-scrollbar*` rules
|
|
1373
|
+
(line 179) already reach any container added here, the same reason the import picker declares none
|
|
1374
|
+
(:1273). `npm run verify:scrollbars` is what proves that rather than the eye.
|
|
1375
|
+
|
|
1376
|
+
NO NEW COLOUR AND NO NEW FONT. Every value below is a `:root` token from this page. The `changedBy`
|
|
1377
|
+
chips are deliberately NOT monospace even though the design pass suggested it: this surface
|
|
1378
|
+
establishes no monospace family and `--mono` does not exist here; `showEmpty`'s own doc records why
|
|
1379
|
+
introducing one would be a new font against the locked baseline ("Deliberately NOT monospace: no
|
|
1380
|
+
monospace family is established on this surface"). Size, fill and ink de-emphasise them just as well. ── */
|
|
1381
|
+
#refVersionModal{display:none;position:fixed;inset:0;z-index:60;align-items:center;justify-content:center}
|
|
1382
|
+
#refVersionModal .mbackdrop{position:absolute;inset:0;background:var(--backdrop)}
|
|
1383
|
+
#refVersionModal .rvpanel{position:relative;width:min(760px,94vw);max-height:88vh;display:flex;flex-direction:column;background:var(--panel);border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow-modal)}
|
|
1384
|
+
#refVersionModal .mhead{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 14px;border-bottom:1px solid var(--line)}
|
|
1385
|
+
#refVersionModal .rvbody{overflow:auto;min-height:0}
|
|
1386
|
+
/* ── THE ANSWER IS NOT A DIALOG. The upload stages are a transaction and hold the screen like one; the
|
|
1387
|
+
change list is something you READ WHILE LOOKING AT THE MODEL. Every row says "click to fly there",
|
|
1388
|
+
a removed row draws its ghost on the canvas, and a scrim over that canvas makes both unusable —
|
|
1389
|
+
found in the real browser pass, where the backdrop swallowed the Fit button while ghosts were on
|
|
1390
|
+
screen behind it. So on the result stage the scrim goes inert and invisible and the panel becomes a
|
|
1391
|
+
floating pane: the canvas orbits, zooms and shows what a click just flew to.
|
|
1392
|
+
`pointer-events` on the CONTAINER, not only the backdrop — `#refVersionModal` is itself a
|
|
1393
|
+
full-viewport flex box, so it intercepts everything outside the panel whatever the scrim does. ── */
|
|
1394
|
+
#refVersionModal.rvfloat{pointer-events:none}
|
|
1395
|
+
#refVersionModal.rvfloat .mbackdrop{background:transparent}
|
|
1396
|
+
#refVersionModal.rvfloat .rvpanel{pointer-events:auto}
|
|
1397
|
+
#refVersionModal .rvfoot{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:10px 14px;border-top:1px solid var(--line)}
|
|
1398
|
+
#refVersionModal .rvfoot .rvnote{flex:1;min-width:0;color:var(--mut);font-size:11px;line-height:1.4;text-align:left}
|
|
1399
|
+
#rvDropStage,#rvProgStage,#rvRefuseStage{padding:14px}
|
|
1400
|
+
/* THREE WEIGHTS, NO NEW COLOUR (decision H): --brand for the primary, this page's default button for the
|
|
1401
|
+
secondary, and the existing `.ghost` for the quietest. Deliberately NOT `class=primary`, which #riInsert
|
|
1402
|
+
carries and which has no rule anywhere in this file — a weight that exists only in the markup is the
|
|
1403
|
+
same class of thing as the colour at :1294 that was authored and never rendered. */
|
|
1404
|
+
#refVersionModal button.rvprimary{background:var(--brand);border-color:var(--brand);color:var(--brand-ink)}
|
|
1405
|
+
#refVersionModal button.rvprimary:hover{background:var(--brand-hover);border-color:var(--brand-hover)}
|
|
1406
|
+
#rvSubject{color:var(--mut);font-size:12px;line-height:1.55;margin-bottom:10px}
|
|
1407
|
+
#rvSubject b{color:var(--text);font-weight:600}
|
|
1408
|
+
#rvDrop{border:1px dashed var(--ctrl-border);border-radius:8px;padding:26px 14px;text-align:center;color:var(--mut);font-size:12px;line-height:1.6;cursor:pointer}
|
|
1409
|
+
#rvDrop:hover,#rvDrop.drag{border-color:var(--brand);color:var(--text);background:var(--brand-wash-faint)}
|
|
1410
|
+
#rvDropErr{display:none;margin-top:8px;color:var(--err);font-size:11.5px;line-height:1.5}
|
|
1411
|
+
/* ── The refusal, and every other named refusal code, in the NEUTRAL tokens (decision H). Not `--err`
|
|
1412
|
+
red: "these two files do not relate" is a complete, correct answer about somebody else's export, not
|
|
1413
|
+
a failure of ours, and alarm colour would say otherwise. ── */
|
|
1414
|
+
#rvRefuseStage .rflead{color:var(--text);font-size:13px;line-height:1.6;margin-bottom:8px}
|
|
1415
|
+
#rvRefuseStage .rfwhy{color:var(--mut);font-size:12px;line-height:1.6}
|
|
1416
|
+
#rvRefuseStage .rflist{color:var(--mut);font-size:11.5px;line-height:1.6;margin:8px 0 0;padding-left:18px}
|
|
1417
|
+
#rvRefuseStage .rfacts{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;margin-top:14px}
|
|
1418
|
+
#rvRefuseStage .rfpick{margin-top:12px;border-top:1px solid var(--line);padding-top:10px}
|
|
1419
|
+
#rvRefuseStage .rfpick .reftree{max-height:none;overflow:visible;border:1px solid var(--line);border-radius:7px;background:var(--bg);padding:3px 2px;margin-bottom:8px}
|
|
1420
|
+
/* ── The change list ── */
|
|
1421
|
+
#rvResultStage .rcregion{padding:0 14px}
|
|
1422
|
+
#rcHead{position:sticky;top:0;z-index:1;background:var(--panel);padding:12px 14px 10px;border-bottom:1px solid var(--line)}
|
|
1423
|
+
#rcHead .rcsubject{color:var(--mut);font-size:12px;line-height:1.5;margin-bottom:8px}
|
|
1424
|
+
#rcHead .rcsubject b{color:var(--text);font-weight:600}
|
|
1425
|
+
#rcStats{display:flex;flex-wrap:wrap;gap:6px}
|
|
1426
|
+
/* Every count is a chip of equal weight, never a sentence: rendered as prose "12,806 unchanged" is the
|
|
1427
|
+
widest and loudest span on the line purely because it has five digits (decision G). */
|
|
1428
|
+
#refVersionModal .rcstat{display:inline-flex;align-items:baseline;gap:5px;padding:3px 8px;border-radius:6px;border:1px solid transparent;font-size:11.5px;line-height:1.4}
|
|
1429
|
+
#refVersionModal .rcstat .rcn{font-variant-numeric:tabular-nums;font-weight:600}
|
|
1430
|
+
#refVersionModal .rcstat .rcg{font-weight:700}
|
|
1431
|
+
#refVersionModal .rc-chip{display:inline-flex;align-items:center;gap:4px;flex:none;padding:1px 6px;border-radius:5px;border:1px solid transparent;font-size:10.5px;line-height:1.6}
|
|
1432
|
+
/* THE FOUR STATUS TREATMENTS, shared by the header chips and the row badges so the two cannot drift.
|
|
1433
|
+
Each carries a glyph and a word in the DOM as well as a colour (decision B) — colour alone is not an
|
|
1434
|
+
encoding. `uncomparable` is DASHED and unfilled rather than a second amber fill: shape survives losing
|
|
1435
|
+
colour entirely, and "we do not know" must not look like the asserted fact beside it.
|
|
1436
|
+
PLACED AFTER the two base rules above and at the SAME specificity, so source order is what decides —
|
|
1437
|
+
the trap at :1294 was a modifier that lost to a longer selector and never rendered. */
|
|
1438
|
+
#refVersionModal .rc-add{color:var(--ok);background:var(--ok-bg);border-color:var(--ok-edge)}
|
|
1439
|
+
#refVersionModal .rc-rem{color:var(--err);background:var(--err-bg);border-color:var(--err-edge)}
|
|
1440
|
+
#refVersionModal .rc-chg{color:var(--warn);background:var(--warn-bg);border-color:var(--warn-edge)}
|
|
1441
|
+
#refVersionModal .rc-unk{color:var(--warn);background:transparent;border-color:var(--warn-edge);border-style:dashed}
|
|
1442
|
+
#refVersionModal .rc-plain{color:var(--mut);background:transparent;border-color:transparent}
|
|
1443
|
+
/* The issue banners — a decision to make and a "we could not tell you everything" both pin near the top
|
|
1444
|
+
(decision A) rather than sitting under up to 12,000 rows. Amber, because both mean "needs review". */
|
|
1445
|
+
#rcIssues{padding:10px 14px 0}
|
|
1446
|
+
#rcIssues .rcban{display:flex;align-items:baseline;gap:8px;padding:7px 10px;border:1px solid var(--warn-edge);border-radius:7px;color:var(--warn);font-size:11.5px;line-height:1.55;margin-bottom:8px}
|
|
1447
|
+
/* …and the one banner that is NOT a problem. What the re-read could not carry over from your session is
|
|
1448
|
+
ordinary housekeeping after an act you asked for, so amber — which the rule above uses to mean "needs
|
|
1449
|
+
review" — would misreport it as a fault. Recedes exactly as `rc-plain` does one tier down, in the same
|
|
1450
|
+
two tokens. TWO classes beats the one above on specificity, which is the trap at :1294: a modifier
|
|
1451
|
+
that loses to a longer selector is authored, shipped, and never rendered. */
|
|
1452
|
+
#rcIssues .rcban.plain{border-color:var(--line);color:var(--mut)}
|
|
1453
|
+
#rcIssues .rcban .rcbantx{flex:1;min-width:0}
|
|
1454
|
+
#rcControls{display:flex;align-items:center;gap:8px;padding:10px 14px 6px}
|
|
1455
|
+
#rcSearch{flex:1;min-width:0;height:28px;background:var(--field);border:1px solid var(--ctrl-border);border-radius:6px;padding:0 8px;color:var(--text);font:12px system-ui;outline:none}
|
|
1456
|
+
#rcSearch:focus{border-color:var(--brand)}
|
|
1457
|
+
#rcSearch::placeholder{color:var(--mut)}
|
|
1458
|
+
#rcList .rcrow{display:flex;align-items:center;gap:7px;padding:3px 4px;border-radius:5px;cursor:pointer;user-select:none;white-space:nowrap;font-size:11.5px}
|
|
1459
|
+
#rcList .rcrow:hover{background:var(--hover-soft)}
|
|
1460
|
+
#rcList .rcrow:focus-visible{outline:1px solid var(--brand);outline-offset:-1px}
|
|
1461
|
+
#rcList .rcrow.sel{box-shadow:inset 2px 0 0 var(--brand);background:var(--brand-wash)}
|
|
1462
|
+
#rcList .rcnm{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;color:var(--text)}
|
|
1463
|
+
#rcList .rcby{display:inline-flex;gap:4px;flex:none}
|
|
1464
|
+
#rcList .rcby span{background:var(--sunken);border:1px solid var(--line);color:var(--mut);border-radius:4px;padding:0 5px;font-size:10px;line-height:1.7}
|
|
1465
|
+
#rcList .rcmv{flex:none;color:var(--mut);font-variant-numeric:tabular-nums;font-size:10.5px}
|
|
1466
|
+
/* The cap SAYS SO (decision D). A list that stops at 300 with no explanation reads as "that is all there
|
|
1467
|
+
was", which on a change list is the same class of lie as folding `uncomparable` into `unchanged`. */
|
|
1468
|
+
#rcList .rccap{color:var(--mut);font-size:10px;padding:4px 4px 4px 34px;line-height:1.45}
|
|
1469
|
+
#rcList .rcempty{color:var(--mut);font-size:11.5px;line-height:1.6;padding:14px 4px;text-align:center}
|
|
1470
|
+
#rcList .rcempty b{color:var(--text);display:block;font-size:13px;margin-bottom:4px}
|
|
1471
|
+
#rcUncomparable{padding:12px 14px 16px;margin-top:10px;border-top:1px solid var(--line)}
|
|
1472
|
+
#rcUncomparable h4{margin:0 0 6px;font-size:12px;color:var(--text);font-weight:600}
|
|
1473
|
+
#rcUncomparable .rcuwhy{color:var(--mut);font-size:11.5px;line-height:1.6}
|
|
1474
|
+
#rcUncomparable .rcurow{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:2px 0;font-size:11.5px;color:var(--mut)}
|
|
1475
|
+
#rcUncomparable .rcurow .rcuv{color:var(--text);font-variant-numeric:tabular-nums}
|
|
1301
1476
|
/* ── Favourites tab (#m3dFavBody) — the Views-tab row/search recipe. No create button (★ lives in the
|
|
1302
1477
|
Inspector); a kind-filter + search header, per-row kind swatch + portability badge + row-click-to-arm. ── */
|
|
1303
1478
|
#favHeadRow{display:flex;align-items:stretch;gap:6px;margin-bottom:6px;flex:none}
|
|
@@ -1362,8 +1537,8 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1362
1537
|
these are scoped to #m3dLegend, which is not an ancestor of #refImportModal. The picker is the
|
|
1363
1538
|
identical shape (a header standing for several rows, with a tri-state toggle), so it gets the
|
|
1364
1539
|
identical chrome rather than a second copy that drifts. */
|
|
1365
|
-
#m3dLegend .cat-hdr,#refImportModal .cat-hdr{display:flex;align-items:center;gap:6px;padding:3px 4px;border-radius:5px;cursor:pointer;user-select:none;white-space:nowrap}
|
|
1366
|
-
#m3dLegend .cat-hdr:hover,#refImportModal .cat-hdr:hover{background:#33415580}
|
|
1540
|
+
#m3dLegend .cat-hdr,#refImportModal .cat-hdr,#refVersionModal .cat-hdr{display:flex;align-items:center;gap:6px;padding:3px 4px;border-radius:5px;cursor:pointer;user-select:none;white-space:nowrap}
|
|
1541
|
+
#m3dLegend .cat-hdr:hover,#refImportModal .cat-hdr:hover,#refVersionModal .cat-hdr:hover{background:#33415580}
|
|
1367
1542
|
/* …but NOT in the import modal, where only the nested toggle acts. In #m3dLegend the whole header
|
|
1368
1543
|
collapses its group, so the pointer and the hover fill are honest there; borrowing them here would
|
|
1369
1544
|
promise a click that does nothing. Placed AFTER the rule it overrides — same specificity, so source
|
|
@@ -1373,17 +1548,17 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1373
1548
|
#refImportModal .cat-tog{cursor:pointer}
|
|
1374
1549
|
#m3dLegend .cat-hdr.empty .cat-label,#m3dLegend .cat-hdr.empty .cat-count{opacity:.55}
|
|
1375
1550
|
#m3dLegend .cat-hdr.drop-target{outline:1px solid var(--brand);background:rgba(59,130,246,.18)}
|
|
1376
|
-
#m3dLegend .cat-chevron{font-size:10px;color:var(--mut);width:12px;flex:none;text-align:center}
|
|
1377
|
-
#m3dLegend .cat-tog,#refImportModal .cat-tog{font-size:12px;width:14px;flex:none;cursor:pointer;line-height:1;text-align:center;background:none;border:0;padding:0}
|
|
1378
|
-
#m3dLegend .cat-tog[data-state=on],#refImportModal .cat-tog[data-state=on]{color:var(--brand)} #m3dLegend .cat-tog[data-state=off],#refImportModal .cat-tog[data-state=off]{color:var(--mut)} #m3dLegend .cat-tog[data-state=mixed],#refImportModal .cat-tog[data-state=mixed]{color:#64748b}
|
|
1551
|
+
#m3dLegend .cat-chevron,#refVersionModal .cat-chevron{font-size:10px;color:var(--mut);width:12px;flex:none;text-align:center}
|
|
1552
|
+
#m3dLegend .cat-tog,#refImportModal .cat-tog,#refVersionModal .cat-tog{font-size:12px;width:14px;flex:none;cursor:pointer;line-height:1;text-align:center;background:none;border:0;padding:0}
|
|
1553
|
+
#m3dLegend .cat-tog[data-state=on],#refImportModal .cat-tog[data-state=on],#refVersionModal .cat-tog[data-state=on]{color:var(--brand)} #m3dLegend .cat-tog[data-state=off],#refImportModal .cat-tog[data-state=off],#refVersionModal .cat-tog[data-state=off]{color:var(--mut)} #m3dLegend .cat-tog[data-state=mixed],#refImportModal .cat-tog[data-state=mixed],#refVersionModal .cat-tog[data-state=mixed]{color:#64748b}
|
|
1379
1554
|
/* `min-width:0` + ellipsis because a flex item that cannot shrink below its content OVERFLOWS the row
|
|
1380
1555
|
rather than truncating, and `.cat-hdr` is `white-space:nowrap`. The legend's own categories were
|
|
1381
1556
|
always short enough to hide this; the reference tree's disambiguated headers ("Wall · IFCWALL…")
|
|
1382
1557
|
are the first labels long enough to test it. Same recipe as `.refname` directly above. */
|
|
1383
|
-
#m3dLegend .cat-label,#refImportModal .cat-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;font-size:12px;color:var(--text)}
|
|
1384
|
-
#m3dLegend .cat-count,#refImportModal .cat-count{font-size:10px;color:var(--mut);font-variant-numeric:tabular-nums}
|
|
1558
|
+
#m3dLegend .cat-label,#refImportModal .cat-label,#refVersionModal .cat-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;font-size:12px;color:var(--text)}
|
|
1559
|
+
#m3dLegend .cat-count,#refImportModal .cat-count,#refVersionModal .cat-count{font-size:10px;color:var(--mut);font-variant-numeric:tabular-nums}
|
|
1385
1560
|
#m3dLegend .lrow.typed{padding-left:20px}
|
|
1386
|
-
#m3dLegend .cat-hdr.sub{padding-left:20px} /* a nested (middle) category, e.g. Dimensions → Base-plate */
|
|
1561
|
+
#m3dLegend .cat-hdr.sub,#refVersionModal .cat-hdr.sub{padding-left:20px} /* a nested (middle) category, e.g. Dimensions → Base-plate */
|
|
1387
1562
|
#m3dLegend .lrow.sub{padding-left:34px} /* a row inside a nested category — indented one level deeper */
|
|
1388
1563
|
#m3dLegend .drag-handle{font-size:11px;color:var(--mut);cursor:grab;opacity:0;transition:opacity .1s;flex:none;padding:0 1px;line-height:1}
|
|
1389
1564
|
#m3dLegend .lrow:hover .drag-handle{opacity:1}
|
|
@@ -1468,10 +1643,20 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1468
1643
|
<!-- grid-core is an ES module; the editor's classic script reaches it via window.GridCore (set before
|
|
1469
1644
|
the async contract fetch resolves in practice; gridcore-ready re-renders as a safety net). -->
|
|
1470
1645
|
<script type="module">import * as GC from './grid-core.js';window.GridCore=GC;document.dispatchEvent(new Event('gridcore-ready'));</script>
|
|
1646
|
+
<!-- reference-changes is an ES module for the same reason and reached the same way: the change-list
|
|
1647
|
+
panel's pure core (counts, status encoding, the cap, the refusal's copy) lives in a file a unit test
|
|
1648
|
+
can import, while the DOM that renders it belongs to this page's classic script. Neither can see the
|
|
1649
|
+
other's bindings, which is why RC_CAP restates REF_TREE_CAP's number rather than importing it. -->
|
|
1650
|
+
<script type="module">import * as RC from './reference-changes.js';window.ReferenceChanges=RC;</script>
|
|
1651
|
+
<!-- reference-session, likewise: the label-matching that carries the object tree's open groups across a
|
|
1652
|
+
re-read, and the one sentence that reports whatever could not be carried, are decisions a unit test
|
|
1653
|
+
can pin (server/reference-session.test.ts) while the state they act on — refGeom, refTreeGroups, the
|
|
1654
|
+
selection, the measurement — belongs to this page's classic script. -->
|
|
1655
|
+
<script type="module">import * as RS from './reference-session.js';window.ReferenceSession=RS;</script>
|
|
1471
1656
|
</head><body>
|
|
1472
1657
|
<header>
|
|
1473
1658
|
<b>Steel Model</b>
|
|
1474
|
-
<div id=viewToggle role=group aria-label="Canvas view"><button id=vt2d class="seg on" aria-pressed=true data-tip="Plan view (2D overlay)">2D</button><button id=vt3d class=seg aria-pressed=false data-tip="3D model view">3D</button></div>
|
|
1659
|
+
<div id=viewToggleWrap><div id=viewToggle role=group aria-label="Canvas view"><button id=vt2d class="seg on" aria-pressed=true data-tip="Plan view (2D overlay)">2D</button><button id=vt3d class=seg aria-pressed=false data-tip="3D model view">3D</button><button id=vtSplit class=seg aria-pressed=false data-tip="Plan and model side by side">Split</button></div><span id=vtSplitWhy class=hint aria-live=polite hidden></span></div>
|
|
1475
1660
|
<!-- Plan switcher. See the .plan-* rules for why this is not a <select>. Unlike the sibling page's sheet
|
|
1476
1661
|
switcher it is NOT hidden for a single plan: this control is the only place the name of the plan you
|
|
1477
1662
|
are LOOKING AT appears, so hiding it for a one-plan model would delete information rather than a
|
|
@@ -1571,6 +1756,10 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1571
1756
|
<button id=dimToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide all placed dimensions on the plan"><span class=mck aria-hidden=true></span>Dimensions</button>
|
|
1572
1757
|
<button id=calloutToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide the clickable callout bubbles (section / elevation / detail references) on the plan"><span class=mck aria-hidden=true></span>Callouts</button>
|
|
1573
1758
|
<button id=gridToggleB class=dtog role=menuitemcheckbox aria-checked=false data-tip="Show or hide the grid lines in 2D and 3D"><span class=mck aria-hidden=true></span>Grid lines</button>
|
|
1759
|
+
<!-- step=1, NOT 2: clampGridLabelPx rounds to an integer and the key is user-writable, so a coarser
|
|
1760
|
+
step would let a stored odd value draw at 15 and read "15 px" while the browser snapped the thumb
|
|
1761
|
+
to 16 — then jumped on the first drag. One authority on what a legal size is. -->
|
|
1762
|
+
<div class=mrow><span class=mlbl>Grid label size</span><input id=gridLabelSize type=range min=14 max=48 step=1 aria-label="Grid label size in pixels" data-tip="How big the grid bubbles are drawn, in both 2D and 3D. Like a CAD drawing they hold this size on screen however far you zoom in or out."><span id=gridLabelSizeV class=mval>26 px</span></div>
|
|
1574
1763
|
<button id=lenToggleB class=dtog role=menuitemcheckbox aria-checked=false data-tip="Show the length of each selected member in 2D and 3D"><span class=mck aria-hidden=true></span>Member length</button>
|
|
1575
1764
|
<button id=plToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide property labels in the 2D plan (the property selection is shared with 3D — this hides them here only)"><span class=mck aria-hidden=true></span>Property labels</button>
|
|
1576
1765
|
<button id=refToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide the traced reference sheet (the PDF/SVG drawing under the model). Hidden, it also stops contributing snap points."><span class=mck aria-hidden=true></span>Reference sheet</button>
|
|
@@ -1631,130 +1820,132 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1631
1820
|
<span>This model is saved in FloLess’s canonical format. You can look around it in 3D, edit its grid, and export it — editing members, connections and dimensions here is still catching up. Ask your terminal AI to change the model.</span>
|
|
1632
1821
|
</div>
|
|
1633
1822
|
<main>
|
|
1823
|
+
<!-- ONE PANE PER CANVAS, and each canvas's floating chrome lives INSIDE its own pane (F10a). Only
|
|
1824
|
+
#bottomDock and #selFly stay on #stagewrap: they address whichever canvas you are working in, so
|
|
1825
|
+
they span the whole stage rather than belonging to one side of it.
|
|
1826
|
+
#stage3d keeps position:absolute;inset:0, which is what lets the 3D engine's resize() and its
|
|
1827
|
+
ResizeObserver(canvas.parentElement) keep working untouched — they now measure #pane3d. -->
|
|
1634
1828
|
<div id=stagewrap>
|
|
1635
|
-
<div id=
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1829
|
+
<div id=pane2d>
|
|
1830
|
+
<div id=stage><svg id=svg></svg></div>
|
|
1831
|
+
<div id=zoombar>
|
|
1832
|
+
<button id=zOut data-tip="Zoom out">−</button>
|
|
1833
|
+
<input id=zRange type=range min=10 max=400 step=1 value=100>
|
|
1834
|
+
<button id=zIn data-tip="Zoom in">+</button>
|
|
1835
|
+
<span id=zPct>100%</span>
|
|
1836
|
+
<button id=zFit data-tip="Zoom to fit (Home)">Fit</button>
|
|
1837
|
+
</div>
|
|
1643
1838
|
</div>
|
|
1644
|
-
<
|
|
1645
|
-
<div id=
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
<div
|
|
1649
|
-
|
|
1650
|
-
<div
|
|
1651
|
-
<button
|
|
1652
|
-
<
|
|
1839
|
+
<div id=splitBar role=separator aria-orientation=vertical aria-label="Resize the plan and model panes" tabindex=0 aria-valuemin=15 aria-valuemax=85 aria-valuenow=50 data-tip="Drag to resize · double-click to reset"></div>
|
|
1840
|
+
<div id=pane3d>
|
|
1841
|
+
<canvas id=stage3d tabindex=0 aria-label="3D model"></canvas>
|
|
1842
|
+
<div id=connCrumb role=navigation aria-label="Connection breadcrumb"></div>
|
|
1843
|
+
<div id=m3dBar role=group aria-label="3D view controls">
|
|
1844
|
+
<!-- Camera projection — dropdown (like Plane / Work area); the button shows the current mode -->
|
|
1845
|
+
<div class=m3dwrap>
|
|
1846
|
+
<button id=m3dProjBtn data-tip="Camera projection — perspective, or orthographic (true scale)">Persp ▾</button>
|
|
1847
|
+
<div id=m3dProj class=m3dmenu role=menu>
|
|
1848
|
+
<button data-proj=persp class=on data-tip="Perspective — natural depth">Perspective</button>
|
|
1849
|
+
<button data-proj=ortho data-tip="Orthographic — true scale, no perspective">Orthographic</button>
|
|
1850
|
+
</div>
|
|
1653
1851
|
</div>
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1852
|
+
<button id=m3dFit data-tip="Fit all to view (Home)">Fit</button>
|
|
1853
|
+
<button id=m3dFitSel data-tip="Zoom to selected — frame just the selected members (Alt+Z)">Zoom sel</button>
|
|
1854
|
+
<span class=tb-sep></span>
|
|
1855
|
+
<!-- Display mode — dropdown; the button shows the current mode -->
|
|
1856
|
+
<div class=m3dwrap>
|
|
1857
|
+
<button id=m3dModeBtn data-tip="Display mode — solid, wireframe, see-through (X-ray) or realistic materials">Solid ▾</button>
|
|
1858
|
+
<div id=m3dMode class=m3dmenu role=menu>
|
|
1859
|
+
<button data-mode=solid class=on data-tip="Solid shaded model">Solid</button>
|
|
1860
|
+
<button data-mode=wire data-tip="Wireframe — edges only">Wire</button>
|
|
1861
|
+
<button data-mode=xray data-tip="See-through — reveal hidden parts">X-ray</button>
|
|
1862
|
+
<button data-mode=realistic data-tip="Realistic — real material finishes (steel, concrete, timber…)">Realistic</button>
|
|
1863
|
+
<button data-mode=shadowed data-tip="Realistic with cast shadows — more depth, at a cost to frame rate">Shadowed</button>
|
|
1864
|
+
</div>
|
|
1667
1865
|
</div>
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1866
|
+
<div class=m3dwrap id=m3dIsoWrap style="display:none">
|
|
1867
|
+
<button id=m3dIso aria-haspopup=menu aria-controls=m3dIsoMenu aria-expanded=false data-tip="Visibility actions for the selected objects">Isolate ▾</button>
|
|
1868
|
+
<div id=m3dIsoMenu class=m3dmenu role=menu>
|
|
1869
|
+
<button role=menuitem data-vis=show-all data-tip="Restore every hidden or isolated object" style="display:none">Show all</button>
|
|
1870
|
+
<hr data-vis-divider style="display:none">
|
|
1871
|
+
<button role=menuitem data-vis=isolate data-tip="Show only the selected objects (Esc to restore)">Isolate selected</button>
|
|
1872
|
+
<button role=menuitem data-vis=hide data-tip="Hide the selected objects">Hide selected</button>
|
|
1873
|
+
</div>
|
|
1676
1874
|
</div>
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1875
|
+
<button id=m3dViewsBtn data-tip="Saved views — save, switch, and manage named viewpoints">Views</button>
|
|
1876
|
+
<span class=tb-sep></span>
|
|
1877
|
+
<!-- Display toggles: reference lines + mark labels (grouped into a menu, like Plane / Work area).
|
|
1878
|
+
The Dimension tool moved to the header so it lives in one place across 2D and 3D. -->
|
|
1879
|
+
<div class=m3dwrap>
|
|
1880
|
+
<button id=m3dView aria-haspopup=menu aria-controls=m3dViewMenu aria-expanded=false data-tip="Show or hide reference lines, mark labels, and property labels on the 3D model">View ▾</button>
|
|
1881
|
+
<div id=m3dViewMenu class=m3dmenu role=menu>
|
|
1882
|
+
<label data-tip="Show each member's reference line (centreline)"><input type=checkbox id=m3dRef> Ref line</label>
|
|
1883
|
+
<label data-tip="Show each member's mark / id label in the 3D view"><input type=checkbox id=m3dLabels> Mark labels</label>
|
|
1884
|
+
<label data-tip="Show or hide property labels in the 3D view (the property selection is shared with 2D — this hides them here only)"><input type=checkbox id=m3dPropLabels checked> Property labels</label>
|
|
1885
|
+
<hr>
|
|
1886
|
+
<div class=m3d-actions id=m3dViewActions>
|
|
1887
|
+
<button id=m3dViewHideAll role=menuitem data-tip="Hide reference lines, mark labels, and property labels">Hide all</button>
|
|
1888
|
+
<button id=m3dViewShowAll class=mprimary role=menuitem data-tip="Show reference lines, mark labels, and property labels">Show all</button>
|
|
1889
|
+
</div>
|
|
1692
1890
|
</div>
|
|
1693
1891
|
</div>
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1892
|
+
<span class=tb-sep></span>
|
|
1893
|
+
<!-- Section -->
|
|
1894
|
+
<div class=m3dwrap>
|
|
1895
|
+
<button id=m3dClip data-tip="Clip planes and boxes — section your model to see inside">Clip ▾</button>
|
|
1896
|
+
<div id=m3dClipMenu class=m3dmenu role=menu>
|
|
1897
|
+
<button data-clip=plane data-tip="Click a model face to cut the view there (Shift+X)">Add clip plane</button>
|
|
1898
|
+
<button data-clip=box data-tip="Click two corners, then a height, to cut away everything outside (Shift+B)">Add clip box</button>
|
|
1899
|
+
<hr>
|
|
1900
|
+
<button data-clip=clear class=mdanger data-tip="Remove every clip">Clear all clips</button>
|
|
1901
|
+
</div>
|
|
1704
1902
|
</div>
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1903
|
+
<div class=m3dwrap>
|
|
1904
|
+
<button id=m3dWp data-tip="Working plane — every 3D pick (Move/Copy, next: drawing) lands on it. Set it from a face, 3 points, or a principal plane.">◇ Plane ▾</button>
|
|
1905
|
+
<div id=m3dWpMenu class=m3dmenu role=menu>
|
|
1906
|
+
<button data-wp=face data-tip="One click on any face — yours or a reference model's — the plane lands on it">Pick a face…</button>
|
|
1907
|
+
<button data-wp=3pt data-tip="Three snapped points: origin, X direction, a point on the Y side">3 points…</button>
|
|
1908
|
+
<hr>
|
|
1909
|
+
<div class=mlabel>Principal + offset</div>
|
|
1910
|
+
<div class=wpprow>
|
|
1911
|
+
<button data-wpp=xy data-tip="Horizontal plane at the offset elevation">XY</button><button data-wpp=xz data-tip="Vertical plane facing Y, offset along Y">XZ</button><button data-wpp=yz data-tip="Vertical plane facing X, offset along X">YZ</button>
|
|
1912
|
+
<input id=m3dWpOff inputmode=decimal placeholder="16'-6" autocomplete=off data-tip="Offset along the plane normal (ft-in)">
|
|
1913
|
+
</div>
|
|
1914
|
+
<hr>
|
|
1915
|
+
<label data-tip="Show or hide the reference plane surface"><input type=checkbox id=m3dWpShow> Show plane</label>
|
|
1916
|
+
<button data-wp=reset data-tip="Back to the active plan's level">Reset to level</button>
|
|
1716
1917
|
</div>
|
|
1717
|
-
<hr>
|
|
1718
|
-
<label data-tip="Show or hide the reference plane surface"><input type=checkbox id=m3dWpShow> Show plane</label>
|
|
1719
|
-
<button data-wp=reset data-tip="Back to the active plan's level">Reset to level</button>
|
|
1720
1918
|
</div>
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1919
|
+
<div class=m3dwrap>
|
|
1920
|
+
<button id=m3dWork data-tip="Working area — bound the view to a box">Work area ▾</button>
|
|
1921
|
+
<div id=m3dWorkMenu class=m3dmenu role=menu>
|
|
1922
|
+
<button data-wa=all data-tip="Bound the work area to the whole model">Set to all objects</button>
|
|
1923
|
+
<button data-wa=sel data-tip="Bound the work area to the current selection">Define from selection</button>
|
|
1924
|
+
<hr>
|
|
1925
|
+
<button id=m3dWorkOn class=wtog role=menuitemcheckbox aria-checked=false data-tip="Show or hide the work-area box"><span class=mck aria-hidden=true></span>Show work area</button>
|
|
1926
|
+
<button id=m3dWorkWhole class=wtog role=menuitemcheckbox aria-checked=true style=display:none data-tip="When ON, any part that touches the work area is shown in full — nothing gets cut. When OFF, the work area slices parts cleanly at its box faces (a section cut)."><span class=mck aria-hidden=true></span>Show whole parts</button>
|
|
1927
|
+
</div>
|
|
1730
1928
|
</div>
|
|
1731
1929
|
</div>
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1930
|
+
<div id=m3dLegend>
|
|
1931
|
+
<div id=m3dPanelHeader>
|
|
1932
|
+
<div id=m3dTabs role=tablist aria-label="3D panel tabs">
|
|
1933
|
+
<button class=m3dtab role=tab data-tab=objects aria-selected=true data-tip="Objects — show / hide, isolate, and search the model's parts">Objects</button>
|
|
1934
|
+
<button class=m3dtab role=tab data-tab=views aria-selected=false data-tip="Saved views — save, switch, and manage named viewpoints">Views</button>
|
|
1935
|
+
<button class=m3dtab role=tab data-tab=fav aria-selected=false data-tip="Favourite connections — save and re-apply detailed connections">Favourites</button>
|
|
1936
|
+
<!-- Reference models (#278). HIDDEN, not disabled, until the project holds the model-level contract:
|
|
1937
|
+
a tab that can never hold anything is the same dead chrome the header stat spans are hidden for. -->
|
|
1938
|
+
<button class=m3dtab role=tab data-tab=refs aria-selected=false style="display:none" data-tip="Reference models — an architect's or engineer's model overlaid to build against. Never part of your steel.">References</button>
|
|
1939
|
+
</div>
|
|
1940
|
+
<button type=button id=m3dLegendCollapse aria-label="Collapse 3D panel" aria-controls=m3dLegend aria-expanded=true data-tip="Collapse Objects, Views, and Favourites to the bottom-left corner"><svg viewBox="0 0 16 16" aria-hidden=true><path d="m6 3 5 5-5 5"/></svg></button>
|
|
1742
1941
|
</div>
|
|
1743
|
-
<
|
|
1942
|
+
<div id=m3dLegendBody class="m3dbody on" role=tabpanel aria-label=Objects></div>
|
|
1943
|
+
<div id=m3dViewsBody class=m3dbody role=tabpanel aria-label=Views></div>
|
|
1944
|
+
<div id=m3dFavBody class=m3dbody role=tabpanel aria-label=Favourites></div>
|
|
1945
|
+
<div id=m3dRefsBody class=m3dbody role=tabpanel aria-label="Reference models"></div>
|
|
1744
1946
|
</div>
|
|
1745
|
-
<div id=
|
|
1746
|
-
<div id=
|
|
1747
|
-
<div id=m3dFavBody class=m3dbody role=tabpanel aria-label=Favourites></div>
|
|
1748
|
-
<div id=m3dRefsBody class=m3dbody role=tabpanel aria-label="Reference models"></div>
|
|
1749
|
-
</div>
|
|
1750
|
-
<div id=m3dCube data-tip="Click a face for that view · right-drag to orbit"></div>
|
|
1751
|
-
<div id=m3dAxes></div>
|
|
1752
|
-
<div id=zoombar>
|
|
1753
|
-
<button id=zOut data-tip="Zoom out">−</button>
|
|
1754
|
-
<input id=zRange type=range min=10 max=400 step=1 value=100>
|
|
1755
|
-
<button id=zIn data-tip="Zoom in">+</button>
|
|
1756
|
-
<span id=zPct>100%</span>
|
|
1757
|
-
<button id=zFit data-tip="Zoom to fit (Home)">Fit</button>
|
|
1947
|
+
<div id=m3dCube data-tip="Click a face for that view · right-drag to orbit"></div>
|
|
1948
|
+
<div id=m3dAxes></div>
|
|
1758
1949
|
</div>
|
|
1759
1950
|
<!-- One bottom dock: the left disclosure shrinks before the right pointer controls, so they cannot collide. -->
|
|
1760
1951
|
<div id=bottomDock>
|
|
@@ -1902,6 +2093,44 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1902
2093
|
<button id=riInsert class=primary style="display:none" data-tip="Add this model as a reference. It is never part of your steel.">Add reference</button>
|
|
1903
2094
|
</div>
|
|
1904
2095
|
</div></div>
|
|
2096
|
+
<!-- ── Load a new version of a reference, and say what changed (#734, design §7.3) ──────────────────────
|
|
2097
|
+
FOUR STAGES, one of which is the answer: drop → prog → (refuse | result). The refusal REPLACES the
|
|
2098
|
+
list rather than sitting beside it, because there is no list — AWARE returns no `changes` array at all
|
|
2099
|
+
when nothing pairs, deliberately, so that no caller can render one.
|
|
2100
|
+
REGION ORDER IS header → issues → controls → list → what could not be compared (design pass, decision
|
|
2101
|
+
A). That is a DELIBERATE DEPARTURE from design §7.3, which puts the uncomparable section below the
|
|
2102
|
+
list: the two things needing eyes — a decision, and "we could not tell you everything" — would then
|
|
2103
|
+
sit under up to 12,000 rows. Flagged in the plan, not folded in silently.
|
|
2104
|
+
The propose section (Phase 5) and the version history (Phase 6) belong between the list and the foot
|
|
2105
|
+
when they exist. They are not stubbed here: empty chrome for an unbuilt feature reads as a broken one. -->
|
|
2106
|
+
<div id=refVersionModal><div class=mbackdrop id=rvBackdrop></div>
|
|
2107
|
+
<div class=rvpanel><div class=mhead><b id=rvTitle>Load a new version</b><button id=rvClose data-tip="Close">✕</button></div>
|
|
2108
|
+
<div class=rvbody id=rvBody>
|
|
2109
|
+
<div id=rvDropStage>
|
|
2110
|
+
<div id=rvSubject></div>
|
|
2111
|
+
<div id=rvDrop tabindex=0 role=button aria-label="Choose the new IFC file">Drop the new version of this IFC here, or click to choose<br><span style="font-size:11px">.ifc or .ifczip · up to 150 MB</span></div>
|
|
2112
|
+
<div id=rvDropErr role=alert></div>
|
|
2113
|
+
<input id=rvFile type=file accept=".ifc,.ifczip" style="display:none">
|
|
2114
|
+
</div>
|
|
2115
|
+
<!-- The same spinner the import modal borrows from #connImportModal, and the same honest escalating
|
|
2116
|
+
text with no percentage: there is no truthful percentage to be had for a read of two IFCs, and a
|
|
2117
|
+
fabricated bar would be a regression against a choice this feature already made (decision I). -->
|
|
2118
|
+
<div id=rvProgStage style="display:none"><div class=ci-prog><span class=ci-spin aria-hidden=true></span><span id=rvProgTxt role=status aria-live=polite>Preparing the IFC file…</span></div><div id=rvProgNote style="display:none">You can close this — FloLess will keep working.</div></div>
|
|
2119
|
+
<div id=rvRefuseStage style="display:none" role=status></div>
|
|
2120
|
+
<div id=rvResultStage style="display:none">
|
|
2121
|
+
<div id=rcHead></div>
|
|
2122
|
+
<div id=rcIssues></div>
|
|
2123
|
+
<div id=rcControls style="display:none"></div>
|
|
2124
|
+
<div id=rcList class=rcregion></div>
|
|
2125
|
+
<div id=rcUncomparable style="display:none"></div>
|
|
2126
|
+
</div>
|
|
2127
|
+
</div>
|
|
2128
|
+
<div class=rvfoot id=rvFoot>
|
|
2129
|
+
<div id=rvFootNote class=rvnote role=status></div>
|
|
2130
|
+
<button id=rvCancel>Cancel</button>
|
|
2131
|
+
<button id=rvDone class=rvprimary style="display:none">Done</button>
|
|
2132
|
+
</div>
|
|
2133
|
+
</div></div>
|
|
1905
2134
|
<div id=connImportModal><div class=mbackdrop id=ciBackdrop></div>
|
|
1906
2135
|
<div class=mpanel><div class=mhead><b id=ciTitle>Import a connection</b><button id=ciClose data-tip="Close">✕</button></div>
|
|
1907
2136
|
<div id=ciBody>
|
|
@@ -2171,6 +2400,20 @@ let DetailRefs = null; // steel-detail-refs.js — what detail callouts a plan c
|
|
|
2171
2400
|
let TARGET_CONF = null; // the app's target_confidence input default (%), or null when undeclared — drives the chip's "· target N%" goal
|
|
2172
2401
|
let DEV_MODE = false; // /api/health.appChannel; every distribution uses localhost, so hostname cannot identify dev
|
|
2173
2402
|
let view3d = false, view3dReady = false; // 2D|3D toggle state; view3dReady once Steel3DView.init has run
|
|
2403
|
+
// F10(a) — the 2D/3D split. `viewMode` is the source of truth; `view3d` survives, REDEFINED as "the
|
|
2404
|
+
// active pane is 3D", which stops being the same question as "the 3D canvas is on screen" the moment a
|
|
2405
|
+
// split exists. Every variable the later view code reads is declared HERE, in one place: scattering them
|
|
2406
|
+
// into the functions that first use them is a ReferenceError at boot, not a style choice.
|
|
2407
|
+
let SplitView = null; // web/steel-split-view.js — pure layout maths, loaded like ViewGen
|
|
2408
|
+
let viewMode = '2d'; // '2d' | '3d' | 'split' — what is on screen
|
|
2409
|
+
let requestedMode = '2d'; // what the USER last asked for; diverges from viewMode only when a
|
|
2410
|
+
// split will not fit. This is what persists.
|
|
2411
|
+
let activePane = '2d'; // '2d' | '3d' — which pane owns the TOOLS; view3d is derived from it
|
|
2412
|
+
let view3dShown = false; // is the 3D canvas ON SCREEN? (true in '3d' AND in 'split')
|
|
2413
|
+
let view2dShown = true; // …and the plan canvas. Both derived in reflectViewChrome.
|
|
2414
|
+
let splitAvailable = true; // last known "the stage can hold two panes" — the resize edge detector
|
|
2415
|
+
const SPLIT_MODE_KEY='steel:viewMode:v1', SPLIT_RATIO_KEY='steel:splitRatio:v1';
|
|
2416
|
+
let splitRatio = 0.5;
|
|
2174
2417
|
// Fallback palette (colorFor indexes this array by profile order) when a contract ships no `palette`
|
|
2175
2418
|
// — e.g. a contract shared/committed with raster_b64 + palette stripped for confidentiality.
|
|
2176
2419
|
const DEFAULT_PAL=['#60a5fa','#94a3b8','#f59e0b','#34d399','#f472b6','#a78bfa','#fb7185','#22d3ee','#facc15','#4ade80'];
|
|
@@ -2237,14 +2480,14 @@ function showEmpty(icon, headline, bodyText, appIdText, opts) {
|
|
|
2237
2480
|
* and this one CAN honour the click, just not yet.
|
|
2238
2481
|
*
|
|
2239
2482
|
* The reflection is optimistic, and main() is what makes it truthful: it routes the pending click
|
|
2240
|
-
* through setView(), whose own failure path (a renderer that did not load) calls applyViewState(
|
|
2483
|
+
* through setView(), whose own failure path (a renderer that did not load) calls applyViewState('2d')
|
|
2241
2484
|
* and puts the toggle back on 2D. Every early return in boot() is a showEmpty(), which replaces the
|
|
2242
2485
|
* whole body — so a queued intent can never outlive the toggle it belongs to.
|
|
2243
2486
|
*/
|
|
2244
|
-
let pendingView = null; // null = untouched;
|
|
2487
|
+
let pendingView = null; // null = untouched; otherwise the MODE string '2d' | '3d' | 'split'
|
|
2245
2488
|
let viewHandlersLive = false; // main() sets it once the real onclick handlers are assigned
|
|
2246
2489
|
function armEarlyViewToggle() {
|
|
2247
|
-
const t2 = document.getElementById('vt2d'), t3 = document.getElementById('vt3d');
|
|
2490
|
+
const t2 = document.getElementById('vt2d'), t3 = document.getElementById('vt3d'), tS = document.getElementById('vtSplit');
|
|
2248
2491
|
if (!t2 || !t3) return;
|
|
2249
2492
|
// Silent by default — nothing is announced and nothing is styled — but it is the correct ARIA for
|
|
2250
2493
|
// "this group's state is mid-update", which is exactly the window a queued press sits in. Cleared at
|
|
@@ -2266,10 +2509,11 @@ function armEarlyViewToggle() {
|
|
|
2266
2509
|
// still sitting at its static zeros and reads the flip as "loading", while a screen-reader user
|
|
2267
2510
|
// gets none of that context and would simply be told "pressed" about a view that is not on screen.
|
|
2268
2511
|
// aria-busy on the group above says "mid-update" instead, which is true.
|
|
2269
|
-
|
|
2270
|
-
|
|
2512
|
+
// A LOOP over the three segments, matching applyViewState — with a third mode, `toggle('on', !want)`
|
|
2513
|
+
// on a pair can no longer express "exactly one of these is pressed".
|
|
2514
|
+
for (const [m, el] of [['2d', t2], ['3d', t3], ['split', tS]]) { if (el) el.classList.toggle('on', want === m); }
|
|
2271
2515
|
});
|
|
2272
|
-
arm(t2,
|
|
2516
|
+
arm(t2, '2d'); arm(t3, '3d'); if (tS) arm(tS, 'split');
|
|
2273
2517
|
}
|
|
2274
2518
|
|
|
2275
2519
|
/**
|
|
@@ -2352,10 +2596,11 @@ function contractFailureState(status, code, serverError, projectScoped) {
|
|
|
2352
2596
|
async function boot() {
|
|
2353
2597
|
if (!APP_ID) { showEmpty('⊞', 'No workflow selected', 'Open a workflow in the FloLess canvas, then open the contract editor from that workflow’s node.'); return; }
|
|
2354
2598
|
armEarlyViewToggle(); // BEFORE the first await — that is the whole point; see above
|
|
2355
|
-
[SteelCore, ViewGen, ModelCmd, DetailRefs, V2Projection, V2Commands, V2Validation] = await Promise.all([
|
|
2599
|
+
[SteelCore, ViewGen, ModelCmd, DetailRefs, V2Projection, V2Commands, V2Validation, SplitView] = await Promise.all([
|
|
2356
2600
|
import('./steel-3d-core.js'), import('./steel-view-generation.js'), import('./steel-model-commands.js'),
|
|
2357
2601
|
import('./steel-detail-refs.js'), import('./steel-model-v2-projection.js'),
|
|
2358
2602
|
import('./steel-model-v2-commands.js'), import('./steel-model-v2-client-validation.js'),
|
|
2603
|
+
import('./steel-split-view.js'),
|
|
2359
2604
|
]);
|
|
2360
2605
|
const res = await fetch('/api/contract/' + encodeURIComponent(APP_ID) + CONTRACT_QS);
|
|
2361
2606
|
// 204 = the project-scoped "nothing stored yet", the quiet twin of the generic 404 below. It carries
|
|
@@ -2841,6 +3086,18 @@ let drawDraft=null; // Add-member tool: the first CLICKED start point (or null
|
|
|
2841
3086
|
let calloutsVisible=true; // Workstream B: show/hide the clickable callout bubbles (details + section/elevation/detail-ref) on the plan in select mode
|
|
2842
3087
|
let showSelLen=(()=>{try{return localStorage.getItem('steel:selLen:v1')==='1';}catch(_){return false;}})(); // ⋯ Display → Show member length: paint each selected member's length on the canvas (opt-in, default off)
|
|
2843
3088
|
let refSheetOn=(()=>{try{return localStorage.getItem('steel:refSheet:v1')!=='0';}catch(_){return true;}})(); // ⋯ Display → Reference sheet (F13): show/hide the traced PDF/SVG overlay under the model (default ON; only an explicit '0' hides it)
|
|
3089
|
+
// ⋯ Display → Grid label size: how big a grid bubble is ON SCREEN, in px. Constant on screen in both
|
|
3090
|
+
// views (2D divides by zoom, 3D re-derives a world size per frame), so one grid reads the same in each —
|
|
3091
|
+
// which is why the setting is shared rather than per-view. A VIEW preference, not model data: it lives in
|
|
3092
|
+
// this browser and never enters the contract. steel-3d-view.js reads the SAME key at load, so the two
|
|
3093
|
+
// agree before the first frame; changing it here pushes to the renderer live (setGridLabelPx).
|
|
3094
|
+
const GRID_LABEL_PX_DEFAULT=26,GRID_LABEL_PX_MIN=14,GRID_LABEL_PX_MAX=48;
|
|
3095
|
+
// × gridLabelPx between two bubble centres before the later one drops out. Must be ≥ 1: gridLabelPx IS
|
|
3096
|
+
// the diameter, so centres one diameter apart are exactly touching. Same value as the renderer's
|
|
3097
|
+
// GRID_LABEL_MIN_GAP — the two views must agree about what "too close" means.
|
|
3098
|
+
const GRID_LABEL_MIN_GAP=1.05;
|
|
3099
|
+
const clampGridLabelPx=v=>{const n=Math.round(+v);return Number.isFinite(n)&&n>0?Math.min(GRID_LABEL_PX_MAX,Math.max(GRID_LABEL_PX_MIN,n)):GRID_LABEL_PX_DEFAULT;};
|
|
3100
|
+
let gridLabelPx=(()=>{try{const raw=localStorage.getItem('steel:gridLabelPx:v1');return raw===null?GRID_LABEL_PX_DEFAULT:clampGridLabelPx(raw);}catch(_){return GRID_LABEL_PX_DEFAULT;}})();
|
|
2844
3101
|
let gridMode=false, gridPick=false, gridLinePick=null; // Grid lines: panel-takeover editing mode + armed pick-origin / single-line clicks
|
|
2845
3102
|
let dimStyleMode=false; // Dimension style: panel-takeover pane for the model-global defaults (⋯ → Display → Dimension style…)
|
|
2846
3103
|
let csaxisMode=false, csDraft=null; // Local coordinate system "set axes" tool: armed flag + in-progress origin [x,y] (null until click 1). P.frame={o,u} holds the committed local frame (null = global).
|
|
@@ -4665,21 +4922,101 @@ function gridLineEndpoints(el){const geo=gridGeo();if(!geo||!el||!el.dataset)ret
|
|
|
4665
4922
|
const gi=+(free?el.dataset.gl:(el.dataset.gv!=null?el.dataset.gv:el.dataset.gh));if(!isFinite(gi))return null;
|
|
4666
4923
|
const line=free?(geo.lines||[])[gi]:geo[axis][gi];if(!line)return null;
|
|
4667
4924
|
return free?[line.a.slice(),line.b.slice()]:(axis==='v'?[[line.x,line.lo],[line.x,line.hi]]:[[line.lo,line.y],[line.hi,line.y]]);}
|
|
4925
|
+
// Grid bubble geometry in SCREEN px — shared by the first render and the zoom rescale so the two can
|
|
4926
|
+
// never drift apart. Two CAD habits are encoded here. (1) EVERY bubble is the same diameter, exactly
|
|
4927
|
+
// gridLabelPx, and a long mark shrinks its TEXT to fit — that is how a drawing does it, and it is the
|
|
4928
|
+
// only way "one size, both views" can be literally true (3D's gridBubbleTexture shrinks to fit too, so
|
|
4929
|
+
// growing the circle here instead made 2D 26% bigger than 3D for any 4-character insert like "10.1").
|
|
4930
|
+
// (2) It sits TANGENT to the end of its line, on the far side from the model — the line stops at the
|
|
4931
|
+
// circle instead of running to its centre. That is the same convention gridFromDrawing measures on real
|
|
4932
|
+
// sheets, and it is what keeps a bubble off the perimeter column standing at the grid end.
|
|
4933
|
+
// sizeGridLabels() in steel-3d-view.js does both of these for 3D, from the same gridLabelPx.
|
|
4934
|
+
function gridBubbleRPx(){return gridLabelPx/2;} // ONE diameter for every mark, always
|
|
4935
|
+
// EXACT text width, not an estimate. Measured once per label on a canvas in the same font, at a
|
|
4936
|
+
// reference size, and scaled linearly — advance width is linear in font size, so one measure per
|
|
4937
|
+
// distinct mark for the life of the page. The estimate this replaces (0.58em × character count) is
|
|
4938
|
+
// blind to which glyphs they are: QA measured "D12" reaching 12.01 px into a rim that spans
|
|
4939
|
+
// 11.50–13.00 px, i.e. the D and the 2 sitting ON the stroke, because D is nearer 0.72em than 0.58.
|
|
4940
|
+
// LAZY and guarded, not a module-scope `createElement(...).getContext('2d')`: the characterization
|
|
4941
|
+
// harness evaluates this script over a minimal DOM stub whose canvas has no 2D context, so eager
|
|
4942
|
+
// construction threw during load and took 75 tests with it.
|
|
4943
|
+
let _gridTxCtx=null,_gridTxCtxTried=false;const _gridTxW=new Map();
|
|
4944
|
+
function gridLabelWidthEm(label){const t=String(label==null?'':label)||' ';
|
|
4945
|
+
if(_gridTxW.has(t))return _gridTxW.get(t);
|
|
4946
|
+
if(!_gridTxCtxTried){_gridTxCtxTried=true;try{_gridTxCtx=document.createElement('canvas').getContext('2d');}catch(_){_gridTxCtx=null;}}
|
|
4947
|
+
let w;
|
|
4948
|
+
if(_gridTxCtx&&typeof _gridTxCtx.measureText==='function'){_gridTxCtx.font='bold 100px system-ui';w=_gridTxCtx.measureText(t).width/100;}
|
|
4949
|
+
// No canvas to measure with (headless). A deliberately GENEROUS per-character estimate, so the fallback
|
|
4950
|
+
// can only shrink the text further than a real measurement would — it can never overrun the rim.
|
|
4951
|
+
else w=t.length*0.62;
|
|
4952
|
+
_gridTxW.set(t,w);return w;}
|
|
4953
|
+
// Fit the text to the CIRCLE, not to the diameter. A centred line of text is widest at its own
|
|
4954
|
+
// half-height, where the circle has already narrowed — so the constraint is
|
|
4955
|
+
// (w·fs/2)² + (0.36·fs)² ≤ Ri² (0.36em ≈ half the cap height)
|
|
4956
|
+
// which solves in closed form for fs. Ri is the INNER radius: the rim is a 1.5 px non-scaling stroke, so
|
|
4957
|
+
// text that stops at R still lands on it. 0.95 keeps the ink clearly inside rather than exactly tangent.
|
|
4958
|
+
// The base ratio (26px bubble → 12px text) is the ceiling; a long mark only ever shrinks from there.
|
|
4959
|
+
function gridLabelFontPx(label){
|
|
4960
|
+
const w=gridLabelWidthEm(label),Ri=Math.max(1,gridBubbleRPx()-1.5);
|
|
4961
|
+
return Math.min(gridLabelPx*0.46,0.95*Ri/Math.sqrt(w*w/4+0.1296));}
|
|
4668
4962
|
function gridSvg(){
|
|
4669
4963
|
if(!gridOn())return '';
|
|
4670
4964
|
const geo=gridGeo();if(!geo||(!geo.v.length&&!geo.h.length&&!(geo.lines&&geo.lines.length)))return '';
|
|
4671
|
-
const R=11/zoom,F=12/zoom;
|
|
4672
4965
|
let s='<g id=gridG>';
|
|
4673
4966
|
const gsel=i=>selGridIds.has(i)?' sel':''; // marquee/Ctrl+A grid selection → highlight the visible line
|
|
4674
4967
|
const gTip=geoMode==='el'?'extend/trim target':'drag to move'; // while Extend/Trim is armed, a grid line is a target (drag is disabled) — don't promise "drag to move"
|
|
4675
4968
|
geo.v.forEach((l,i)=>{s+=`<line class="gridln${gsel('gv:'+i)}" data-gv="${i}" x1="${l.x}" y1="${l.lo}" x2="${l.x}" y2="${l.hi}"/><line class="gridhit gv" data-gv="${i}" x1="${l.x}" y1="${l.lo}" x2="${l.x}" y2="${l.hi}" data-tip="Grid ${esc(l.label)} — ${gTip}"></line>`;});
|
|
4676
4969
|
geo.h.forEach((l,i)=>{s+=`<line class="gridln${gsel('gh:'+i)}" data-gh="${i}" x1="${l.lo}" y1="${l.y}" x2="${l.hi}" y2="${l.y}"/><line class="gridhit gh" data-gh="${i}" x1="${l.lo}" y1="${l.y}" x2="${l.hi}" y2="${l.y}" data-tip="Grid ${esc(l.label)} — ${gTip}"></line>`;});
|
|
4677
4970
|
(geo.lines||[]).forEach((l,i)=>{s+=`<line class="gridln${gsel('gl:'+(l.id!=null?l.id:i))}" data-gl="${i}" x1="${l.a[0]}" y1="${l.a[1]}" x2="${l.b[0]}" y2="${l.b[1]}"/><line class="gridhit gl" data-gl="${i}" x1="${l.a[0]}" y1="${l.a[1]}" x2="${l.b[0]}" y2="${l.b[1]}" data-tip="Grid ${esc(l.label)} — ${gTip}"></line>`;});
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4971
|
+
// (ox,oy) is the line's OTHER end — it gives the outward direction the bubble hangs along. Both are
|
|
4972
|
+
// baked onto the group as data-* so sizeGridBubbles() can re-place the circle on zoom without a rebuild
|
|
4973
|
+
// (a rebuild between a dblclick's two clicks would kill the rename gesture — see gridRenameBubble).
|
|
4974
|
+
const bub=(x,y,ox,oy,lb,ax,i,end)=>{
|
|
4975
|
+
// A zero-length line has no outward direction. `|| 1` used to guard the division and yield a ZERO
|
|
4976
|
+
// vector, parking the bubble on the model — the one thing this placement exists to prevent, in code
|
|
4977
|
+
// that read as if the case were handled. +X is arbitrary but it is a real direction. (Same in 3D.)
|
|
4978
|
+
const dx=x-ox,dy=y-oy,len=Math.hypot(dx,dy),ux=len>1e-9?dx/len:1,uy=len>1e-9?dy/len:0;
|
|
4979
|
+
const R=gridBubbleRPx()/zoom,F=gridLabelFontPx(lb)/zoom,cx=x+ux*R,cy=y+uy*R;
|
|
4980
|
+
return `<g class=gridbubg data-${ax}="${i}" data-end="${end}" data-ax="${x}" data-ay="${y}" data-ux="${ux}" data-uy="${uy}" data-label="${esc(lb)}" data-tip="Grid ${esc(lb)} — drag to move or adjust · dbl-click to rename · click to select"><circle class=gridbub cx="${cx}" cy="${cy}" r="${R}"/><text class=gridtx x="${cx}" y="${cy}" style="font-size:${F}px">${esc(lb)}</text></g>`;};
|
|
4981
|
+
geo.v.forEach((l,i)=>{s+=bub(l.x,l.lo,l.x,l.hi,l.label,'gv',i,0)+bub(l.x,l.hi,l.x,l.lo,l.label,'gv',i,1);});
|
|
4982
|
+
geo.h.forEach((l,i)=>{s+=bub(l.lo,l.y,l.hi,l.y,l.label,'gh',i,0)+bub(l.hi,l.y,l.lo,l.y,l.label,'gh',i,1);});
|
|
4983
|
+
(geo.lines||[]).forEach((l,i)=>{s+=bub(l.a[0],l.a[1],l.b[0],l.b[1],l.label,'gl',i,0)+bub(l.b[0],l.b[1],l.a[0],l.a[1],l.label,'gl',i,1);});
|
|
4682
4984
|
return s+'</g>';}
|
|
4985
|
+
// Re-place + re-size every 2D bubble for the current zoom (and for a changed Grid label size), from the
|
|
4986
|
+
// anchor/outward baked above — the screen-constant half of the same two habits gridSvg documents.
|
|
4987
|
+
function sizeGridBubbles(){
|
|
4988
|
+
const placedBubbles=[];
|
|
4989
|
+
svg.querySelectorAll('g.gridbubg').forEach(g=>{
|
|
4990
|
+
const c=g.querySelector('circle.gridbub'),t=g.querySelector('text.gridtx');if(!c||!t)return;
|
|
4991
|
+
const R=gridBubbleRPx()/zoom,F=gridLabelFontPx(g.dataset.label)/zoom;
|
|
4992
|
+
const cx=+g.dataset.ax+(+g.dataset.ux)*R,cy=+g.dataset.ay+(+g.dataset.uy)*R;
|
|
4993
|
+
// A NaN here does NOT leave a missing bubble — it leaves a bubble frozen at the previous zoom's
|
|
4994
|
+
// radius and centre, drifting off its line end as the plan scales under it. That reads as "the
|
|
4995
|
+
// drawing is wrong", not "one element failed to update", so it says so once. Reachable from a
|
|
4996
|
+
// malformed grid coordinate: sanitizePlanGrid only validates `origin`, so a NaN endpoint survives it.
|
|
4997
|
+
if(!isFinite(cx)||!isFinite(cy)||!isFinite(R)){if(!staleBubbleWarned){staleBubbleWarned=true;console.warn('steel-editor: grid bubble "'+(g.dataset.label||'?')+'" has an unusable anchor — it will not follow the zoom (check the grid coordinates)');}return;}
|
|
4998
|
+
c.setAttribute('r',R);c.setAttribute('cx',cx);c.setAttribute('cy',cy);
|
|
4999
|
+
t.setAttribute('x',cx);t.setAttribute('y',cy);t.style.fontSize=F+'px';
|
|
5000
|
+
g.style.removeProperty('display');placedBubbles.push({g,cx,cy});});
|
|
5001
|
+
// DECLUTTER, the same rule 3D applies — a drawing never prints two bubbles on top of each other, and
|
|
5002
|
+
// the plan can pile them up just as readily: zoom out far enough, or take the size up towards 48 px, and
|
|
5003
|
+
// adjacent endpoints come closer than one diameter. (It went unnoticed because at the default 26 px the
|
|
5004
|
+
// 2D zoom bottoms out with the closest centres at ~30 px — just clear.) Distances are compared in USER
|
|
5005
|
+
// units, where the threshold is the screen gap ÷ zoom, exactly as the radius is.
|
|
5006
|
+
// Selection first, then document order: the same stable, selection-aware priority as sizeGridLabels, so
|
|
5007
|
+
// the grid you are working on never loses its label and the survivors don't flicker while zooming.
|
|
5008
|
+
if(selGridIds.size)placedBubbles.sort((a,b)=>(gridIdOfBubble(b.g)&&selGridIds.has(gridIdOfBubble(b.g))?1:0)-(gridIdOfBubble(a.g)&&selGridIds.has(gridIdOfBubble(a.g))?1:0));
|
|
5009
|
+
const minGap=gridLabelPx*GRID_LABEL_MIN_GAP/zoom,kept=[];
|
|
5010
|
+
for(const b of placedBubbles){
|
|
5011
|
+
if(kept.some(k=>Math.hypot(k.cx-b.cx,k.cy-b.cy)<minGap)){b.g.style.display='none';continue;}
|
|
5012
|
+
kept.push(b);}}
|
|
5013
|
+
// The grid id a 2D bubble group belongs to — mirrors the axis/index decode the drag and rename paths use.
|
|
5014
|
+
function gridIdOfBubble(g){const geo=gridGeo()||{};
|
|
5015
|
+
if(g.dataset.gv!=null)return 'gv:'+g.dataset.gv;
|
|
5016
|
+
if(g.dataset.gh!=null)return 'gh:'+g.dataset.gh;
|
|
5017
|
+
if(g.dataset.gl!=null){const l=(geo.lines||[])[+g.dataset.gl];return 'gl:'+(l&&l.id!=null?l.id:g.dataset.gl);}
|
|
5018
|
+
return null;}
|
|
5019
|
+
let staleBubbleWarned=false; // warn once; sizeGridBubbles runs on every zoom step
|
|
4683
5020
|
// live re-render of just the grid layer while a line is being dragged (render() is too heavy per move)
|
|
4684
5021
|
function refreshGridLayer(){const el=document.getElementById('gridG');if(el)el.outerHTML=gridSvg();}
|
|
4685
5022
|
// every visible grid line with a synthetic id + endpoints — the source for marquee/Ctrl+A grid selection.
|
|
@@ -4824,7 +5161,7 @@ function updGridToggle(){const b=document.getElementById('gridToggleB');if(!b)re
|
|
|
4824
5161
|
// and the ⋯ menu item — all call this. grid.on is contract data, so the flip is undoable like every
|
|
4825
5162
|
// other grid operation.
|
|
4826
5163
|
function gridSetVisible(on){if(!C||!gridOf()||on===gridOn())return;
|
|
4827
|
-
editGrid(()=>{ModelCmd.patchGrid(gridOf(),{on:!!on});});updGridToggle();refresh3DGrid();if(
|
|
5164
|
+
editGrid(()=>{ModelCmd.patchGrid(gridOf(),{on:!!on});});updGridToggle();refresh3DGrid();if(view3dShown)build3DLegend();} // the legend is on screen whenever the 3D pane is, and must reflect the grid change
|
|
4828
5165
|
document.addEventListener('gridcore-ready',()=>{try{if(C)render();}catch(_){}}); // module shim finished after boot → paint the grid layer
|
|
4829
5166
|
function setGridMode(on){if(!C)return;gridMode=!!on;
|
|
4830
5167
|
if(!gridMode){const ae=document.activeElement,pn=document.getElementById('panel');if(ae&&pn&&pn.contains(ae))ae.blur(); // commit a focused field (change fires on blur) BEFORE the panel is torn down — a canvas click's pointerdown runs before the browser's own focus change
|
|
@@ -5264,7 +5601,7 @@ function render(){
|
|
|
5264
5601
|
// killed every call after it on this line (stats/panel/upd*/syncDisplayRows). Measured in Chromium.
|
|
5265
5602
|
svg.innerHTML=s; stats(); panel(); updUR(); updDup(); updConf(); updCS(); updConnBtn(); updBpBtn(); updSpBtn(); syncDisplayRows();
|
|
5266
5603
|
if(selFilterReady)reflectSelFilter(); // keep the Select-bar Members/Connections buttons in sync with the model — a new/removed connection kind (e.g. the first auto-detailed base plate) flips their on/off without a manual toggle. Gated on selFilterReady so it doesn't run until the deferred first reflect has armed it (that reflect needs BASE_MEMBER_TYPES, initialised later in main()).
|
|
5267
|
-
if(
|
|
5604
|
+
if(view3dShown&&window.Steel3DView){window.Steel3DView.setSelection(selIds);if(window.Steel3DView.setGridSelection)window.Steel3DView.setGridSelection(selGridIds);updateIsolateBtn();if((selIds.size||selGridIds.size)&&window.Steel3DView.selectedClips&&window.Steel3DView.selectedClips().length)window.Steel3DView.setSelectedClips([]);refreshLegendSel();} // keep the 3D member + grid highlight in sync; selecting geometry clears any clip selection (exclusive)
|
|
5268
5605
|
try{updateConnCrumb();}catch(_){} // Connection Component breadcrumb follows the selection (3D-only; hidden at root)
|
|
5269
5606
|
syncPropLabelsAfterRender(); // corner-note + push labels to 3D + refresh the popup rows against the (possibly changed) selection
|
|
5270
5607
|
}
|
|
@@ -5281,8 +5618,7 @@ function updateBadges(){const R=12/zoom,F=13/zoom,ox=el=>(+el.dataset.fi-(+el.da
|
|
|
5281
5618
|
// (brace arrowheads need no rescale here — they are content-unit sized, so they scale with the member
|
|
5282
5619
|
// stroke exactly like the line they cap. See braceHeadPoints().)
|
|
5283
5620
|
{const dg=svg.querySelector('g.dimsg');if(dg)dg.innerHTML=renderDimsInner();} // dims shrink below DIM_ZMIN (see dimSvg) so dense dims don't overlap when zoomed out (B8) — every part of a dim is zoom-derived, so rebuild the group rather than patch it
|
|
5284
|
-
|
|
5285
|
-
svg.querySelectorAll('text.gridtx').forEach(t=>t.style.fontSize=(12/zoom)+'px');
|
|
5621
|
+
sizeGridBubbles(); // radius, font AND centre — the bubble hangs off its line end by its own radius, so a zoom that changes the radius moves it too
|
|
5286
5622
|
// property-label chips: recompute size + stacked screen offset from the baked anchor (ax,ay) + per-row screen
|
|
5287
5623
|
// offset (off) so they stay constant on screen while zooming (like dim chips) — AND re-apply the zoom
|
|
5288
5624
|
// threshold live (data-mlen × zoom), so zooming reveals/hides labels as members cross ~24px on screen.
|
|
@@ -5397,7 +5733,10 @@ function treeSelectConn(conn,mods){
|
|
|
5397
5733
|
// 3D view's own ascend/whole-select so the canvas selection + envelope stay in lockstep. 3D-only; hidden at root.
|
|
5398
5734
|
function updateConnCrumb(){
|
|
5399
5735
|
const el=document.getElementById('connCrumb'); if(!el) return;
|
|
5400
|
-
|
|
5736
|
+
// view3dShown: #connCrumb is a floating breadcrumb OVER the 3D canvas (moved into #pane3d with it), not
|
|
5737
|
+
// inspector content. Drill into a connection, click the plan, and it would vanish while the envelope it
|
|
5738
|
+
// labels stayed on screen.
|
|
5739
|
+
const cs=view3dShown?connSelInfo():null;
|
|
5401
5740
|
if(!cs){ el.style.display='none'; el.innerHTML=''; return; }
|
|
5402
5741
|
const name=connKindLabel(cs.kind)+' · '+cs.main;
|
|
5403
5742
|
let html='<button class=seg data-lvl=root data-tip="Back to the model (deselect)">Model</button><span class=sep>▸</span>';
|
|
@@ -6752,7 +7091,7 @@ function renderPropLabels(){const pl=C.prop_labels;propLabelsHidden=0;if(!pl||!p
|
|
|
6752
7091
|
// right-click a member. Measured by review, not reasoned about. The honest place for that explanation is
|
|
6753
7092
|
// the popup where "Clear all" lives, not the canvas.
|
|
6754
7093
|
function updatePropHint(){let el=document.getElementById('plHint');
|
|
6755
|
-
const show
|
|
7094
|
+
const show=view2dShown&&propLabelsHidden>0; // a 2D-CANVAS hint: it belongs on screen whenever the plan is, not only when the plan holds the tools
|
|
6756
7095
|
if(!show){if(el)el.style.display='none';return;}
|
|
6757
7096
|
if(!el){el=document.createElement('div');el.id='plHint';el.style.cssText='position:fixed;z-index:20;pointer-events:none;background:var(--panel);color:var(--mut);border:1px solid var(--line);border-radius:6px;padding:3px 9px;font:11px system-ui;box-shadow:0 2px 8px rgba(0,0,0,.4)';document.body.appendChild(el);}
|
|
6758
7097
|
const st=document.getElementById('stage').getBoundingClientRect();
|
|
@@ -7541,10 +7880,15 @@ function updCS(){const s=document.getElementById('csStat');const r=document.getE
|
|
|
7541
7880
|
// themed transient toast (baseline tokens — never a native alert)
|
|
7542
7881
|
// `sticky` holds the toast up with no timer — for an operation whose result the user must see land
|
|
7543
7882
|
// (the Tekla send takes seconds); the next plain toast() replaces the text and re-arms the timer.
|
|
7544
|
-
|
|
7545
|
-
|
|
7883
|
+
// `ms` stretches the ordinary timer for a message that is genuinely longer to READ (the session-carryover
|
|
7884
|
+
// sentence runs to three clauses). It is not a second sticky: it always expires on its own.
|
|
7885
|
+
// `max-width` because a sentence that long would otherwise stretch to the full width of a wide monitor
|
|
7886
|
+
// before it wrapped, which is a line the eye cannot track back from.
|
|
7887
|
+
const TOAST_MS=2600;
|
|
7888
|
+
function toast(msg,sticky,ms){let t=document.getElementById('toast');
|
|
7889
|
+
if(!t){t=document.createElement('div');t.id='toast';t.style.cssText='position:fixed;left:50%;bottom:18px;transform:translateX(-50%);background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:8px;padding:8px 14px;box-shadow:var(--shadow-md);z-index:60;font:13px system-ui;line-height:1.5;max-width:min(480px,86vw);opacity:0;transition:opacity .2s;pointer-events:none';document.body.appendChild(t);}
|
|
7546
7890
|
t.setAttribute('role','status');t.setAttribute('aria-live','polite');t.setAttribute('aria-atomic','true');
|
|
7547
|
-
t.textContent=msg;t.style.opacity='1';clearTimeout(t._h);if(!sticky)t._h=setTimeout(()=>{t.style.opacity='0';},
|
|
7891
|
+
t.textContent=msg;t.style.opacity='1';clearTimeout(t._h);if(!sticky)t._h=setTimeout(()=>{t.style.opacity='0';},ms>0?ms:TOAST_MS);}
|
|
7548
7892
|
// --- pointer: select(+ctrl toggle / box) + group-move + endpoint (Shift = ortho) ---
|
|
7549
7893
|
svg.addEventListener('pointerdown',e=>{if(e.button!==0)return;const t=e.target;
|
|
7550
7894
|
if(csaxisMode){csClick(e);e.preventDefault();return;} // set-local-axes armed → clicks define origin then X-direction
|
|
@@ -7847,7 +8191,7 @@ document.getElementById('csArm3dB').onclick=()=>{const d3=window.Steel3DView;if(
|
|
|
7847
8191
|
*
|
|
7848
8192
|
* WHAT A ROW ON A READ-ONLY DOCUMENT REPORTS. Dimensions and Callouts draw onto the 2D plan, and
|
|
7849
8193
|
* Reference sheet draws the traced sheet under it. A v2 document has no 2D plan — render() returns before
|
|
7850
|
-
* drawing one and the 2D tab
|
|
8194
|
+
* drawing one, and the 2D tab has nothing honest to draw — so those three are OFF and disabled.
|
|
7851
8195
|
* Member length is deliberately different: it is a model-space read that paints in 3D, the view a v2
|
|
7852
8196
|
* document opens in. It therefore reports the shared preference and remains live in read-only mode.
|
|
7853
8197
|
*
|
|
@@ -7868,6 +8212,28 @@ document.getElementById('dimToggleB').onclick=e=>{e.stopPropagation();if(MODEL_R
|
|
|
7868
8212
|
// selected-member payload to 3D on both formats.
|
|
7869
8213
|
function updLenToggle(){const b=document.getElementById('lenToggleB');if(!b)return;const on=showSelLen;b.disabled=false;b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));}
|
|
7870
8214
|
document.getElementById('lenToggleB').onclick=e=>{e.stopPropagation();showSelLen=!showSelLen;try{localStorage.setItem('steel:selLen:v1',showSelLen?'1':'0');}catch(_){}updLenToggle();render();}; // render() repaints the 2D chips + pushes/clears labels in 3D
|
|
8215
|
+
// ⋯ Display → Grid label size. One setting, both views: 2D re-places its bubbles from the anchors baked
|
|
8216
|
+
// by gridSvg (no re-render — a rebuild between a dblclick's two clicks would kill the rename gesture),
|
|
8217
|
+
// and 3D is told live, where sizeGridLabels() re-derives the world size on the next frame.
|
|
8218
|
+
// Guarded like every other row in this menu (updLenToggle, updCalloutToggle) and for a sharper reason:
|
|
8219
|
+
// this block runs INSIDE main(), which boot() calls unguarded and which wires the SSE subscription
|
|
8220
|
+
// AFTER it — so an unguarded throw on a missing element would abort the remaining ~6000 lines of main()
|
|
8221
|
+
// plus live updates, and leave a half-initialised editor whose root cause is a range input.
|
|
8222
|
+
{const r=document.getElementById('gridLabelSize'),v=document.getElementById('gridLabelSizeV');
|
|
8223
|
+
if(!r||!v)console.warn('steel-editor: the Grid label size control is missing from ⋯ ▸ Display — grid labels stay at '+gridLabelPx+'px this session');
|
|
8224
|
+
else{
|
|
8225
|
+
const showVal=()=>{v.textContent=gridLabelPx+' px';};
|
|
8226
|
+
r.min=GRID_LABEL_PX_MIN;r.max=GRID_LABEL_PX_MAX;r.value=gridLabelPx;showVal();
|
|
8227
|
+
r.addEventListener('input',()=>{gridLabelPx=clampGridLabelPx(r.value);showVal();
|
|
8228
|
+
// A failed write is the ONE path where the two views can disagree: the live push below is skipped
|
|
8229
|
+
// while the renderer module is still loading, so the shared key is the only thing left to carry the
|
|
8230
|
+
// size across — and it just didn't. setView(true) re-pushes on the next switch to 3D, so the
|
|
8231
|
+
// divergence self-heals; this says why persistence stopped working. (Idiom as at :2590.)
|
|
8232
|
+
try{localStorage.setItem('steel:gridLabelPx:v1',String(gridLabelPx));}
|
|
8233
|
+
catch(_){if(!gridLabelPxSaveWarned){gridLabelPxSaveWarned=true;console.warn('steel-editor: the grid label size could not be saved to this browser — it will not survive a reload');}}
|
|
8234
|
+
sizeGridBubbles();
|
|
8235
|
+
if(window.Steel3DView&&window.Steel3DView.setGridLabelPx)window.Steel3DView.setGridLabelPx(gridLabelPx);});}}
|
|
8236
|
+
let gridLabelPxSaveWarned=false;
|
|
7871
8237
|
function updCalloutToggle(){const b=document.getElementById('calloutToggleB');if(!b)return;const on=!MODEL_RO&&calloutsVisible;b.disabled=MODEL_RO;b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));} // plan-only, like Dimensions
|
|
7872
8238
|
document.getElementById('calloutToggleB').onclick=e=>{e.stopPropagation();if(MODEL_RO)return;calloutsVisible=!calloutsVisible;updCalloutToggle();render();};
|
|
7873
8239
|
// NOTE FOR THE NEXT EDITOR: do NOT add `b.disabled=MODEL_RO` here to match the five rows around it.
|
|
@@ -8065,7 +8431,11 @@ addEventListener('keydown',e=>{
|
|
|
8065
8431
|
if(pre)apply(pre);else render(); // apply() restores the snapshot + re-renders (2D+3D); draw/marquee have no snapshot, just refresh
|
|
8066
8432
|
return;}
|
|
8067
8433
|
if(e.key==='Escape'&&!view3d&&snapOnly){snapOnlyClear2d();return;} // own Esc rung: 1st Esc drops the snap override, the next cancels the tool/draft (mirrors the set-axes two-step)
|
|
8068
|
-
|
|
8434
|
+
// `!inForm`, like the shortcuts below it: Home/End is the documented affordance of a range input
|
|
8435
|
+
// (jump to min/max), and ⋯ ▸ Display now has one. Without the gate, tabbing to Grid label size and
|
|
8436
|
+
// pressing Home preventDefault()s the jump-to-min AND zooms the plan to fit behind the open menu —
|
|
8437
|
+
// while End still works, so the pair behaved asymmetrically, which is worse than either alone.
|
|
8438
|
+
if(e.key==='Home'&&!inForm){e.preventDefault();if(view3d&&window.Steel3DView)window.Steel3DView.frameAll();else fitToWindow();return;}
|
|
8069
8439
|
if(view3d&&window.Steel3DView&&!inForm&&e.shiftKey&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!cmTool&&mode!=='add'&&!(window.Steel3DView.dimToolOn&&window.Steel3DView.dimToolOn())){const ck=e.key.toLowerCase(); // Shift+X arms a clip plane, Shift+B a clip box (3D-only sectioning; mirrors the Clip ▾ menu). Both are skipped while Move/Copy, Add, or 3D-Dim is armed: Shift+X then falls through to that tool's X-axis lock (instead of nuking the pick), and Shift+B is held off for the same reason so it can't discard an in-progress operation either.
|
|
8070
8440
|
if(ck==='x'){e.preventDefault();window.Steel3DView.setClipMode('plane');setLastCmd('Clip plane',()=>window.Steel3DView.setClipMode('plane'));return;}
|
|
8071
8441
|
if(ck==='b'){e.preventDefault();window.Steel3DView.setClipMode('box');setLastCmd('Clip box',()=>window.Steel3DView.setClipMode('box'));return;}}
|
|
@@ -8236,11 +8606,60 @@ reflectOriginGrid();
|
|
|
8236
8606
|
let startX=0,startW=0;
|
|
8237
8607
|
const onMove=e=>apply(startW+(startX-e.clientX),false); // handle on the panel's LEFT edge → drag left = wider
|
|
8238
8608
|
const onUp=()=>{rz.classList.remove('drag');document.body.style.userSelect='';window.removeEventListener('pointermove',onMove);window.removeEventListener('pointerup',onUp);localStorage.setItem(KEY,String(Math.round(curW())));};
|
|
8239
|
-
|
|
8609
|
+
// Same explicit focus, and for the same reason, as the split divider below: preventDefault() kills the
|
|
8610
|
+
// browser's click-to-focus, so this resizer's own arrow-key nudge was unreachable after a click too. It
|
|
8611
|
+
// is the older of the two separators and shipped that way; the split divider is documented as "the
|
|
8612
|
+
// #panelResizer recipe, gesture for gesture", which is only true if both are fixed. (UX review.)
|
|
8613
|
+
rz.addEventListener('pointerdown',e=>{e.preventDefault();rz.focus({preventScroll:true});startX=e.clientX;startW=curW();rz.classList.add('drag');document.body.style.userSelect='none';window.addEventListener('pointermove',onMove);window.addEventListener('pointerup',onUp);});
|
|
8240
8614
|
rz.addEventListener('dblclick',()=>{root.style.removeProperty('--panelw');localStorage.removeItem(KEY);}); // reset to the 240px default
|
|
8241
|
-
|
|
8615
|
+
// stopPropagation for the same reason the split divider below carries it: steel-3d-view.js binds onKey
|
|
8616
|
+
// on WINDOW and only skips INPUT/SELECT/TEXTAREA, so a div[tabindex=0] sails through. This handler was
|
|
8617
|
+
// unreachable by mouse until the focus() above, which is exactly what made the collision reachable —
|
|
8618
|
+
// with the 3D pane active, click + ArrowLeft resized the panel AND panned the camera. (Codex review of
|
|
8619
|
+
// the fix, F5: measured 240→252px with the 3D view moving underneath it.)
|
|
8620
|
+
rz.addEventListener('keydown',e=>{if(e.key==='ArrowLeft'){e.preventDefault();e.stopPropagation();apply(curW()+(e.shiftKey?40:12),true);}else if(e.key==='ArrowRight'){e.preventDefault();e.stopPropagation();apply(curW()-(e.shiftKey?40:12),true);}});
|
|
8242
8621
|
window.addEventListener('resize',()=>{if(root.style.getPropertyValue('--panelw'))apply(curW(),false);}); // re-clamp if the viewport shrank
|
|
8243
8622
|
})();
|
|
8623
|
+
// The split divider. Deliberately the #panelResizer recipe above, gesture for gesture — drag,
|
|
8624
|
+
// double-click to reset, arrow keys with a Shift coarse step — so the editor's two separators behave the
|
|
8625
|
+
// same. The difference is the UNIT: this one stores a RATIO, not a width, so the split survives a window
|
|
8626
|
+
// resize proportionally instead of pinning one pane and squeezing the other into its minimum.
|
|
8627
|
+
(function(){
|
|
8628
|
+
const bar=document.getElementById('splitBar'); if(!bar)return;
|
|
8629
|
+
const wrap=document.getElementById('stagewrap');
|
|
8630
|
+
const apply=applySplitRatio;
|
|
8631
|
+
// Read the divider width back from CSS rather than repeating the number — clampRatio's denominator
|
|
8632
|
+
// (stage width − divider) has to be the SAME quantity the pane calc() subtracts, and two 7s that drift
|
|
8633
|
+
// apart would put the panes and their minimum-width rule quietly out of step.
|
|
8634
|
+
const dividerPx=()=>{const v=parseFloat(getComputedStyle(wrap).getPropertyValue('--split-divider'));return Number.isFinite(v)?v:SplitView.DIVIDER_PX;};
|
|
8635
|
+
// Measure from the pointer MINUS half the divider, because the ratio addresses the divider's left edge
|
|
8636
|
+
// while the user grabs its middle. Without the offset the bar jumps ~3.5px toward the pointer on the
|
|
8637
|
+
// first move of every drag — small, but it makes a careful adjustment feel like it slipped. (Codex
|
|
8638
|
+
// review, H10.)
|
|
8639
|
+
const ratioAt=clientX=>{const r=wrap.getBoundingClientRect(),d=dividerPx();return (clientX-r.left-d/2)/Math.max(1,r.width-d);};
|
|
8640
|
+
const onMove=e=>apply(ratioAt(e.clientX),false);
|
|
8641
|
+
const onUp=()=>{bar.classList.remove('drag');document.body.style.userSelect='';window.removeEventListener('pointermove',onMove);window.removeEventListener('pointerup',onUp);apply(splitRatio,true);};
|
|
8642
|
+
// focus() explicitly, because the preventDefault() on the line before it suppresses the browser's OWN
|
|
8643
|
+
// click-to-focus — and this separator promises an arrow-key nudge, which needs focus to reach the keydown
|
|
8644
|
+
// handler below. Without it, "click the divider, then press Left/Right" silently did nothing: focus
|
|
8645
|
+
// stayed on #stage and aria-valuenow never moved off 50. Once per pointerdown and never in pointermove,
|
|
8646
|
+
// so a drag does not re-announce the separator on every sample. Chromium DOES match `:focus-visible` for
|
|
8647
|
+
// this focus (measured), so a clicked divider keeps the brand tint until focus leaves — kept deliberately:
|
|
8648
|
+
// it is the existing focus state, not a new one, and it says the separator now owns the arrow keys.
|
|
8649
|
+
// (Independent QA E2E, item 14.)
|
|
8650
|
+
bar.addEventListener('pointerdown',e=>{e.preventDefault();bar.focus({preventScroll:true});bar.classList.add('drag');document.body.style.userSelect='none';window.addEventListener('pointermove',onMove);window.addEventListener('pointerup',onUp);});
|
|
8651
|
+
bar.addEventListener('dblclick',()=>apply(0.5,true));
|
|
8652
|
+
// stopPropagation, not just preventDefault: steel-3d-view.js binds onKey on WINDOW and only skips
|
|
8653
|
+
// INPUT/SELECT/TEXTAREA, so a div[tabindex=0] sails through it. Without this, an arrow key on the
|
|
8654
|
+
// focused divider moved the divider AND panned the 3D camera — and this divider exists only in the mode
|
|
8655
|
+
// where the 3D canvas is always on screen, so that collision is routine, not theoretical. (Code review.)
|
|
8656
|
+
bar.addEventListener('keydown',e=>{const step=(e.shiftKey?0.1:0.02);
|
|
8657
|
+
if(e.key==='ArrowLeft'){e.preventDefault();e.stopPropagation();apply(splitRatio-step,true);}
|
|
8658
|
+
else if(e.key==='ArrowRight'){e.preventDefault();e.stopPropagation();apply(splitRatio+step,true);}});
|
|
8659
|
+
// Re-clamp the geometry on every resize frame. Distinct from onStageResize, which changes the MODE and
|
|
8660
|
+
// only on an availability edge; both may coexist because they answer different questions.
|
|
8661
|
+
window.addEventListener('resize',()=>{if(viewMode==='split')apply(splitRatio,false);});
|
|
8662
|
+
})();
|
|
8244
8663
|
// Properties panel: collapse the inspector and its resizer as one unit, but retain the user's saved width.
|
|
8245
8664
|
// The edge button lives outside #panel because panel() replaces that aside's contents on every selection.
|
|
8246
8665
|
(function(){
|
|
@@ -8999,7 +9418,9 @@ const view3dApi={
|
|
|
8999
9418
|
// Re-extrude the 3D model after a structural edit (keeps the camera where it is). Selection-only
|
|
9000
9419
|
// changes go through render()'s setSelection — only geometry mutations need a rebuild.
|
|
9001
9420
|
let pendingConnSel=null; // a just-baked connection whose parts exist only AFTER the next rebuild → select the whole thing there (a recognized base-plate import, whose part ids aren't known ahead of expansion)
|
|
9002
|
-
|
|
9421
|
+
// view3dShown, not view3d: in a split with the PLAN pane active, an edit must still rebuild the model in
|
|
9422
|
+
// the pane beside it — that is the one thing the split exists to let you watch.
|
|
9423
|
+
function sync3D(){invalidateConnectionDiagnostics();panel();if(view3dShown&&view3dReady&&window.Steel3DView){window.Steel3DView.rebuild(false).then(()=>{
|
|
9003
9424
|
if(pendingConnSel&&window.Steel3DView.selectWholeConn){const c=pendingConnSel;pendingConnSel=null;window.Steel3DView.selectWholeConn(c);} // whole-connection select (envelope + "Parametric — editable" inspector), same as a 3D click
|
|
9004
9425
|
else window.Steel3DView.setSelection(selIds);
|
|
9005
9426
|
build3DLegend();panel();}).catch(()=>{pendingConnSel=null;});}} // rebuild also refreshes the legend (an edit may add/remove a profile) + re-renders the inspector so a selection of just-created parts (e.g. a placed custom connection) resolves against the freshly-fetched partsById, not the pre-rebuild stale copy
|
|
@@ -9244,9 +9665,11 @@ function saveLegendTab(){try{localStorage.setItem('floless.legendTab',legendTab)
|
|
|
9244
9665
|
function reflectLegendPanel(){
|
|
9245
9666
|
const p=document.getElementById('m3dLegend'),launch=document.getElementById('m3dLegendLauncher'),collapse=document.getElementById('m3dLegendCollapse');
|
|
9246
9667
|
syncLegendClearance();
|
|
9247
|
-
|
|
9668
|
+
// The Objects panel lives INSIDE the 3D pane, so it follows that pane being on screen — hiding it
|
|
9669
|
+
// because the plan happens to hold the tools would blank a panel the user can still see the pane of.
|
|
9670
|
+
const open=!!view3dShown&&!legendCollapsed;
|
|
9248
9671
|
if(p)p.style.display=open?'flex':'none';
|
|
9249
|
-
if(launch){launch.style.display=
|
|
9672
|
+
if(launch){launch.style.display=view3dShown&&legendCollapsed?'flex':'none';launch.setAttribute('aria-expanded',String(open));}
|
|
9250
9673
|
if(collapse)collapse.setAttribute('aria-expanded',String(open));
|
|
9251
9674
|
updateViewsBtn();
|
|
9252
9675
|
}
|
|
@@ -9284,7 +9707,10 @@ wireLegendTabs(); // the panel shell is static markup — wire it immediately so
|
|
|
9284
9707
|
// Keep the bottom-left panel below the toolbar's real wrapped height. ResizeObserver also catches
|
|
9285
9708
|
// width changes caused by the properties panel opening/closing, not just window resizes.
|
|
9286
9709
|
function syncLegendClearance(){
|
|
9287
|
-
|
|
9710
|
+
// #pane3d, not #stagewrap: the panel and the toolbar both live in the 3D pane now, so the clearance
|
|
9711
|
+
// must be measured against — and set on — the box that actually bounds them. In a single mode the pane
|
|
9712
|
+
// IS the whole stage, so this computes the same number it always did.
|
|
9713
|
+
const stage=document.getElementById('pane3d'),bar=document.getElementById('m3dBar');if(!stage||!bar)return;
|
|
9288
9714
|
const sr=stage.getBoundingClientRect(),br=bar.getBoundingClientRect();
|
|
9289
9715
|
const clearance=Math.ceil(Math.max(0,br.bottom-sr.top)+72)+'px'; // 8px gap + 64px bottom chrome
|
|
9290
9716
|
if(stage.style.getPropertyValue('--m3d-legend-clearance')!==clearance)stage.style.setProperty('--m3d-legend-clearance',clearance);
|
|
@@ -9845,7 +10271,7 @@ const refApi=(suffix)=>'/api/steel/'+encodeURIComponent(APP_ID)+'/reference'+suf
|
|
|
9845
10271
|
|
|
9846
10272
|
/** Hand the 3D layer everything it draws. Called after any geometry arrival or display/placement edit. */
|
|
9847
10273
|
function pushReferences(){
|
|
9848
|
-
if(!window.Steel3DView||!window.Steel3DView.setReferences||!
|
|
10274
|
+
if(!window.Steel3DView||!window.Steel3DView.setReferences||!view3dShown)return; // reference geometry must reach a VISIBLE 3D pane, whichever pane holds the tools
|
|
9849
10275
|
window.Steel3DView.setReferences(refList().map(r=>({
|
|
9850
10276
|
id:r.id,name:r.name,placement:r.placement||null,display:refDisp(r),
|
|
9851
10277
|
objects:(refGeom.get(r.id)||{}).objects||[],
|
|
@@ -10444,7 +10870,7 @@ function buildRefRow(r){
|
|
|
10444
10870
|
// The tip ENUMERATES the menu, so adding an item without touching it leaves the anchor advertising a
|
|
10445
10871
|
// menu that no longer exists. (Caught in the browser pass: Stage D's item shipped while this still read
|
|
10446
10872
|
// "move it next to your model, reload, remove".)
|
|
10447
|
-
dots.setAttribute('role','button');dots.dataset.tip='More — measure a distance, move it next to your model, reload, remove';
|
|
10873
|
+
dots.setAttribute('role','button');dots.dataset.tip='More — measure a distance, move it next to your model, load a new version, reload, remove';
|
|
10448
10874
|
dots.addEventListener('click',e=>{e.stopPropagation();openRefRowMenu(r,dots);});
|
|
10449
10875
|
row.appendChild(dots);
|
|
10450
10876
|
|
|
@@ -10837,6 +11263,173 @@ function groupReferenceObjects(objects){
|
|
|
10837
11263
|
return out;
|
|
10838
11264
|
}
|
|
10839
11265
|
|
|
11266
|
+
/**
|
|
11267
|
+
* The session state a re-read destroys — captured before it happens, re-attached after (#734 Phase 5).
|
|
11268
|
+
*
|
|
11269
|
+
* `Reload its geometry` and `Load a new version…` both replace a reference's objects wholesale, and three
|
|
11270
|
+
* pieces of live state are addressed by exactly what that replaces: the drilled-into object (by ARRAY
|
|
11271
|
+
* INDEX), the tree's open/closed groups (by POSITION — '2:1' is the second storey's second type), and the
|
|
11272
|
+
* measurement (by RAW WORLD POINTS). Dropping all three is honest but wasteful, because two of them do
|
|
11273
|
+
* carry identity the new read can be matched on. So they are migrated, and only what could NOT be matched
|
|
11274
|
+
* is said out loud. Nothing here is ever allowed to vanish silently.
|
|
11275
|
+
*
|
|
11276
|
+
* TWO HALVES, because the new objects do not exist yet at the moment the old ones are thrown away.
|
|
11277
|
+
* `refSessionSnapshot` resolves the positional state into LABELS while the old objects are still in
|
|
11278
|
+
* `refGeom`; `refSessionMigrate` resolves those labels back into positions against the new ones and
|
|
11279
|
+
* returns what it could not place.
|
|
11280
|
+
*/
|
|
11281
|
+
function refSessionSnapshot(id){
|
|
11282
|
+
const objects=(refGeom.get(id)||{}).objects;
|
|
11283
|
+
const groups=Array.isArray(objects)?groupReferenceObjects(objects):[];
|
|
11284
|
+
const keys=[];
|
|
11285
|
+
for(const [key,val] of (refTreeGroups.get(id)||[])){
|
|
11286
|
+
const [si,ti]=key.split(':');
|
|
11287
|
+
const s=groups[Number(si)];
|
|
11288
|
+
if(!s)continue; // a key with no group behind it is already dead — there is nothing to carry
|
|
11289
|
+
if(ti===undefined){keys.push({storey:s.storey,type:undefined,val});continue;}
|
|
11290
|
+
const t=s.types[Number(ti)];
|
|
11291
|
+
if(t)keys.push({storey:s.storey,type:t.type,val});
|
|
11292
|
+
}
|
|
11293
|
+
return {
|
|
11294
|
+
// WHETHER there was one is all that is wanted. The drilled-into object migrates a layer down —
|
|
11295
|
+
// `revalidateSubSelection` keys on GlobalId and moves the selection to wherever that object now sits —
|
|
11296
|
+
// so the answer to "did it survive" is read off the editor's own index afterwards, which that layer has
|
|
11297
|
+
// by then either rewritten or cleared.
|
|
11298
|
+
hadObject:refSelectedId===id&&refSelectedObjIdx!==null,
|
|
11299
|
+
// ITS IDENTITY, not just its index — so whether it survived can be answered from the objects that
|
|
11300
|
+
// arrive rather than from whether the 3D layer happened to run. See `objectSurvives`.
|
|
11301
|
+
objectGid:(refSelectedId===id&&refSelectedObjIdx!==null&&Array.isArray(objects)&&objects[refSelectedObjIdx])
|
|
11302
|
+
?(objects[refSelectedObjIdx].globalId||null):null,
|
|
11303
|
+
// A FINISHED MEASUREMENT ONLY. The tool being armed with no result yet is a disarm, not a loss, and
|
|
11304
|
+
// saying "your measurement was dropped" about a measurement that was never taken is a false report.
|
|
11305
|
+
hadMeasure:!!(refMeasure&&refMeasure.refId===id),
|
|
11306
|
+
keys,
|
|
11307
|
+
};
|
|
11308
|
+
}
|
|
11309
|
+
|
|
11310
|
+
/**
|
|
11311
|
+
* Re-attach what the snapshot holds to the geometry that has now arrived, and return what could not be.
|
|
11312
|
+
*
|
|
11313
|
+
* Called AFTER `pushReferences()`, which is what runs the 3D layer's own object migration — reading
|
|
11314
|
+
* `refSelectedObjIdx` any earlier asks whether the object survived before anything has tried to save it.
|
|
11315
|
+
* Returns the FACT PHRASES for `refCarryoverSentence`, in the order they read best, or an empty array
|
|
11316
|
+
* when everything carried — which is the ordinary outcome and must stay silent.
|
|
11317
|
+
*/
|
|
11318
|
+
function refSessionMigrate(id,snap){
|
|
11319
|
+
const RS=window.ReferenceSession;
|
|
11320
|
+
const facts=[];
|
|
11321
|
+
// GONE MEANS GONE, AND MEANS SAY NOTHING. A reference can be removed while its re-read is still in
|
|
11322
|
+
// flight — the version route detaches from the client on purpose, so the read really does finish — and
|
|
11323
|
+
// everything below would then be true but useless: "the object you had open didn't carry over" about a
|
|
11324
|
+
// file the user has just deliberately deleted. `refRemove` has already said what happened, and nothing
|
|
11325
|
+
// here is a loss this re-read caused. (Codex review.)
|
|
11326
|
+
if(!refById(id))return facts;
|
|
11327
|
+
const objects=(refGeom.get(id)||{}).objects;
|
|
11328
|
+
// THE OBJECT IS ASKED ABOUT EVEN WHEN NOTHING ARRIVED — a failed read genuinely does take the drilled
|
|
11329
|
+
// object away, and that is the case where an unexplained empty panel is most confusing.
|
|
11330
|
+
//
|
|
11331
|
+
// ASKED OF THE OBJECTS, NOT OF THE SELECTION. Whether the re-read kept this object is a question about
|
|
11332
|
+
// the file; whether the user is still looking at it is not. Reading the editor's index instead gets both
|
|
11333
|
+
// directions wrong: it is stale while the 3D view is inactive (`pushReferences` no-ops), which reads as
|
|
11334
|
+
// "survived"; and it changes whenever the user clicks something else during a read that can run for a
|
|
11335
|
+
// minute, which would report a loss for an object that is still there. A false report costs exactly what
|
|
11336
|
+
// a missing one costs. (Codex + review.)
|
|
11337
|
+
if(snap.hadObject&&!refObjectSurvives(snap.objectGid,objects))facts.push('the object you had open');
|
|
11338
|
+
// A READ THAT BROUGHT NOTHING BACK STILL TOOK THE GROUPS. The keys were cleared before the fetch, so
|
|
11339
|
+
// there is nothing to re-key onto and the state is gone for good — saying nothing here left the user to
|
|
11340
|
+
// discover it on the retry, which is the one place the object and the measurement were reported and the
|
|
11341
|
+
// groups silently were not. The row says the file could not be read; this says what it cost. (Review.)
|
|
11342
|
+
if(!Array.isArray(objects)){
|
|
11343
|
+
if(snap.keys.some((k)=>k.val&&k.val.open))facts.push('the groups you had open');
|
|
11344
|
+
if(snap.keys.length)console.warn('[reference] the re-read of',id,'returned no objects — its tree state could not be carried');
|
|
11345
|
+
}else if(RS){
|
|
11346
|
+
const {keys,lost}=RS.migrateGroupKeys(snap.keys,groupReferenceObjects(objects));
|
|
11347
|
+
// MERGED OVER WHAT IS ALREADY THERE, not written over it. `pushReferences` runs before this and can
|
|
11348
|
+
// reach `revealRefTreeObject`, which opens the path to the drilled object under its own `q:null` mark;
|
|
11349
|
+
// a whole-map replace here would discard exactly the opens that make the migrated selection visible.
|
|
11350
|
+
// The reveal wins, because it describes where the selection actually is now.
|
|
11351
|
+
//
|
|
11352
|
+
// AND EACH CHOICE IS RE-FILED AGAINST THE QUERY THAT IS ACTUALLY IN THE BOX. A choice records the
|
|
11353
|
+
// query it was made under and applies only when that query returns, so carrying the OLD query forward
|
|
11354
|
+
// makes every restored choice inert the moment anything has changed the filter — and the reveal above
|
|
11355
|
+
// is itself one of the things that changes it (it clears the box when the drilled object no longer
|
|
11356
|
+
// matches). Re-filing keeps the user's open/closed intent applicable instead of technically preserved
|
|
11357
|
+
// and permanently unused. (Review.)
|
|
11358
|
+
const q=(refTreeQuery.get(id)||'').trim().toLowerCase();
|
|
11359
|
+
const refiled=new Map([...keys].map(([k,v])=>[k,v&&v.q===null?v:{open:!!(v&&v.open),q}]));
|
|
11360
|
+
const revealed=refTreeGroups.get(id);
|
|
11361
|
+
const next=revealed&&revealed.size?new Map([...refiled,...revealed]):refiled;
|
|
11362
|
+
// Set even when empty, so a migration that placed nothing CLEARS the stale positional keys rather than
|
|
11363
|
+
// leaving them addressing whatever now sits at those positions.
|
|
11364
|
+
refTreeGroups.set(id,next);
|
|
11365
|
+
// Worded here, because `ifcTypeWords` and "No storey recorded" are this page's vocabulary — the module
|
|
11366
|
+
// matches on the file's raw tokens and deliberately knows nothing about how a header reads.
|
|
11367
|
+
const g=RS.groupsFact(lost.map((k)=>(k.storey||'No storey recorded')
|
|
11368
|
+
+(k.type===undefined?'':' · '+(ifcTypeWords(k.type)||'No type recorded'))));
|
|
11369
|
+
if(g)facts.push(g);
|
|
11370
|
+
}else{
|
|
11371
|
+
// THE MODULE IS ABSENT AND THE GROUPS CANNOT BE RE-KEYED. Reported rather than skipped: they were
|
|
11372
|
+
// cleared before the read, so this is a real loss, and a missing script is exactly when a feature
|
|
11373
|
+
// that promises never to drop state silently must not start doing so. (Review.)
|
|
11374
|
+
console.error('[reference] reference-session.js did not load — the tree state of',id,'could not be carried');
|
|
11375
|
+
if(snap.keys.some((k)=>k.val&&k.val.open))facts.push('the groups you had open');
|
|
11376
|
+
}
|
|
11377
|
+
if(snap.hadMeasure)facts.push('your measurement');
|
|
11378
|
+
return facts;
|
|
11379
|
+
}
|
|
11380
|
+
|
|
11381
|
+
/**
|
|
11382
|
+
* The one sentence, in the voice each path can honestly use. `null` means say nothing — and mean it.
|
|
11383
|
+
*
|
|
11384
|
+
* IT COMPOSES WITHOUT THE MODULE IF IT HAS TO. `reference-session.js` is one 404, one CSP rule or one
|
|
11385
|
+
* future syntax error away from being absent, and returning `null` there would throw away facts that
|
|
11386
|
+
* were computed without it — leaving the geometry replaced and the user told nothing, which is the exact
|
|
11387
|
+
* behaviour this feature exists to end. The fallback is a worse sentence, not no sentence. (Review.)
|
|
11388
|
+
*/
|
|
11389
|
+
const CARRYOVER_TAIL_FALLBACK={reload:'into the re-read file',version:'from the version you had'};
|
|
11390
|
+
/**
|
|
11391
|
+
* Did the drilled-into object survive this read? Same rule as the module's, usable without it.
|
|
11392
|
+
*
|
|
11393
|
+
* An id that is absent says nothing and an id that repeats cannot say which object you were on, so only
|
|
11394
|
+
* an id appearing EXACTLY once counts — the rule `revalidateSubSelection` applies one layer down. The
|
|
11395
|
+
* in-page arm exists for the same reason the sentence has one: a missing module must not silently turn
|
|
11396
|
+
* "your object is gone" into "everything carried".
|
|
11397
|
+
*/
|
|
11398
|
+
function refObjectSurvives(gid,objects){
|
|
11399
|
+
const RS=window.ReferenceSession;
|
|
11400
|
+
if(RS)return RS.objectSurvives(gid,objects);
|
|
11401
|
+
if(gid===null||gid===undefined||gid==='')return false;
|
|
11402
|
+
let seen=0;
|
|
11403
|
+
for(const o of objects||[]){if(o&&o.globalId===gid&&++seen>1)return false;}
|
|
11404
|
+
return seen===1;
|
|
11405
|
+
}
|
|
11406
|
+
function refCarryoverSentence(facts,path){
|
|
11407
|
+
const RS=window.ReferenceSession;
|
|
11408
|
+
if(RS)return RS.carryoverSentence(facts,RS.CARRYOVER_TAIL[path]);
|
|
11409
|
+
const list=(facts||[]).filter(Boolean);
|
|
11410
|
+
if(!list.length)return null;
|
|
11411
|
+
const words=list.length===1?list[0]:list.slice(0,-1).join(', ')+' and '+list[list.length-1];
|
|
11412
|
+
return (list.length===1?'One thing didn’t carry over ':'A few things didn’t carry over ')
|
|
11413
|
+
+CARRYOVER_TAIL_FALLBACK[path]+': '+words+'.';
|
|
11414
|
+
}
|
|
11415
|
+
|
|
11416
|
+
/**
|
|
11417
|
+
* Say it, on the reload path, where there is no panel to hang it on.
|
|
11418
|
+
*
|
|
11419
|
+
* A TOAST, AND DELIBERATELY NOT A STICKY ONE. `sticky` has no dismiss control — it is cleared only by
|
|
11420
|
+
* the next plain toast (:7802) — and a reload has no guaranteed follow-up, so it would strand a bar with
|
|
11421
|
+
* nothing to take it down. The timer is stretched per fact instead: a three-clause sentence is not
|
|
11422
|
+
* readable in the 2.6 s a one-line confirmation needs.
|
|
11423
|
+
*/
|
|
11424
|
+
function refSessionSay(id,facts){
|
|
11425
|
+
const s=refCarryoverSentence(facts,'reload');
|
|
11426
|
+
if(!s)return;
|
|
11427
|
+
const r=refById(id);
|
|
11428
|
+
// NAMED, unlike the version panel's copy of this sentence — that one sits under a header already saying
|
|
11429
|
+
// which reference and which version this is, and this one sits under nothing at all.
|
|
11430
|
+
toast((r&&r.name?'“'+r.name+'” — ':'')+s,false,TOAST_MS+1400*(facts.length-1));
|
|
11431
|
+
}
|
|
11432
|
+
|
|
10840
11433
|
/** One `name: value` row. The FOUR value states are rendered differently ON PURPOSE — see the CSS. */
|
|
10841
11434
|
function buildPropRow(prop){
|
|
10842
11435
|
const row=document.createElement('div');row.className='psrow';
|
|
@@ -11514,19 +12107,66 @@ function openRefRowMenu(r,anchorEl){closeRefRowMenu();
|
|
|
11514
12107
|
// (`refMoveToOrigin` keeps its own refusal: it is reachable from the panel's advisory offer, and a
|
|
11515
12108
|
// guard that only exists in the caller is one refactor from being gone.)
|
|
11516
12109
|
if(nativeModelBounds())m.append(mk(REF_MOVE_LABEL,()=>refMoveToOrigin(r.id)));
|
|
11517
|
-
|
|
12110
|
+
// THE NEXT FILE THE PROJECT SENDS (#734). Above reload deliberately: a version swap is the stronger form
|
|
12111
|
+
// of the same act, and it is the one a user reaches for far more often. Its refusal is reload's own,
|
|
12112
|
+
// verbatim — the schema says the lock freezes a re-read, and this is a re-read that also rewrites the
|
|
12113
|
+
// history. Kept as a refusal rather than an omission for the reason the item below keeps its: unlocking
|
|
12114
|
+
// is something the user can do from the panel two clicks away, so the sentence names a remedy they have.
|
|
12115
|
+
m.append(mk('Load a new version…',()=>{
|
|
12116
|
+
if(refDisp(r).locked){toast('“'+r.name+'” is locked — unlock it to load a new version');return;}
|
|
12117
|
+
if(!window.openRefVersion){toast('The reference panel isn’t ready yet — try again in a moment');return;}
|
|
12118
|
+
window.openRefVersion(r);}));
|
|
12119
|
+
m.append(mk('Reload its geometry',async()=>{
|
|
11518
12120
|
if(refDisp(r).locked){toast('“'+r.name+'” is locked — unlock it to reload it');return;} // the lock freezes reload, as the schema says
|
|
11519
|
-
//
|
|
11520
|
-
//
|
|
11521
|
-
//
|
|
11522
|
-
//
|
|
12121
|
+
// ALREADY BEING READ — REFUSE BEFORE DESTROYING ANYTHING. `loadReferenceGeometry` returns
|
|
12122
|
+
// immediately when a load for this id is in flight, so a second click on a big file (the menu
|
|
12123
|
+
// stays live while the row reads "loading…") would clear the tree state, start nothing, find
|
|
12124
|
+
// no geometry to re-key onto, and say nothing at all. Said out loud rather than made a no-op,
|
|
12125
|
+
// because the user asked for something. (Review.)
|
|
12126
|
+
if(refLoading.has(r.id)){toast('“'+r.name+'” is already being re-read — this will finish on its own');return;}
|
|
12127
|
+
// WHAT THIS RE-READ WOULD OTHERWISE DESTROY, taken while the old objects are still here (#734
|
|
12128
|
+
// Phase 5). The drilled-into object and the tree's open groups both carry identity the new read
|
|
12129
|
+
// can be matched on, so they are migrated below rather than dropped.
|
|
12130
|
+
const snap=refSessionSnapshot(r.id);
|
|
12131
|
+
// A MEASUREMENT OF THIS REFERENCE DOES NOT SURVIVE ITS GEOMETRY BEING RE-READ, and unlike the
|
|
12132
|
+
// other two it cannot be migrated. `refMeasureKept` stores raw world points and no object
|
|
12133
|
+
// identity at all, and a reload is not a comparison — nothing here classifies an object as
|
|
12134
|
+
// unchanged, so "keep it if both ends landed on something that did not move" is not merely hard
|
|
12135
|
+
// to evaluate, it is undefined. Keeping the dashed segment and its number against a fresh
|
|
12136
|
+
// tessellation would present a wrong dimension as a measured one, so it goes — and the report
|
|
12137
|
+
// below SAYS it went, which is the half that was missing.
|
|
11523
12138
|
refMeasureDropFor(r.id);
|
|
11524
12139
|
refGeom.delete(r.id);refFailed.delete(r.id);refEmpty.delete(r.id);refUnresolved.delete(r.id);
|
|
11525
|
-
// The tree's group keys are POSITIONAL ('2:1' is the second storey's second type), so a
|
|
11526
|
-
//
|
|
11527
|
-
//
|
|
11528
|
-
|
|
11529
|
-
|
|
12140
|
+
// The tree's group keys are POSITIONAL ('2:1' is the second storey's second type), so a re-read
|
|
12141
|
+
// that adds, drops or reorders anything makes them address different groups. Cleared here and
|
|
12142
|
+
// re-derived from the snapshot's storey/type LABELS once the new objects land — the identity
|
|
12143
|
+
// the file itself supplies, which position is only this read's rendering of.
|
|
12144
|
+
refTreeGroups.delete(r.id);
|
|
12145
|
+
// THE FILTER TEXT STAYS. Nothing about a re-read invalidates the words the user typed, and
|
|
12146
|
+
// dropping it would silently disarm the migration above: a group choice records the query it
|
|
12147
|
+
// was made under and applies only when that query returns, so clearing the box would leave
|
|
12148
|
+
// every migrated choice inert. The two are one piece of state and they move together.
|
|
12149
|
+
// THE REPORT RUNS IN A `finally`, and that is the whole point of the shape. This handler's
|
|
12150
|
+
// promise is dropped by the menu's click listener and the page installs no
|
|
12151
|
+
// `unhandledrejection` handler, so a throw anywhere inside the read — its own `finally` calls
|
|
12152
|
+
// `pushReferences`, `renderRefsTab` and `panel`, none of them guarded — would abort the
|
|
12153
|
+
// migration and the sentence together, leaving the geometry destroyed and the user told
|
|
12154
|
+
// nothing. That is the exact failure this feature exists to prevent, arriving through the one
|
|
12155
|
+
// door the feature itself opened. (Review.)
|
|
12156
|
+
let carried=[];
|
|
12157
|
+
try{
|
|
12158
|
+
await loadReferenceGeometry(r.id,{rebuild:true});
|
|
12159
|
+
}finally{
|
|
12160
|
+
try{carried=refSessionMigrate(r.id,snap);}
|
|
12161
|
+
catch(e){console.error('[reference] could not carry the session across the re-read of',r.id,e);
|
|
12162
|
+
carried=['what you had open in this reference'];}
|
|
12163
|
+
// It has already painted the tab once, from inside its own `finally`, with the group state
|
|
12164
|
+
// cleared — so the migrated keys need a repaint of their own to be seen.
|
|
12165
|
+
// Guarded on the tab, like every other repaint site: the user can switch legend tabs during a
|
|
12166
|
+
// read, and rebuilding a hidden subtree is work nobody sees.
|
|
12167
|
+
try{if(legendTab==='refs')renderRefsTab();}catch(e){console.error('[reference] the repaint after re-reading',r.id,'failed',e);}
|
|
12168
|
+
refSessionSay(r.id,carried);
|
|
12169
|
+
}}));
|
|
11530
12170
|
m.appendChild(document.createElement('hr'));
|
|
11531
12171
|
m.appendChild(mk('Remove',()=>refRemove(r),true));
|
|
11532
12172
|
document.body.appendChild(m);
|
|
@@ -11574,6 +12214,11 @@ async function refRemove(r){
|
|
|
11574
12214
|
*/
|
|
11575
12215
|
function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverEtag=etag;restampDraftBase(prev,etag);conflicted=false;}
|
|
11576
12216
|
|
|
12217
|
+
// The upload size limit, mirroring MAX_BYTES in server/reference-import.ts (pinned by the parity test,
|
|
12218
|
+
// which finds it by a line-anchored `const RI_MAX_BYTES = …`). AT FILE SCOPE rather than inside the
|
|
12219
|
+
// import modal's block because TWO modals now refuse the same file: adding a reference, and loading a new
|
|
12220
|
+
// version of one. A second copy under a second name would be a mirror the parity test does not watch.
|
|
12221
|
+
const RI_MAX_BYTES=150*1024*1024;
|
|
11577
12222
|
// ── The import modal: drop → probe → confirm ──────────────────────────────────────────────────────
|
|
11578
12223
|
{ const ri$=id=>document.getElementById(id);
|
|
11579
12224
|
// `riProbeCentre` is reset alongside the rest on every open — it used to survive from the PREVIOUS
|
|
@@ -11633,7 +12278,6 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
11633
12278
|
riStop();riClearSoft();ri$('refImportModal').style.display='none';
|
|
11634
12279
|
}
|
|
11635
12280
|
|
|
11636
|
-
const RI_MAX_BYTES=150*1024*1024; // mirrors MAX_BYTES in server/reference-import.ts (pinned by the parity test)
|
|
11637
12281
|
// Mirrors MAX_OBJECTS / WARN_OBJECTS in server/reference-import.ts (pinned by the same parity test).
|
|
11638
12282
|
// MIRRORED rather than fetched because the picker re-judges the total on every checkbox: a round
|
|
11639
12283
|
// trip per tick is not a control. The SERVER still owns the decision — it refuses the insert on its
|
|
@@ -12102,6 +12746,1024 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
12102
12746
|
ri$('riDrop').addEventListener('drop',e=>{const f=e.dataTransfer&&e.dataTransfer.files&&e.dataTransfer.files[0];riReadFile(f);});
|
|
12103
12747
|
}
|
|
12104
12748
|
|
|
12749
|
+
// ── Load a new version of a reference, and say what changed (#734, design §7.3) ─────────────────────
|
|
12750
|
+
//
|
|
12751
|
+
// THIS BLOCK RENDERS AN ANSWER IT DOES NOT COMPUTE. AWARE matches the two files' objects — on IFC
|
|
12752
|
+
// GlobalId and nothing else — `server/reference-compare.ts` validates the response, and
|
|
12753
|
+
// `web/reference-changes.js` holds the pure decisions (which counts, how a status reads, where the cap
|
|
12754
|
+
// falls, the refusal's words). Everything here is the DOM for what those return. floless never parses IFC
|
|
12755
|
+
// and never compares geometry (CLAUDE.md).
|
|
12756
|
+
//
|
|
12757
|
+
// THE REFUSAL IS NOT AN ERROR STATE. When no ids pair, "everything added and everything removed" is the
|
|
12758
|
+
// symptom of an exporter that regenerated every id, so AWARE returns no `changes` array at all and the
|
|
12759
|
+
// server relays a typed refusal. That is a correct, complete answer about two files that do not relate —
|
|
12760
|
+
// so it is drawn in neutral tokens, never red, and THERE IS NO "COMPARE ANYWAY": with no geometry
|
|
12761
|
+
// fallback the button could only produce the fabricated list the refusal exists to prevent.
|
|
12762
|
+
{
|
|
12763
|
+
const rv$=id=>document.getElementById(id);
|
|
12764
|
+
/** The pure core, read LAZILY — it is an ES module surfaced on `window` by a deferred shim (:1572), so
|
|
12765
|
+
* it does not exist yet while this classic script is being evaluated. Same shape as `GC()`.
|
|
12766
|
+
* CITED BY SYMBOL, not by line: find it as `window.ReferenceChanges=RC`. Every line number this
|
|
12767
|
+
* feature wrote had drifted by 20-150 lines inside the very commit that wrote it. */
|
|
12768
|
+
const RC=()=>window.ReferenceChanges||null;
|
|
12769
|
+
|
|
12770
|
+
let rvRef=null; // the reference a version is being loaded for
|
|
12771
|
+
let rvSha=null,rvName='',rvSoftT=null,rvBusy=false,rvRun=0,rvAbort=null;
|
|
12772
|
+
/**
|
|
12773
|
+
* Has the user closed this modal while its read was still running?
|
|
12774
|
+
*
|
|
12775
|
+
* THE ANSWER STILL HAS TO REACH THEM. Closing mid-run is a BACKGROUNDING action here — the route
|
|
12776
|
+
* detaches from the client deliberately, so the upload finishes and commits either way — and without
|
|
12777
|
+
* this flag every outcome was painted into a hidden panel and lost: a refusal rendered into an
|
|
12778
|
+
* invisible `#rvRefuseStage` with no toast, and a SUCCESS painted the change list, the entire point of
|
|
12779
|
+
* the feature, somewhere nobody could see. Reopening then reset to the dropzone, so it was
|
|
12780
|
+
* unreachable. The import modal solves the same problem with `riBackgrounded` and this is its sibling.
|
|
12781
|
+
*/
|
|
12782
|
+
let rvBackgrounded=false;
|
|
12783
|
+
/** The version this upload was compared against — see `rcPreviousVersionId`. */
|
|
12784
|
+
let rvComparedAgainst=null;
|
|
12785
|
+
/** `undefined` keeps the reference's own filter (the default), `null` is an explicit unfiltered read,
|
|
12786
|
+
* an object is a filter the user picked in the §6.3 remedy. The three are three different requests —
|
|
12787
|
+
* see the route's own note on the body field. */
|
|
12788
|
+
let rvFilterChoice;
|
|
12789
|
+
let rvStageNow='drop';
|
|
12790
|
+
|
|
12791
|
+
const rvStop=()=>{rvRun++;if(rvAbort){try{rvAbort.abort();}catch(_){/* already settled */}rvAbort=null;}};
|
|
12792
|
+
const rvClearSoft=()=>{if(rvSoftT){clearTimeout(rvSoftT);rvSoftT=null;}};
|
|
12793
|
+
const rvErr=msg=>{const e=rv$('rvDropErr');if(msg){e.textContent=msg;e.style.display='block';}else{e.style.display='none';e.textContent='';}};
|
|
12794
|
+
/** An honest "still working", never a fake percentage — the import modal's own choice (decision I). */
|
|
12795
|
+
const rvProg=(label,soft)=>{rvClearSoft();rv$('rvProgTxt').textContent=label;
|
|
12796
|
+
if(soft)rvSoftT=setTimeout(()=>{rv$('rvProgTxt').textContent=soft;},6000);};
|
|
12797
|
+
|
|
12798
|
+
function rvStage(s){ // 'drop' | 'prog' | 'refuse' | 'result'
|
|
12799
|
+
rvStageNow=s;
|
|
12800
|
+
// The answer floats over a LIVE canvas; the three stages before it hold the screen. See the CSS.
|
|
12801
|
+
rv$('refVersionModal').classList.toggle('rvfloat',s==='result');
|
|
12802
|
+
rv$('rvDropStage').style.display=s==='drop'?'':'none';
|
|
12803
|
+
rv$('rvProgStage').style.display=s==='prog'?'':'none';
|
|
12804
|
+
rv$('rvRefuseStage').style.display=s==='refuse'?'':'none';
|
|
12805
|
+
rv$('rvResultStage').style.display=s==='result'?'':'none';
|
|
12806
|
+
// THE FOOT IS HIDDEN ON THE REFUSAL, because that state draws its OWN weighted actions and one of
|
|
12807
|
+
// them is Cancel. Two Cancels, one of them the quiet default, is the shape the import modal removed
|
|
12808
|
+
// from its backdrop for exactly this reason.
|
|
12809
|
+
rv$('rvFoot').style.display=s==='refuse'?'none':'';
|
|
12810
|
+
rv$('rvCancel').style.display=s==='result'?'none':'';
|
|
12811
|
+
rv$('rvDone').style.display=s==='result'?'':'none';
|
|
12812
|
+
rv$('rvClose').style.display=s==='prog'?'none':''; // mid-run, Cancel owns the exit
|
|
12813
|
+
rv$('rvProgNote').style.display='none';
|
|
12814
|
+
rv$('rvTitle').textContent=s==='prog'?'Reading the files'
|
|
12815
|
+
:s==='result'?'What changed'
|
|
12816
|
+
:s==='refuse'?'These files could not be compared'
|
|
12817
|
+
:'Load a new version';
|
|
12818
|
+
}
|
|
12819
|
+
|
|
12820
|
+
/** The version the client believes is current. `null` — a reference with no chain — is the MAIN path. */
|
|
12821
|
+
const rvCurrentVersionId=r=>{const v=Array.isArray(r&&r.versions)?r.versions:[];return v.length?(v[v.length-1].id||null):null;};
|
|
12822
|
+
|
|
12823
|
+
function openRefVersion(r){
|
|
12824
|
+
if(!r)return;
|
|
12825
|
+
if(rvBusy){rv$('refVersionModal').style.display='flex';return;}
|
|
12826
|
+
rvStop();rvClearSoft();
|
|
12827
|
+
rvRef=r;rvSha=null;rvName='';rvFilterChoice=undefined;rvErr('');
|
|
12828
|
+
rv$('rvDrop').classList.remove('drag');
|
|
12829
|
+
const sub=rv$('rvSubject');sub.replaceChildren();
|
|
12830
|
+
const b=document.createElement('b');b.textContent='“'+r.name+'”';
|
|
12831
|
+
const versions=Array.isArray(r.versions)?r.versions.length:0;
|
|
12832
|
+
sub.append(b,document.createTextNode(versions>1
|
|
12833
|
+
? ' is on version '+versions+'. Drop the next one and FloLess will tell you what moved.'
|
|
12834
|
+
: ' keeps its place, its colours and the part of the file it was loaded with. Drop the next version and FloLess will tell you what moved.'));
|
|
12835
|
+
rvStage('drop');rv$('refVersionModal').style.display='flex';
|
|
12836
|
+
}
|
|
12837
|
+
window.openRefVersion=openRefVersion;
|
|
12838
|
+
|
|
12839
|
+
function rvClose(){
|
|
12840
|
+
// Mid-run this is a BACKGROUNDING action for the same reason the import's is: the route detaches from
|
|
12841
|
+
// the client deliberately, so an accepted upload finishes and commits whether this modal is on screen
|
|
12842
|
+
// or not. Cancelling it here would only hide the answer.
|
|
12843
|
+
if(rvBusy&&rvStageNow==='prog'){
|
|
12844
|
+
rvBackgrounded=true;rvClearSoft();rv$('refVersionModal').style.display='none';
|
|
12845
|
+
toast('FloLess will keep reading the new version in the background.');return;
|
|
12846
|
+
}
|
|
12847
|
+
rvStop();rvClearSoft();rv$('refVersionModal').style.display='none';
|
|
12848
|
+
// THE GHOSTS GO WITH THE PANEL THAT EXPLAINS THEM. They are an annotation on a change list; left on
|
|
12849
|
+
// the canvas after it closes they are unexplained red shapes inside somebody else's building, and
|
|
12850
|
+
// nothing on screen would say they are objects that no longer exist.
|
|
12851
|
+
rcGhostReset();
|
|
12852
|
+
}
|
|
12853
|
+
|
|
12854
|
+
function rvReadFile(f){
|
|
12855
|
+
if(!f||rvBusy)return;rvErr('');
|
|
12856
|
+
if(!/\.(ifc|ifczip)$/i.test(f.name||'')){rvErr('Not an IFC file — expected .ifc or .ifczip.');return;}
|
|
12857
|
+
if(f.size>RI_MAX_BYTES){rvErr('“'+f.name+'” is '+fileSizeWords(f.size)+'; the limit for a reference model is 150 MB. Try exporting just the part of the model you need to see.');return;}
|
|
12858
|
+
rvName=f.name;
|
|
12859
|
+
const fr=new FileReader();
|
|
12860
|
+
const mine=rvRun; // the read is async, so it is part of THIS attempt — a cancelled 66 MB file must not go on to probe
|
|
12861
|
+
fr.onerror=()=>{if(mine!==rvRun)return;rvStage('drop');rvErr('Could not read that file.');};
|
|
12862
|
+
fr.onload=()=>{if(mine!==rvRun)return;rvProbe(String(fr.result||''),f,mine);};
|
|
12863
|
+
rvStage('prog');rvProg('Reading “'+f.name+'”…');
|
|
12864
|
+
fr.readAsDataURL(f);
|
|
12865
|
+
}
|
|
12866
|
+
|
|
12867
|
+
/**
|
|
12868
|
+
* Probe first, for the SHA — the version route takes a file that is already uploaded.
|
|
12869
|
+
*
|
|
12870
|
+
* The object-count gate is NOT re-implemented here. The route probes again and refuses with
|
|
12871
|
+
* `reference-too-many-objects` before it pays for the comparison, so a second copy of those limits in
|
|
12872
|
+
* this block would be a mirror nothing watches — the size gate the plan asks for is the server's, and
|
|
12873
|
+
* its refusal gets its own state below.
|
|
12874
|
+
*/
|
|
12875
|
+
async function rvProbe(dataUrl,f,mine){
|
|
12876
|
+
rvProg('Checking what “'+f.name+'” says about itself…','Still checking — a large model takes a moment.');
|
|
12877
|
+
rvAbort=new AbortController();
|
|
12878
|
+
try{
|
|
12879
|
+
const res=await fetch(refApi('/probe'),{method:'POST',signal:rvAbort.signal,headers:{'content-type':'application/json'},
|
|
12880
|
+
body:JSON.stringify({dataUrl,name:f.name})});
|
|
12881
|
+
const d=await res.json().catch(()=>({}));
|
|
12882
|
+
if(mine!==rvRun)return;
|
|
12883
|
+
rvClearSoft();
|
|
12884
|
+
if(!res.ok||!d.ok){rvStage('drop');rvErr(d.error||'Could not read that file.');return;}
|
|
12885
|
+
rvSha=d.sha;
|
|
12886
|
+
rvSubmit(mine);
|
|
12887
|
+
}catch(e){
|
|
12888
|
+
if(mine!==rvRun||(e&&e.name==='AbortError'))return;
|
|
12889
|
+
rvClearSoft();rvStage('drop');rvErr('Could not reach the reader — check the app is running.');
|
|
12890
|
+
}finally{if(mine===rvRun)rvAbort=null;}
|
|
12891
|
+
}
|
|
12892
|
+
|
|
12893
|
+
/**
|
|
12894
|
+
* Ask for the new version, and with it the comparison.
|
|
12895
|
+
*
|
|
12896
|
+
* `expectedVersionId` IS REQUIRED AND `null` IS THE MAIN PATH — every reference that predates this
|
|
12897
|
+
* feature is chainless, and omitting the key entirely is a 400 rather than a shorthand for null.
|
|
12898
|
+
*
|
|
12899
|
+
* The FILTER is sent by ABSENCE by default: "keep the part of the file this reference was loaded with".
|
|
12900
|
+
* That is the one thing it must never be inferred as "the whole file", so the key is spread in only
|
|
12901
|
+
* when the user has explicitly chosen something in the §6.3 remedy.
|
|
12902
|
+
*
|
|
12903
|
+
* NO `progressId`. The route supports drawing the new geometry as it arrives, and the import flow uses
|
|
12904
|
+
* it — but there the canvas is empty, and here the PREVIOUS version is still on screen underneath. Two
|
|
12905
|
+
* buildings overlaid, one of them provisional, is a worse answer than an honest spinner.
|
|
12906
|
+
*/
|
|
12907
|
+
async function rvSubmit(mine){
|
|
12908
|
+
if(!rvSha||!rvRef)return;
|
|
12909
|
+
const r=rvRef;
|
|
12910
|
+
if(mine===undefined){mine=++rvRun;} // a retry from a refusal state is a NEW attempt
|
|
12911
|
+
rvBusy=true;rvBackgrounded=false;rcCarried=[]; // a new run never inherits the last one's carryover sentence
|
|
12912
|
+
// HELD FOR THE PANEL, not just sent: this is the version the ghosts will be read from, and knowing
|
|
12913
|
+
// it beats inferring it from the chain's array order afterwards. See `rcPreviousVersionId`.
|
|
12914
|
+
rvComparedAgainst=rvCurrentVersionId(r);
|
|
12915
|
+
rvStage('prog');rv$('rvProgNote').style.display='block';
|
|
12916
|
+
rvProg('Comparing “'+rvName+'” with the version you have…',
|
|
12917
|
+
'AWARE is reading both files and matching their objects. Whole-building models can take several minutes.');
|
|
12918
|
+
rvAbort=new AbortController();
|
|
12919
|
+
let mid=null,d=null;
|
|
12920
|
+
try{
|
|
12921
|
+
mid=newMutationId();claimMutation(mid);
|
|
12922
|
+
const res=await fetch(refApi('/'+encodeURIComponent(r.id)+'/version'),{
|
|
12923
|
+
method:'POST',signal:rvAbort.signal,
|
|
12924
|
+
headers:{'content-type':'application/json','x-floless-mutation-id':mid},
|
|
12925
|
+
body:JSON.stringify({sha:rvSha,name:rvName,expectedVersionId:rvComparedAgainst,
|
|
12926
|
+
...(rvFilterChoice===undefined?{}:{filter:rvFilterChoice})}),
|
|
12927
|
+
});
|
|
12928
|
+
d=await res.json().catch(()=>({}));
|
|
12929
|
+
if(mine!==rvRun){
|
|
12930
|
+
// Gone while this was in flight. The write may still have landed, and suppressing our own echo is
|
|
12931
|
+
// precisely what would leave a committed version invisible in the editor — so the claim is
|
|
12932
|
+
// released and the broadcast reconciles instead. (The import route's own reasoning, verbatim.)
|
|
12933
|
+
releaseMutation(mid);return;
|
|
12934
|
+
}
|
|
12935
|
+
rvClearSoft();
|
|
12936
|
+
// RELEASED ON THE REFUSAL, because a refused write produces no broadcast at all — `claimMutation`'s
|
|
12937
|
+
// own contract says an unreleased id "would otherwise sit in the list forever, where the only
|
|
12938
|
+
// thing it can do is wrongly suppress somebody else's event", and the list is a bounded ring, so a
|
|
12939
|
+
// leaked id also evicts a legitimately-claimed one early. Every refusal here is a NO-WRITE: the
|
|
12940
|
+
// route refuses before the copy for a comparison refusal and inside the lock for a stale version.
|
|
12941
|
+
// (Codex review.)
|
|
12942
|
+
if(!res.ok||!d.ok){
|
|
12943
|
+
releaseMutation(mid);
|
|
12944
|
+
// A REFUSAL PAINTED INTO A HIDDEN PANEL IS A REFUSAL NOBODY READ. Backgrounded, the modal is
|
|
12945
|
+
// display:none — so the state below would render perfectly and silently. Say it out loud and
|
|
12946
|
+
// bring the panel back, which is where its remedies live (choose another file, load unfiltered).
|
|
12947
|
+
if(rvBackgrounded){
|
|
12948
|
+
toast('Could not load a new version of “'+r.name+'” — '+((d&&d.error)||'the comparison could not be made.'));
|
|
12949
|
+
rv$('refVersionModal').style.display='flex';rvBackgrounded=false;
|
|
12950
|
+
}
|
|
12951
|
+
rvRefusal(d,res.status);return;
|
|
12952
|
+
}
|
|
12953
|
+
}catch(e){
|
|
12954
|
+
if(mine!==rvRun||(e&&e.name==='AbortError')){if(mid)releaseMutation(mid);return;}
|
|
12955
|
+
// A THROWN request tells us nothing about whether the write landed, which is exactly why the claim
|
|
12956
|
+
// must go: suppressing our own echo is what would leave a committed version invisible here.
|
|
12957
|
+
if(mid)releaseMutation(mid);
|
|
12958
|
+
rvClearSoft();rvStage('drop');rvErr('Could not load a new version — check the app is running.');
|
|
12959
|
+
console.error('[reference] version upload failed',e);return;
|
|
12960
|
+
}finally{if(mine===rvRun){rvBusy=false;rvAbort=null;}}
|
|
12961
|
+
// ── PAST THE POINT OF NO RETURN. Everything above is the transaction; everything below is showing it,
|
|
12962
|
+
// and they are deliberately not one try — a throw in the presentation half must not report a failure
|
|
12963
|
+
// for a version that is committed on disk. (The import route learned this the expensive way.)
|
|
12964
|
+
try{
|
|
12965
|
+
adoptReferenceWrite(d.etag);
|
|
12966
|
+
const i=refList().findIndex(x=>x&&x.id===r.id);
|
|
12967
|
+
// REMOVED WHILE THIS WAS IN FLIGHT — and a backgrounded upload makes that a whole minute wide.
|
|
12968
|
+
// `refRemove` drops the entry locally and neither cancels this run nor invalidates it (the route
|
|
12969
|
+
// detaches from the client on purpose, so the version really does commit). Without this guard the
|
|
12970
|
+
// presentation half then RESURRECTS it: pushing geometry for an entry that no longer exists,
|
|
12971
|
+
// re-showing the modal, and painting a change list about a reference the user has just deleted.
|
|
12972
|
+
// The write itself is already on disk and the broadcast reconciles it; what must not happen is
|
|
12973
|
+
// this tab asserting the reference is back. (Codex, re-review of the backgrounding fix.)
|
|
12974
|
+
if(i<0){
|
|
12975
|
+
rvBackgrounded=false;
|
|
12976
|
+
console.warn('[reference] a new version landed for',r.id,'after it was removed — not resurrecting it');
|
|
12977
|
+
toast('“'+r.name+'” was removed while its new version was loading, so there is nothing to show.');
|
|
12978
|
+
return;
|
|
12979
|
+
}
|
|
12980
|
+
C.reference_models[i]=d.reference;
|
|
12981
|
+
rvRef=d.reference;
|
|
12982
|
+
// TAKEN BEFORE THE NEW OBJECTS REPLACE THE OLD ONES — `refGeom.set` on the next line is the moment
|
|
12983
|
+
// the labels this resolves against stop existing (#734 Phase 5).
|
|
12984
|
+
const snap=refSessionSnapshot(r.id);
|
|
12985
|
+
refGeom.set(r.id,refGeomFrom(d));
|
|
12986
|
+
refFailed.delete(r.id);refEmpty.delete(r.id);refUnresolved.delete(r.id);
|
|
12987
|
+
// THE SAME THREE, HANDLED THE SAME WAY as `Reload its geometry` — the drilled-into object and the
|
|
12988
|
+
// tree's open groups migrate on identity, the measurement cannot and is dropped, and whatever could
|
|
12989
|
+
// not be carried is said out loud. The reasoning for each lives at that menu item; this is the same
|
|
12990
|
+
// act on a different file, so it must not be a different answer.
|
|
12991
|
+
refMeasureDropFor(r.id);
|
|
12992
|
+
// `refTreeQuery` is NOT cleared with it, here for the same reason as there: the filter text is the
|
|
12993
|
+
// user's own and a new file does not invalidate it, and clearing it would quietly disarm the
|
|
12994
|
+
// migration — a group choice records the query it was made under and applies only when that query
|
|
12995
|
+
// returns, so an emptied box leaves every carried choice inert.
|
|
12996
|
+
refTreeGroups.delete(r.id);
|
|
12997
|
+
// `pushReferences()` FIRST, `renderRefsTab()` AFTER, and the migration strictly between them. The
|
|
12998
|
+
// first is what runs the 3D layer's object migration, so asking "did the drilled object survive"
|
|
12999
|
+
// any earlier asks before anything has tried to save it; the last is what paints the tree, so
|
|
13000
|
+
// migrating after it would paint the old positions and leave the restored ones unshown.
|
|
13001
|
+
pushReferences();
|
|
13002
|
+
// ISOLATED, so a throw in the migration still leaves the catch below something honest to say. It is
|
|
13003
|
+
// the one statement here whose failure would otherwise be indistinguishable from "nothing was lost".
|
|
13004
|
+
try{rcCarried=refSessionMigrate(r.id,snap);}
|
|
13005
|
+
catch(e){console.error('[reference] could not carry the session onto the new version of',r.id,e);
|
|
13006
|
+
rcCarried=['what you had open in this reference'];}
|
|
13007
|
+
renderRefsTab();panel();
|
|
13008
|
+
// THE ANSWER COMES BACK ON SCREEN if the user closed the modal while it ran. The change list IS
|
|
13009
|
+
// the feature — painting it into a hidden panel and leaving it there loses the whole result, and
|
|
13010
|
+
// reopening from the ⋯ menu starts a NEW upload at the dropzone rather than showing this one.
|
|
13011
|
+
if(rvBackgrounded){rv$('refVersionModal').style.display='flex';rvBackgrounded=false;toast('“'+r.name+'” has a new version — here is what changed.');}
|
|
13012
|
+
rcShow(d);
|
|
13013
|
+
}catch(e){
|
|
13014
|
+
console.error('[reference] the new version landed, but the panel could not be drawn',e);
|
|
13015
|
+
// THE SENTENCE SURVIVES THE PANEL. `#rcIssues` is never painted on this path, so the carryover has
|
|
13016
|
+
// no other way out — and the geometry really was replaced, which makes dropping it here the one
|
|
13017
|
+
// remaining way this feature could take the user's session without a word. Same treatment as the
|
|
13018
|
+
// no-comparison branch above, which is the same reasoning applied to its sibling. (Review.)
|
|
13019
|
+
const lost=refCarryoverSentence(rcCarried,'version');
|
|
13020
|
+
rvClose();toast('Loaded a new version of “'+r.name+'” — reload the view to see what changed'+(lost?' — '+lost:''),false,lost?TOAST_MS+1400:undefined);
|
|
13021
|
+
}
|
|
13022
|
+
}
|
|
13023
|
+
|
|
13024
|
+
// ── The refusals. EACH CODE GETS ITS OWN STATE, because they are distinct on purpose: one says the two
|
|
13025
|
+
// files do not relate, one says somebody else moved the reference on, one says a storey was renamed and
|
|
13026
|
+
// hands back the new file's own breakdown so a new filter can be picked from it. Collapsing them into
|
|
13027
|
+
// "could not load" would throw away the remedy each one carries. ──────────────────────────────────────
|
|
13028
|
+
const rvActBtn=(label,weight,fn)=>{
|
|
13029
|
+
const b=document.createElement('button');b.type='button';b.textContent=label;
|
|
13030
|
+
if(weight==='ghost')b.className='ghost';
|
|
13031
|
+
else if(weight==='primary')b.className='rvprimary';
|
|
13032
|
+
b.addEventListener('click',fn);
|
|
13033
|
+
return b;
|
|
13034
|
+
};
|
|
13035
|
+
const RV_ACT={
|
|
13036
|
+
cancel:()=>rvClose(),
|
|
13037
|
+
otherfile:()=>{rvStop();rvSha=null;rvFilterChoice=undefined;rvErr('');rvStage('drop');},
|
|
13038
|
+
separate:()=>rvLoadSeparately(),
|
|
13039
|
+
unfiltered:()=>{rvFilterChoice=null;rvSubmit();},
|
|
13040
|
+
reload:()=>location.reload(),
|
|
13041
|
+
};
|
|
13042
|
+
|
|
13043
|
+
function rvRefusal(d,status){
|
|
13044
|
+
const host=rv$('rvRefuseStage');host.replaceChildren();
|
|
13045
|
+
const code=d&&d.code;
|
|
13046
|
+
const core=RC();
|
|
13047
|
+
const lead=document.createElement('div');lead.className='rflead';
|
|
13048
|
+
const acts=document.createElement('div');acts.className='rfacts';
|
|
13049
|
+
let actions=[{id:'cancel',label:'Cancel',weight:'ghost'}];
|
|
13050
|
+
|
|
13051
|
+
if(code==='reference-compare-refused'&&core){
|
|
13052
|
+
// THE WORDS ARE THE CORE'S, built from the numbers AWARE actually reported — never assembled here,
|
|
13053
|
+
// where a missing count would become a fabricated zero inside the one answer whose whole job is to
|
|
13054
|
+
// be honest about what could not be established.
|
|
13055
|
+
const copy=core.refusalCopy(d.refused,rvRef&&rvRef.name);
|
|
13056
|
+
lead.textContent=copy.lead;
|
|
13057
|
+
const why=document.createElement('div');why.className='rfwhy';why.textContent=copy.why;
|
|
13058
|
+
host.append(lead,why);
|
|
13059
|
+
actions=core.REFUSAL_ACTIONS; // three weighted ways out, quietest to loudest. THERE IS NO FOURTH.
|
|
13060
|
+
}else{
|
|
13061
|
+
lead.textContent=(d&&d.error)||'Could not load a new version of this reference.';
|
|
13062
|
+
host.appendChild(lead);
|
|
13063
|
+
if(code==='reference-filter-unmatched'){
|
|
13064
|
+
actions=[{id:'cancel',label:'Cancel',weight:'ghost'},
|
|
13065
|
+
{id:'otherfile',label:'Choose a different file',weight:'secondary'},
|
|
13066
|
+
{id:'unfiltered',label:'Load the whole file',weight:'primary'}];
|
|
13067
|
+
if(Array.isArray(d.unmatched)&&d.unmatched.length){
|
|
13068
|
+
const ul=document.createElement('ul');ul.className='rflist';
|
|
13069
|
+
for(const u of d.unmatched)ul.appendChild(Object.assign(document.createElement('li'),{textContent:String(u)}));
|
|
13070
|
+
host.appendChild(ul);
|
|
13071
|
+
}
|
|
13072
|
+
// …and the third remedy, which needs something to pick FROM: the new file's own breakdown, which
|
|
13073
|
+
// is why the route carries `probe` on this refusal and on no other.
|
|
13074
|
+
if(d.probe)host.appendChild(rvBuildRemedyPicker(d.probe));
|
|
13075
|
+
}else if(code==='reference-compare-base-unmatched'){
|
|
13076
|
+
actions=[{id:'cancel',label:'Cancel',weight:'ghost'},{id:'separate',label:'Load it as a separate reference instead',weight:'primary'}];
|
|
13077
|
+
}else if(code==='reference-version-stale'){
|
|
13078
|
+
actions=[{id:'cancel',label:'Cancel',weight:'ghost'},{id:'reload',label:'Reload the project',weight:'primary'}];
|
|
13079
|
+
}else if(code==='reference-too-many-objects'){
|
|
13080
|
+
actions=[{id:'cancel',label:'Cancel',weight:'ghost'},{id:'otherfile',label:'Choose a different file',weight:'secondary'}];
|
|
13081
|
+
}
|
|
13082
|
+
// Everything else — locked, mirror-diverged, versions-ambiguous, unresolved, filter-unreadable,
|
|
13083
|
+
// reader-too-old, and any refusal a later server adds — keeps Cancel alone. Each of those is fixed
|
|
13084
|
+
// somewhere other than this modal, and the sentence already says where; an action that cannot help
|
|
13085
|
+
// is worse than none. `status` is logged rather than shown: the code is what a user can act on.
|
|
13086
|
+
if(!code)console.warn('[reference] a version refusal arrived with no code',status,d&&d.error);
|
|
13087
|
+
}
|
|
13088
|
+
for(const a of actions)acts.appendChild(rvActBtn(a.label,a.weight,RV_ACT[a.id]||RV_ACT.cancel));
|
|
13089
|
+
host.appendChild(acts);
|
|
13090
|
+
rvStage('refuse');
|
|
13091
|
+
}
|
|
13092
|
+
|
|
13093
|
+
/**
|
|
13094
|
+
* The §6.3 remedy: pick a new filter out of the NEW file's own storeys and types.
|
|
13095
|
+
*
|
|
13096
|
+
* Everything starts UNCHECKED — this is not the import modal's "narrow the whole file down", it is "the
|
|
13097
|
+
* names you had are gone, choose the ones that replaced them". Starting all-checked would look like the
|
|
13098
|
+
* whole file and make the primary "Load the whole file" button the same act as this one.
|
|
13099
|
+
*/
|
|
13100
|
+
function rvBuildRemedyPicker(probe){
|
|
13101
|
+
const wrap=document.createElement('div');wrap.className='rfpick';
|
|
13102
|
+
const pick={storeys:new Set(),ifcTypes:new Set()};
|
|
13103
|
+
// ENABLED AND REFUSING, NOT DISABLED. A disabled button dispatches no pointer events in Chrome, so
|
|
13104
|
+
// the shared `data-tip` handler — which is `pointerover` delegation — can never fire on one: the
|
|
13105
|
+
// sentence explaining why it is disabled is the one sentence the user cannot reach. That is the same
|
|
13106
|
+
// empty-state defect the "engage UX design on every UI change" rule was granted for. So the button
|
|
13107
|
+
// stays live and says what is missing when it is pressed. (Review.)
|
|
13108
|
+
const apply=rvActBtn('Load only what I pick','secondary',()=>{
|
|
13109
|
+
if(!pick.storeys.size&&!pick.ifcTypes.size){
|
|
13110
|
+
const e=rv$('rvDropErr');e.textContent='Tick at least one storey or type first.';e.style.display='block';
|
|
13111
|
+
return;
|
|
13112
|
+
}
|
|
13113
|
+
rvFilterChoice={...(pick.storeys.size?{storeys:[...pick.storeys]}:{}),...(pick.ifcTypes.size?{ifcTypes:[...pick.ifcTypes]}:{})};
|
|
13114
|
+
rvSubmit();
|
|
13115
|
+
});
|
|
13116
|
+
const repaintApply=()=>{
|
|
13117
|
+
const n=pick.storeys.size+pick.ifcTypes.size;
|
|
13118
|
+
apply.dataset.tip=n?'Read the new version under just these':'Tick at least one storey or type first';
|
|
13119
|
+
};
|
|
13120
|
+
const axis=(label,rows,set)=>{
|
|
13121
|
+
// The reader skips objects with no storey, so a null-named row is not something a filter can pick —
|
|
13122
|
+
// the import picker says the same thing about the same rows.
|
|
13123
|
+
const usable=(rows||[]).filter(x=>x&&x.name!==null);
|
|
13124
|
+
if(!usable.length)return;
|
|
13125
|
+
const h=document.createElement('div');h.className='cat-hdr';
|
|
13126
|
+
h.append(Object.assign(document.createElement('span'),{className:'cat-label',textContent:label}),
|
|
13127
|
+
Object.assign(document.createElement('span'),{className:'cat-count',textContent:'('+usable.length+' in this file)'}));
|
|
13128
|
+
wrap.appendChild(h);
|
|
13129
|
+
const box=document.createElement('div');box.className='reftree';
|
|
13130
|
+
for(const row of usable){
|
|
13131
|
+
const l=document.createElement('label');l.className='ripick-row';
|
|
13132
|
+
const cb=document.createElement('input');cb.type='checkbox';
|
|
13133
|
+
cb.addEventListener('change',()=>{cb.checked?set.add(row.name):set.delete(row.name);repaintApply();});
|
|
13134
|
+
l.append(cb,Object.assign(document.createElement('span'),{className:'rpname',textContent:row.name}),
|
|
13135
|
+
Object.assign(document.createElement('span'),{className:'rpcount',textContent:Number(row.elements||0).toLocaleString()}));
|
|
13136
|
+
box.appendChild(l);
|
|
13137
|
+
}
|
|
13138
|
+
wrap.appendChild(box);
|
|
13139
|
+
};
|
|
13140
|
+
axis('Storeys in the new file',probe.storeys,pick.storeys);
|
|
13141
|
+
axis('Types in the new file',probe.ifcTypes||probe.types,pick.ifcTypes);
|
|
13142
|
+
if(!wrap.childElementCount)return document.createComment('the new file offers no storeys or types to pick from');
|
|
13143
|
+
repaintApply();
|
|
13144
|
+
const row=document.createElement('div');row.className='rfacts';row.appendChild(apply);
|
|
13145
|
+
wrap.appendChild(row);
|
|
13146
|
+
return wrap;
|
|
13147
|
+
}
|
|
13148
|
+
|
|
13149
|
+
/**
|
|
13150
|
+
* "Load it as a separate reference instead" — the honest remedy, and it must not cost the upload again.
|
|
13151
|
+
*
|
|
13152
|
+
* The bytes are already on the server under `rvSha`, so this is the ordinary insert with no filter: two
|
|
13153
|
+
* versions loaded side by side is a workflow that works today, and it is what a user actually wants when
|
|
13154
|
+
* the automatic answer is unavailable. The commit half mirrors `riInsert`'s presentation block rather
|
|
13155
|
+
* than calling it — that block is inside the import modal's own scope, and reaching into it would couple
|
|
13156
|
+
* two modals through a shared mutable stage machine.
|
|
13157
|
+
*/
|
|
13158
|
+
async function rvLoadSeparately(){
|
|
13159
|
+
if(!rvSha||rvBusy)return;
|
|
13160
|
+
const mine=++rvRun;rvBusy=true;
|
|
13161
|
+
rvStage('prog');rv$('rvProgNote').style.display='block';
|
|
13162
|
+
rvProg('Adding “'+rvName+'” as its own reference…','AWARE is tessellating objects and preparing the viewer file.');
|
|
13163
|
+
rvAbort=new AbortController();
|
|
13164
|
+
let d=null,mid=null;
|
|
13165
|
+
try{
|
|
13166
|
+
mid=newMutationId();claimMutation(mid);
|
|
13167
|
+
const res=await fetch(refApi(''),{method:'POST',signal:rvAbort.signal,
|
|
13168
|
+
headers:{'content-type':'application/json','x-floless-mutation-id':mid},
|
|
13169
|
+
body:JSON.stringify({sha:rvSha,name:rvName})});
|
|
13170
|
+
d=await res.json().catch(()=>({}));
|
|
13171
|
+
if(mine!==rvRun){releaseMutation(mid);return;}
|
|
13172
|
+
rvClearSoft();
|
|
13173
|
+
if(!res.ok||!d.ok){releaseMutation(mid);rvStage('drop');rvErr(d.error||'Could not add that reference.');return;}
|
|
13174
|
+
}catch(e){
|
|
13175
|
+
if(mine!==rvRun||(e&&e.name==='AbortError')){if(mid)releaseMutation(mid);return;}
|
|
13176
|
+
if(mid)releaseMutation(mid);
|
|
13177
|
+
rvClearSoft();rvStage('drop');rvErr('Could not add that reference.');
|
|
13178
|
+
console.error('[reference] separate insert failed',e);return;
|
|
13179
|
+
}finally{if(mine===rvRun){rvBusy=false;rvAbort=null;}}
|
|
13180
|
+
rvClose();
|
|
13181
|
+
try{
|
|
13182
|
+
adoptReferenceWrite(d.etag);
|
|
13183
|
+
if(!Array.isArray(C.reference_models))C.reference_models=[];
|
|
13184
|
+
C.reference_models.push(d.reference);
|
|
13185
|
+
refGeom.set(d.reference.id,refGeomFrom(d));
|
|
13186
|
+
refSelectedId=d.reference.id;refMeasureFollowSelection();refSelectedObjIdx=null;
|
|
13187
|
+
pushReferences();setLegendTab('refs');showLegendPanel('refs',true);
|
|
13188
|
+
if(window.Steel3DView&&window.Steel3DView.frameReference)window.Steel3DView.frameReference(d.reference.id);
|
|
13189
|
+
renderRefsTab();
|
|
13190
|
+
toast('Added “'+d.reference.name+'” as a separate reference');
|
|
13191
|
+
}catch(e){
|
|
13192
|
+
console.error('[reference] added, but the view could not be updated',e);
|
|
13193
|
+
toast('Added “'+rvName+'” — reload the view to see it');
|
|
13194
|
+
}
|
|
13195
|
+
}
|
|
13196
|
+
|
|
13197
|
+
// ── The change list ────────────────────────────────────────────────────────────────────────────────
|
|
13198
|
+
let rcData=null; // {refId, changes, summary, criteria, selected, version, versions}
|
|
13199
|
+
let rcQuery='';
|
|
13200
|
+
let rcGroups=new Map(); // group key -> open?
|
|
13201
|
+
let rcSel=null; // the GlobalId of the row that is selected, or null
|
|
13202
|
+
// What THIS load could not carry over from the session (#734 Phase 5) — fact phrases, empty when
|
|
13203
|
+
// everything migrated. Filled once, immediately before `rcShow`, because it is computed from state that
|
|
13204
|
+
// no longer exists by the time the panel paints; cleared at the top of every run so a second comparison
|
|
13205
|
+
// can never inherit the first one's sentence.
|
|
13206
|
+
let rcCarried=[];
|
|
13207
|
+
|
|
13208
|
+
function rcShow(d){
|
|
13209
|
+
const c=d&&d.comparison;
|
|
13210
|
+
if(!c){
|
|
13211
|
+
// A success with no comparison is a server we do not understand. Saying so beats drawing an empty
|
|
13212
|
+
// list, which would read as "nothing changed".
|
|
13213
|
+
console.error('[reference] the new version arrived without a comparison');
|
|
13214
|
+
// THE CARRYOVER SENTENCE GOES WITH IT, appended rather than fired as a second toast — this branch
|
|
13215
|
+
// never paints `#rcIssues`, so the sentence has no other way out, and the geometry really was
|
|
13216
|
+
// replaced. Losing it here would be the one path on which this feature drops the user's session
|
|
13217
|
+
// silently, which is the single thing it exists to prevent. One toast, because two would replace
|
|
13218
|
+
// each other in the same slot.
|
|
13219
|
+
const lost=refCarryoverSentence(rcCarried,'version');
|
|
13220
|
+
rvClose();toast('Loaded a new version of “'+(rvRef&&rvRef.name||'this reference')+'”, but FloLess could not read what changed'+(lost?' — '+lost:''),false,lost?TOAST_MS+1400:undefined);return;
|
|
13221
|
+
}
|
|
13222
|
+
rcData={refId:(rvRef&&rvRef.id)||null,name:(d.version&&d.version.name)||rvName,
|
|
13223
|
+
// WHAT THIS COMPARISON WAS ACTUALLY AGAINST, captured from the request rather than re-derived —
|
|
13224
|
+
// see `rcPreviousVersionId`. Null on a chainless reference, which is the one case that falls back.
|
|
13225
|
+
comparedAgainst:rvComparedAgainst,
|
|
13226
|
+
changes:Array.isArray(c.changes)?c.changes:[],summary:c.summary,criteria:c.criteria||[],
|
|
13227
|
+
selected:c.selected||null,identity:c.identity||null,
|
|
13228
|
+
version:d.version||null,versions:Array.isArray(d.versions)?d.versions:[]};
|
|
13229
|
+
rcQuery='';rcGroups=new Map();rcSel=null;
|
|
13230
|
+
// A NEW COMPARISON OWNS A NEW SET OF GHOSTS. Left standing, the previous one's deletions would be
|
|
13231
|
+
// drawn beside a list that no longer mentions them — geometry asserting something nothing says.
|
|
13232
|
+
rcGhostReset();
|
|
13233
|
+
rcPaintHead();rcPaintIssues();rcPaintControls();rcPaintList();rcPaintUncomparable();rcPaintFoot();
|
|
13234
|
+
rvStage('result');
|
|
13235
|
+
rv$('rvBody').scrollTop=0;
|
|
13236
|
+
}
|
|
13237
|
+
|
|
13238
|
+
/**
|
|
13239
|
+
* The header: what this is, then FIVE counts as chips of equal weight.
|
|
13240
|
+
*
|
|
13241
|
+
* EVERY COUNT APPEARS, `uncomparable` included, and including the zeroes. A zero that is drawn is a fact
|
|
13242
|
+
* ("nothing was uncomparable"); a zero that is hidden is indistinguishable from a question nobody asked.
|
|
13243
|
+
*/
|
|
13244
|
+
function rcPaintHead(){
|
|
13245
|
+
const head=rv$('rcHead');head.replaceChildren();
|
|
13246
|
+
const core=RC();if(!core||!rcData)return;
|
|
13247
|
+
const sub=document.createElement('div');sub.className='rcsubject';
|
|
13248
|
+
const b=document.createElement('b');b.textContent='“'+rcData.name+'”';
|
|
13249
|
+
const n=rcData.versions.length;
|
|
13250
|
+
const when=rcData.version&&rcData.version.importedAt?new Date(rcData.version.importedAt):null;
|
|
13251
|
+
sub.append(b,document.createTextNode(
|
|
13252
|
+
(n?' — version '+n:'')+(when&&!isNaN(when)?', imported '+when.toLocaleDateString():'')
|
|
13253
|
+
+'. Compared with the version you had, matching each object by the id its file gives it.'));
|
|
13254
|
+
head.appendChild(sub);
|
|
13255
|
+
const stats=document.createElement('div');stats.id='rcStats';
|
|
13256
|
+
stats.setAttribute('role','list');stats.setAttribute('aria-label','What changed, in numbers');
|
|
13257
|
+
for(const s of core.summaryStats(rcData.summary)){
|
|
13258
|
+
// The MODIFIER off the core's own class string, so the header chips and the row badges take their
|
|
13259
|
+
// colour from one decision. `unchanged` lands on `rc-plain` and recedes, which is its whole job.
|
|
13260
|
+
const mod=String(core.STATUS[s.key].cls).split(/\s+/).pop();
|
|
13261
|
+
const chip=document.createElement('span');chip.className='rcstat '+mod;chip.setAttribute('role','listitem');
|
|
13262
|
+
chip.dataset.key=s.key;
|
|
13263
|
+
if(s.glyph)chip.appendChild(Object.assign(document.createElement('span'),{className:'rcg',textContent:s.glyph}));
|
|
13264
|
+
chip.appendChild(Object.assign(document.createElement('span'),{className:'rcn',textContent:s.text}));
|
|
13265
|
+
chip.appendChild(Object.assign(document.createElement('span'),{className:'rcw',textContent:s.word}));
|
|
13266
|
+
// WHY `unchanged` HAS NO ROWS, said on the chip rather than left as a silence. AWARE is never asked
|
|
13267
|
+
// for them (`include-unchanged` is deliberately never passed — they are ~99% of a real revision and
|
|
13268
|
+
// would be a list saying nothing happened), so they are counted and not listed. There is deliberately
|
|
13269
|
+
// no "show unchanged too" toggle: a control that can only reveal nothing is worse than no control.
|
|
13270
|
+
if(s.key==='unchanged')chip.dataset.tip='Counted, not listed — FloLess does not ask for the unchanged rows, because on a real revision they are almost all of them.';
|
|
13271
|
+
else if(s.key==='uncomparable')chip.dataset.tip='Objects whose id is blank or repeated inside their own file, so nothing could be matched to them. Never folded into “unchanged”.';
|
|
13272
|
+
stats.appendChild(chip);
|
|
13273
|
+
}
|
|
13274
|
+
head.appendChild(stats);
|
|
13275
|
+
}
|
|
13276
|
+
|
|
13277
|
+
/** The two things that need eyes, pinned near the top rather than under 12,000 rows (decision A). */
|
|
13278
|
+
function rcPaintIssues(){
|
|
13279
|
+
const host=rv$('rcIssues');host.replaceChildren();
|
|
13280
|
+
const ban=(text,actionLabel,fn,mod)=>{
|
|
13281
|
+
const d=document.createElement('div');d.className='rcban'+(mod?' '+mod:'');
|
|
13282
|
+
d.appendChild(Object.assign(document.createElement('span'),{className:'rcbantx',textContent:text}));
|
|
13283
|
+
if(actionLabel){const b=document.createElement('button');b.type='button';b.className='pilllink';b.textContent=actionLabel;
|
|
13284
|
+
b.addEventListener('click',fn);d.appendChild(b);}
|
|
13285
|
+
host.appendChild(d);
|
|
13286
|
+
};
|
|
13287
|
+
// THE TWO AMBER BANNERS ARE ABOUT THE COMPARISON, so they need its module and its data. The plain one
|
|
13288
|
+
// below is about the USER'S SESSION and needs neither — gating it on `RC()` meant a failure to load
|
|
13289
|
+
// `reference-changes.js` silently suppressed a report that has nothing to do with it. (Review.)
|
|
13290
|
+
const core=RC();
|
|
13291
|
+
if(core&&rcData){
|
|
13292
|
+
const unk=rcData.summary&&rcData.summary.uncomparable;
|
|
13293
|
+
if(unk>0){
|
|
13294
|
+
ban(unk.toLocaleString()+' object'+(unk===1?'':'s')+' could not be compared, so this list is not the whole story.',
|
|
13295
|
+
'See why',()=>{const t=rv$('rcUncomparable');if(t)try{t.scrollIntoView({block:'nearest',behavior:'smooth'});}catch(_){t.scrollIntoView();}});
|
|
13296
|
+
}
|
|
13297
|
+
// NOT LIKE FOR LIKE. A new version read under a different scope than the old one, with nothing
|
|
13298
|
+
// saying so, is design §10's "must never happen": rows would appear as added or removed because of
|
|
13299
|
+
// the FILTER rather than because the building changed.
|
|
13300
|
+
if(core.filterDiffers(rcData.selected)){
|
|
13301
|
+
ban('These two versions were read under different parts of the file, so some rows below are here because the filter changed rather than because the building did.');
|
|
13302
|
+
}
|
|
13303
|
+
}
|
|
13304
|
+
// LAST, AND PLAIN. This one is about YOUR session, not about the two files — so it reads after both
|
|
13305
|
+
// banners that mean "needs review", and in the muted tokens rather than amber. No action button: the
|
|
13306
|
+
// uncomparable banner's "See why" scrolls to a section that exists, and there is nothing here to
|
|
13307
|
+
// scroll to. Silent when everything carried, which is the ordinary case.
|
|
13308
|
+
const say=refCarryoverSentence(rcCarried,'version');
|
|
13309
|
+
if(say)ban(say,null,null,'plain');
|
|
13310
|
+
}
|
|
13311
|
+
|
|
13312
|
+
function rcPaintControls(){
|
|
13313
|
+
const host=rv$('rcControls');host.replaceChildren();
|
|
13314
|
+
if(!rcData||!rcData.changes.length){host.style.display='none';return;}
|
|
13315
|
+
host.style.display='';
|
|
13316
|
+
const inp=document.createElement('input');inp.type='text';inp.id='rcSearch';
|
|
13317
|
+
inp.placeholder='Filter by name, type or storey…';inp.autocomplete='off';
|
|
13318
|
+
inp.setAttribute('role','searchbox');inp.setAttribute('aria-label','Filter the changed objects');
|
|
13319
|
+
inp.addEventListener('keydown',e=>e.stopPropagation()); // the editor's global shortcuts must not see typing
|
|
13320
|
+
// ONLY THE LIST REPAINTS, so this input survives its own typing — the object tree has to restore its
|
|
13321
|
+
// caret by id because it rebuilds the whole tab; here there is nothing to restore.
|
|
13322
|
+
inp.addEventListener('input',()=>{rcQuery=inp.value;rcPaintList();});
|
|
13323
|
+
host.appendChild(inp);
|
|
13324
|
+
}
|
|
13325
|
+
|
|
13326
|
+
const rcMatches=(ch,q)=>{
|
|
13327
|
+
if(!q)return true;
|
|
13328
|
+
return [ch.name,ch.ifcType,ch.storey,ifcTypeWords(ch.ifcType),ch.profile,ch.material]
|
|
13329
|
+
.filter(s=>typeof s==='string').join(' ').toLowerCase().includes(q);
|
|
13330
|
+
};
|
|
13331
|
+
|
|
13332
|
+
/**
|
|
13333
|
+
* The grouped, capped list.
|
|
13334
|
+
*
|
|
13335
|
+
* ROWS ARE WHAT AWARE LISTED, which is added, removed and changed and nothing else — so the default
|
|
13336
|
+
* "needs attention" view (decision C) is what the data already is, and `needsAttention` here is the
|
|
13337
|
+
* guard that keeps it true if an unchanged row ever arrives rather than a filter with a control.
|
|
13338
|
+
*/
|
|
13339
|
+
function rcPaintList(){
|
|
13340
|
+
const host=rv$('rcList');host.replaceChildren();
|
|
13341
|
+
const core=RC();if(!core||!rcData)return;
|
|
13342
|
+
const q=rcQuery.trim().toLowerCase();
|
|
13343
|
+
const rows=rcData.changes.filter(core.needsAttention).filter(ch=>rcMatches(ch,q));
|
|
13344
|
+
if(!rcData.changes.length){
|
|
13345
|
+
// "Nothing changed" gets its OWN calm state, visually distinct from a refusal (decision J), with the
|
|
13346
|
+
// five counts still above it — "great, nothing changed" and "these could not be compared" must not
|
|
13347
|
+
// be confusable at a glance.
|
|
13348
|
+
const e=document.createElement('div');e.className='rcempty';
|
|
13349
|
+
e.appendChild(Object.assign(document.createElement('b'),{textContent:'Nothing changed'}));
|
|
13350
|
+
e.appendChild(document.createTextNode('Every object FloLess could match is where it was, the same shape, the same profile and the same material.'));
|
|
13351
|
+
host.appendChild(e);return;
|
|
13352
|
+
}
|
|
13353
|
+
if(!rows.length){
|
|
13354
|
+
host.appendChild(Object.assign(document.createElement('div'),{className:'rcempty',
|
|
13355
|
+
textContent:'Nothing matches “'+rcQuery.trim()+'”.'}));
|
|
13356
|
+
return;
|
|
13357
|
+
}
|
|
13358
|
+
const groups=groupReferenceObjects(rows);
|
|
13359
|
+
const flat=groups.length===1&&groups[0].storey===null;
|
|
13360
|
+
groups.forEach((s,si)=>{
|
|
13361
|
+
const sKey='s'+si;
|
|
13362
|
+
// A group holding something to look at opens itself; one that does not opens collapsed showing its
|
|
13363
|
+
// count (decision E) — never dump the whole building open, never hide the thing that matters either.
|
|
13364
|
+
const sOpen=rcGroups.has(sKey)?rcGroups.get(sKey)
|
|
13365
|
+
:(flat||groups.length===1||core.groupNeedsAttention(s.types.flatMap(t=>t.indices.map(i=>rows[i]))));
|
|
13366
|
+
if(!flat){
|
|
13367
|
+
const h=document.createElement('div');h.className='cat-hdr';h.setAttribute('role','button');
|
|
13368
|
+
h.setAttribute('aria-expanded',String(sOpen));
|
|
13369
|
+
h.append(Object.assign(document.createElement('span'),{className:'cat-chevron',textContent:sOpen?'▼':'▶'}),
|
|
13370
|
+
Object.assign(document.createElement('span'),{className:'cat-label',textContent:s.storey||'No storey recorded'}),
|
|
13371
|
+
Object.assign(document.createElement('span'),{className:'cat-count',textContent:'('+s.count+')'}));
|
|
13372
|
+
h.dataset.tip=(s.storey||'The file records no storey for these objects')+' — '+s.count+' changed object'+(s.count===1?'':'s');
|
|
13373
|
+
h.addEventListener('click',()=>{rcGroups.set(sKey,!sOpen);rcPaintList();});
|
|
13374
|
+
refTreeKeyOperable(h);
|
|
13375
|
+
host.appendChild(h);
|
|
13376
|
+
}
|
|
13377
|
+
if(!sOpen)return;
|
|
13378
|
+
s.types.forEach((t,ti)=>{
|
|
13379
|
+
const tKey=si+':'+ti;
|
|
13380
|
+
const tOpen=rcGroups.has(tKey)?rcGroups.get(tKey):(s.types.length===1||core.groupNeedsAttention(t.indices.map(i=>rows[i])));
|
|
13381
|
+
const h=document.createElement('div');h.className='cat-hdr'+(flat?'':' sub');h.setAttribute('role','button');
|
|
13382
|
+
h.setAttribute('aria-expanded',String(tOpen));
|
|
13383
|
+
h.append(Object.assign(document.createElement('span'),{className:'cat-chevron',textContent:tOpen?'▼':'▶'}),
|
|
13384
|
+
Object.assign(document.createElement('span'),{className:'cat-label',textContent:t.words||'No type recorded'}),
|
|
13385
|
+
Object.assign(document.createElement('span'),{className:'cat-count',textContent:'('+t.count+')'}));
|
|
13386
|
+
h.dataset.tip=(t.type||'The file records no IFC type for these objects')+' — '+t.count+' changed object'+(t.count===1?'':'s');
|
|
13387
|
+
h.addEventListener('click',()=>{rcGroups.set(tKey,!tOpen);rcPaintList();});
|
|
13388
|
+
refTreeKeyOperable(h);
|
|
13389
|
+
host.appendChild(h);
|
|
13390
|
+
if(!tOpen)return;
|
|
13391
|
+
// THE SELECTED ROW IS NEVER THE ONE THE CAP DROPS — the same centred window the object tree uses,
|
|
13392
|
+
// and `capWindow` carries the sentence that admits to the cap. A list that stops at 300 with no
|
|
13393
|
+
// explanation reads as "that is all there was".
|
|
13394
|
+
const want=rcSel?t.indices.findIndex(i=>rows[i].id===rcSel):-1;
|
|
13395
|
+
const win=core.capWindow(t.indices,want);
|
|
13396
|
+
for(const i of win.shown)host.appendChild(rcBuildRow(rows[i]));
|
|
13397
|
+
if(win.note)host.appendChild(Object.assign(document.createElement('div'),{className:'rccap',textContent:win.note}));
|
|
13398
|
+
});
|
|
13399
|
+
});
|
|
13400
|
+
// RE-ARMED ON EVERY PAINT, because this rebuilds every row — an observer holding nodes that are no
|
|
13401
|
+
// longer in the document watches nothing and reports nothing, silently.
|
|
13402
|
+
rcObserveGhosts(host);
|
|
13403
|
+
}
|
|
13404
|
+
|
|
13405
|
+
function rcBuildRow(ch){
|
|
13406
|
+
const core=RC();
|
|
13407
|
+
const row=document.createElement('div');
|
|
13408
|
+
row.className='rcrow'+(rcSel===ch.id?' sel':'');
|
|
13409
|
+
row.dataset.gid=ch.id;row.dataset.status=ch.status;
|
|
13410
|
+
row.setAttribute('role','button');row.tabIndex=0;
|
|
13411
|
+
const st=core.STATUS[ch.status]||core.STATUS.changed;
|
|
13412
|
+
// GLYPH AND WORD IN THE DOM, not only in a tooltip (decision B) — colour alone is not an encoding, and
|
|
13413
|
+
// a hover-only label is invisible to anyone not hovering.
|
|
13414
|
+
const chip=document.createElement('span');chip.className=st.cls;
|
|
13415
|
+
if(st.glyph)chip.appendChild(Object.assign(document.createElement('span'),{className:'rcg',textContent:st.glyph}));
|
|
13416
|
+
chip.appendChild(document.createTextNode(st.word));
|
|
13417
|
+
row.appendChild(chip);
|
|
13418
|
+
const named=refObjNamed(ch.name);
|
|
13419
|
+
row.appendChild(Object.assign(document.createElement('span'),{className:'rcnm',
|
|
13420
|
+
textContent:named?String(ch.name).trim():(ifcTypeWords(ch.ifcType)||'Object')}));
|
|
13421
|
+
// `changedBy` AS UP TO THREE SMALL CHIPS; `fields` is deliberately not rendered inline at all — it is
|
|
13422
|
+
// the one payload that genuinely becomes a paragraph, and it belongs in the click-through, not the row.
|
|
13423
|
+
if(Array.isArray(ch.changedBy)&&ch.changedBy.length){
|
|
13424
|
+
const by=document.createElement('span');by.className='rcby';
|
|
13425
|
+
for(const c of ch.changedBy.slice(0,3))by.appendChild(Object.assign(document.createElement('span'),{textContent:c}));
|
|
13426
|
+
if(ch.changedBy.length>3){
|
|
13427
|
+
const more=Object.assign(document.createElement('span'),{textContent:'+'+(ch.changedBy.length-3)});
|
|
13428
|
+
more.dataset.tip='Also: '+ch.changedBy.slice(3).join(', ');
|
|
13429
|
+
by.appendChild(more);
|
|
13430
|
+
}
|
|
13431
|
+
row.appendChild(by);
|
|
13432
|
+
}
|
|
13433
|
+
// The distance in words as well as numbers, and ONLY where `location` actually fired: a "0 mm" printed
|
|
13434
|
+
// against a reprofiled column would be an assertion nobody made.
|
|
13435
|
+
const moved=core.movedPhrase(ch);
|
|
13436
|
+
if(moved)row.appendChild(Object.assign(document.createElement('span'),{className:'rcmv',textContent:moved}));
|
|
13437
|
+
row.dataset.tip=(named?String(ch.name).trim():'This file gives it no name')
|
|
13438
|
+
+' — '+(ch.ifcType||'no IFC type')+(ch.storey?' · '+ch.storey:'')
|
|
13439
|
+
+(ch.profile?' · '+ch.profile:'')
|
|
13440
|
+
+' — '+st.word+(moved?', '+moved:'');
|
|
13441
|
+
row.addEventListener('click',()=>rcActivate(ch));
|
|
13442
|
+
row.addEventListener('keydown',e=>{
|
|
13443
|
+
if(e.key!=='Enter'&&e.key!==' ')return;
|
|
13444
|
+
e.preventDefault();e.stopPropagation();row.click();
|
|
13445
|
+
});
|
|
13446
|
+
return row;
|
|
13447
|
+
}
|
|
13448
|
+
|
|
13449
|
+
/** `globalId` → its index in the CURRENT version's geometry. Built per activation; the map is the only
|
|
13450
|
+
* honest bridge between a change list keyed by id and a 3D layer addressed by index. */
|
|
13451
|
+
function rcIndexOf(refId,gid){
|
|
13452
|
+
const objs=(refGeom.get(refId)||{}).objects||[];
|
|
13453
|
+
for(let i=0;i<objs.length;i++)if(objs[i]&&objs[i].globalId===gid)return i;
|
|
13454
|
+
return -1;
|
|
13455
|
+
}
|
|
13456
|
+
|
|
13457
|
+
function rcActivate(ch){
|
|
13458
|
+
if(!rcData)return;
|
|
13459
|
+
rcSel=ch.id;rcPaintList();
|
|
13460
|
+
const v=window.Steel3DView;
|
|
13461
|
+
if(!v||!v.selectReferenceObject){toast('The 3D view isn’t ready yet — try again in a moment');return;}
|
|
13462
|
+
if(ch.status==='removed'){
|
|
13463
|
+
// A REMOVED OBJECT IS NOT IN THE NEW VERSION, so there is nothing here to select — and selecting
|
|
13464
|
+
// something else instead is how a panel comes to describe an object the user did not pick.
|
|
13465
|
+
// `rcGhostFor` draws its shape from the version it vanished from and flies to that.
|
|
13466
|
+
//
|
|
13467
|
+
// THE PREVIOUS DRILL IS DROPPED, and that is the half this used to miss. Clicking a changed row
|
|
13468
|
+
// and then a removed one left the earlier object still lit in 3D while the list highlighted the
|
|
13469
|
+
// removed one — the canvas and the panel each confidently describing a DIFFERENT object. Nothing
|
|
13470
|
+
// takes its place here, because nothing can; saying "no object is selected" is the honest state.
|
|
13471
|
+
// (Found by the independent QA pass, which read `selectedReferenceObject()` and got the beam.)
|
|
13472
|
+
if(v.selectReference)v.selectReference(rcData.refId);
|
|
13473
|
+
refSelectedObjIdx=null;panel();
|
|
13474
|
+
rcGhostFor(ch);return;
|
|
13475
|
+
}
|
|
13476
|
+
const idx=rcIndexOf(rcData.refId,ch.id);
|
|
13477
|
+
if(idx<0){
|
|
13478
|
+
console.error('[reference] change row',ch.id,'has no object in the new geometry');
|
|
13479
|
+
toast('That object isn’t in the 3D scene — use ⋯ ▸ Reload its geometry');return;
|
|
13480
|
+
}
|
|
13481
|
+
let ok=false;
|
|
13482
|
+
try{ok=v.selectReferenceObject(rcData.refId,idx);}
|
|
13483
|
+
catch(e){console.error('[reference] selecting',ch.id,'threw',e);toast('Could not select that object');return;}
|
|
13484
|
+
if(!ok){toast('That object isn’t in the 3D scene — use ⋯ ▸ Reload its geometry');return;}
|
|
13485
|
+
if(v.frameReferenceObject)v.frameReferenceObject(rcData.refId,idx);
|
|
13486
|
+
// The editor's own selection state follows, so the Inspect panel and the object tree agree with the
|
|
13487
|
+
// scene rather than describing whatever was picked before.
|
|
13488
|
+
refSelectedId=rcData.refId;refSelectedObjIdx=idx;panel();
|
|
13489
|
+
}
|
|
13490
|
+
|
|
13491
|
+
// ── GHOSTS: where the removed objects used to be (design §6.4) ─────────────────────────────────────
|
|
13492
|
+
//
|
|
13493
|
+
// LAZY, AND THAT IS THE DESIGN rather than an optimisation. A revision with 3,000 deletions must not
|
|
13494
|
+
// tessellate 3,000 objects nobody scrolled to, so a row asks for its own shape when it comes into view
|
|
13495
|
+
// and never before. The server reads them out of the version they vanished FROM — the only file that
|
|
13496
|
+
// can answer where they were — by GlobalId, which every removed object is guaranteed to have.
|
|
13497
|
+
const RC_GHOST_BATCH=60; // well under the route's cap of 200; one screenful of rows is far fewer
|
|
13498
|
+
let rcGhostAsked=new Set(); // ids already requested — a row scrolled past twice is not two requests
|
|
13499
|
+
let rcGhostQueue=[],rcGhostTimer=null,rcGhostFailed=false;
|
|
13500
|
+
/** Said ONCE per panel. Distinct from `rcGhostFailed`, which is the harder question "stop asking?" —
|
|
13501
|
+
* a retriable failure still owes the user a sentence, and still must not repeat it per batch. */
|
|
13502
|
+
let rcGhostToldOnce=false;
|
|
13503
|
+
let rcGhostObserver=null;
|
|
13504
|
+
/** A ghost a click asked to fly to, held until it exists. A `setTimeout` guess would be a race. */
|
|
13505
|
+
let rcGhostFrameWanted=null;
|
|
13506
|
+
/**
|
|
13507
|
+
* THIS SET OF GHOSTS' IDENTITY — the same lesson the import modal paid for, one layer down.
|
|
13508
|
+
*
|
|
13509
|
+
* A ghost read is a whole IFC parse and can take a minute; the user can close the panel or load
|
|
13510
|
+
* another version long before it answers. Without an identity the late response draws its shapes
|
|
13511
|
+
* anyway — into a NEW group, because `rcGhostReset` cleared the old one — leaving unexplained red
|
|
13512
|
+
* geometry inside somebody else's building with no list on screen saying what it is. Cancelling is
|
|
13513
|
+
* best-effort (a response already on the wire lands regardless), so the token is what actually
|
|
13514
|
+
* decides, exactly as `riRun` does for the import. (Codex review.)
|
|
13515
|
+
*/
|
|
13516
|
+
let rcGhostRun=0;
|
|
13517
|
+
/**
|
|
13518
|
+
* EVERY in-flight ghost read, not just the newest.
|
|
13519
|
+
*
|
|
13520
|
+
* A single `rcGhostAbort` slot looked tidy and was a bug with teeth: batches legitimately overlap —
|
|
13521
|
+
* `rcGhostFor` jumps the timer while a scroll-driven batch is still running — so aborting "the
|
|
13522
|
+
* previous one" before each flush killed a request that was doing exactly what it should. Its ids had
|
|
13523
|
+
* already been spliced off the queue, and an AbortError returns before the give-up path, so those rows
|
|
13524
|
+
* were consumed, never drawn, and never re-requestable: scrolling produced no new ghosts at all. Found
|
|
13525
|
+
* by the independent QA pass, and it is the same poisoning this file fixed one round earlier, walked
|
|
13526
|
+
* back in by the fix for an orphaned controller.
|
|
13527
|
+
*
|
|
13528
|
+
* A SET, so cancelling belongs to `rcGhostReset` alone — which is the only place that genuinely means
|
|
13529
|
+
* "none of these answers are wanted any more".
|
|
13530
|
+
*/
|
|
13531
|
+
const rcGhostFlights=new Set();
|
|
13532
|
+
|
|
13533
|
+
/**
|
|
13534
|
+
* The version the removed objects belong to — the one this upload was COMPARED AGAINST.
|
|
13535
|
+
*
|
|
13536
|
+
* TAKEN FROM WHAT WE SENT, not inferred from array position. `expectedVersionId` is by definition the
|
|
13537
|
+
* version the route compared against: it is the precondition the route re-checks inside its own lock
|
|
13538
|
+
* before appending, so a comparison that succeeded compared against exactly that id. Reading
|
|
13539
|
+
* `versions[length-2]` instead is an inference about ordering, and it reads the wrong file — drawing
|
|
13540
|
+
* ghosts from the wrong version as fact — the moment anything reorders the chain. (Review.)
|
|
13541
|
+
*
|
|
13542
|
+
* THE FALLBACK IS FOR THE CHAINLESS CASE, and only that: a reference with no history sends
|
|
13543
|
+
* `expectedVersionId: null`, and the route synthesises a v1 with a server-generated id via
|
|
13544
|
+
* `adoptChain`. There, the second-from-last row IS that synthesised v1, and the position is the only
|
|
13545
|
+
* handle we have on it.
|
|
13546
|
+
*/
|
|
13547
|
+
function rcPreviousVersionId(){
|
|
13548
|
+
if(rcData&&rcData.comparedAgainst)return rcData.comparedAgainst;
|
|
13549
|
+
const v=rcData&&rcData.versions;
|
|
13550
|
+
return Array.isArray(v)&&v.length>=2?(v[v.length-2].id||null):null;
|
|
13551
|
+
}
|
|
13552
|
+
|
|
13553
|
+
/**
|
|
13554
|
+
* Ask for a batch, once the queue has settled.
|
|
13555
|
+
*
|
|
13556
|
+
* BATCHED ON A TIMER rather than per row: scrolling a list past forty removed rows would otherwise be
|
|
13557
|
+
* forty reads of the same IFC, each queueing behind the last on the one serialized reader chain.
|
|
13558
|
+
*/
|
|
13559
|
+
/**
|
|
13560
|
+
* THE WHOLE-REQUEST REFUSALS, which are the only ones worth saying once and then giving up on.
|
|
13561
|
+
*
|
|
13562
|
+
* Everything else — a 500 on one batch, a dropped connection — is about THESE ROWS, so latching the
|
|
13563
|
+
* panel dead on it would trade one bad batch for every remaining ghost. (Review: `!res.ok` alone
|
|
13564
|
+
* could not tell the two apart, and a single 500 disabled the layer for the panel's life.)
|
|
13565
|
+
*/
|
|
13566
|
+
const RC_GHOST_FATAL=new Set(['reference-ghost-file-missing','reference-ghost-version-unknown']);
|
|
13567
|
+
|
|
13568
|
+
/**
|
|
13569
|
+
* Say it, once, and put the ids back if they can still be asked for.
|
|
13570
|
+
*
|
|
13571
|
+
* ABSENT GHOSTS MUST NOT READ AS "NOTHING WAS REMOVED" — that is this layer's whole promise, and it
|
|
13572
|
+
* was being kept on exactly ONE of the paths that can produce an absent ghost. The ids are spliced
|
|
13573
|
+
* off the queue BEFORE anything can fail, and `rcGhostAsked` refuses to re-queue them, so every
|
|
13574
|
+
* silent path was also permanent: scrolling back did nothing, forever. (Review.)
|
|
13575
|
+
*/
|
|
13576
|
+
function rcGhostGaveUp(ids,fatal,message){
|
|
13577
|
+
if(!fatal)for(const id of ids)rcGhostAsked.delete(id); // retriable: a later scroll may ask again
|
|
13578
|
+
else rcGhostFailed=true;
|
|
13579
|
+
if(!rcGhostToldOnce){rcGhostToldOnce=true;toast(message);}
|
|
13580
|
+
// A CLICK IS A DIRECT REQUEST AND GETS A DIRECT ANSWER. Left set, it would sit there while the user
|
|
13581
|
+
// watched a camera that never moved.
|
|
13582
|
+
rcGhostFrameWanted=null;
|
|
13583
|
+
}
|
|
13584
|
+
|
|
13585
|
+
function rcGhostFlush(){
|
|
13586
|
+
rcGhostTimer=null;
|
|
13587
|
+
const ids=rcGhostQueue.splice(0,RC_GHOST_BATCH);
|
|
13588
|
+
if(!ids.length)return;
|
|
13589
|
+
const versionId=rcPreviousVersionId(),refId=rcData&&rcData.refId;
|
|
13590
|
+
// SPLICED ALREADY, so they go back — without this the batch is gone for good with no log and no
|
|
13591
|
+
// message, which is the same silent-drop shape as the failure paths below.
|
|
13592
|
+
if(!versionId||!refId){for(const id of ids)rcGhostAsked.delete(id);rcGhostQueue.unshift(...ids);return;}
|
|
13593
|
+
const mine=rcGhostRun;
|
|
13594
|
+
// TRACKED, NOT REPLACED. Overlapping batches are normal — a click jumps the timer while a scrolled
|
|
13595
|
+
// batch is still running — so each keeps its own controller and only `rcGhostReset` cancels them.
|
|
13596
|
+
const flight=new AbortController();
|
|
13597
|
+
rcGhostFlights.add(flight);
|
|
13598
|
+
fetch(refApi('/'+encodeURIComponent(refId)+'/ghosts'),{method:'POST',signal:flight.signal,
|
|
13599
|
+
headers:{'content-type':'application/json'},
|
|
13600
|
+
body:JSON.stringify({versionId,ids})}).then(async res=>{
|
|
13601
|
+
const d=await res.json().catch(()=>({}));
|
|
13602
|
+
// THE ANSWER IS ONLY OURS IF THIS IS STILL THE SAME SET OF GHOSTS. Checked before the refusal
|
|
13603
|
+
// branch as well as the success one: a toast about an abandoned read is as wrong as its geometry.
|
|
13604
|
+
if(mine!==rcGhostRun)return;
|
|
13605
|
+
if(!res.ok||!d.ok){
|
|
13606
|
+
rcGhostGaveUp(ids,RC_GHOST_FATAL.has(d&&d.code),
|
|
13607
|
+
(d&&d.error)||'The removed objects could not be drawn where they used to be — the list below still stands.');
|
|
13608
|
+
return;
|
|
13609
|
+
}
|
|
13610
|
+
const v=window.Steel3DView;
|
|
13611
|
+
// THE REFERENCE ITSELF MUST STILL BE THERE. A ghost read is a whole IFC parse; remove the
|
|
13612
|
+
// reference while one is in flight and `refById` returns null — and `xrefMatrix(null)` is the
|
|
13613
|
+
// IDENTITY matrix, so the ghosts would land at the world origin, in red, over the user's steel,
|
|
13614
|
+
// asserting that the deleted objects were somewhere nobody computed. (An ABSENT `placement` is a
|
|
13615
|
+
// different thing and is perfectly ordinary — identity is correct for a reference at its file
|
|
13616
|
+
// coordinates — so this guards the reference, not its placement.)
|
|
13617
|
+
const r=refById(refId);
|
|
13618
|
+
const asked=ids.length;
|
|
13619
|
+
let drew=0;
|
|
13620
|
+
if(!r){rcGhostGaveUp(ids,true,'That reference was removed, so there is nowhere to draw what it used to contain.');return;}
|
|
13621
|
+
if(v&&v.setReferenceGhosts&&Array.isArray(d.objects)&&d.objects.length){
|
|
13622
|
+
const out=v.setReferenceGhosts(refId,d.objects,r.placement||null)||{};
|
|
13623
|
+
drew=out.drawn||0;
|
|
13624
|
+
// …and fly to the one a click asked for, now that it exists. Held rather than guessed at with a
|
|
13625
|
+
// timer: the read is a whole IFC parse, and a fixed delay is a race that fails on the big files
|
|
13626
|
+
// this feature is for.
|
|
13627
|
+
if(rcGhostFrameWanted&&v.frameReferenceGhost&&v.frameReferenceGhost(rcGhostFrameWanted))rcGhostFrameWanted=null;
|
|
13628
|
+
}
|
|
13629
|
+
// WHAT WAS ASKED FOR AND WHAT ARRIVED, RECONCILED. Four different things can thin a batch — the
|
|
13630
|
+
// previous file could not resolve the id (`missing`), AWARE read it and had nothing drawable
|
|
13631
|
+
// (`dropped`, which the route sends under a comment saying exactly why it must not be swallowed),
|
|
13632
|
+
// the mesh carried no positions, or it carried no GlobalId and so could never be framed. All four
|
|
13633
|
+
// used to render as "fewer red shapes", which is indistinguishable from a smaller deletion.
|
|
13634
|
+
if(drew<asked){
|
|
13635
|
+
console.warn('[reference] drew',drew,'of',asked,'ghosts —',
|
|
13636
|
+
(Array.isArray(d.missing)?d.missing.length:0),'not in the previous file,',(d.dropped||0),'with nothing to draw');
|
|
13637
|
+
}
|
|
13638
|
+
// A CLICKED ROW THAT RESOLVED NOTHING STILL OWES AN ANSWER. Every other dead end in `rcActivate`
|
|
13639
|
+
// says something; this one used to leave the user looking at a camera that had not moved.
|
|
13640
|
+
if(rcGhostFrameWanted&&ids.indexOf(rcGhostFrameWanted)>=0){
|
|
13641
|
+
rcGhostFrameWanted=null;
|
|
13642
|
+
toast('The earlier version has no shape on file for that object, so there is nothing to show where it was.');
|
|
13643
|
+
}
|
|
13644
|
+
if(rcGhostQueue.length)rcGhostSchedule();
|
|
13645
|
+
}).finally(()=>{rcGhostFlights.delete(flight);}).catch(e=>{
|
|
13646
|
+
// An abort is this panel closing or moving on, not a failure to report.
|
|
13647
|
+
if(mine!==rcGhostRun||(e&&e.name==='AbortError'))return;
|
|
13648
|
+
// A THROWN FETCH IS THE LIKELIEST FAILURE OF ALL — the server restarted, the connection dropped —
|
|
13649
|
+
// and it used to be the one path that said nothing at all: no toast, no latch, just a console
|
|
13650
|
+
// line and a canvas with no red on it. It is also where a TypeError from the draw path lands, so
|
|
13651
|
+
// a bug in `setReferenceGhosts` was being reported to the user as "no objects were removed".
|
|
13652
|
+
console.error('[reference] ghost read failed',e);
|
|
13653
|
+
rcGhostGaveUp(ids,false,'Could not read the removed objects from the earlier version — the list below still stands.');
|
|
13654
|
+
});
|
|
13655
|
+
}
|
|
13656
|
+
function rcGhostSchedule(){if(!rcGhostTimer)rcGhostTimer=setTimeout(rcGhostFlush,120);}
|
|
13657
|
+
|
|
13658
|
+
/** Everything the ghost layer holds, dropped: the meshes, what was asked for, and what failed. */
|
|
13659
|
+
function rcGhostReset(){
|
|
13660
|
+
// THE TOKEN MOVES FIRST, before anything it protects is torn down: a response that lands during
|
|
13661
|
+
// this function must already be reading the new value.
|
|
13662
|
+
rcGhostRun++;
|
|
13663
|
+
for(const f of rcGhostFlights){try{f.abort();}catch(_){/* already settled */}}
|
|
13664
|
+
rcGhostFlights.clear();
|
|
13665
|
+
if(rcGhostTimer){clearTimeout(rcGhostTimer);rcGhostTimer=null;}
|
|
13666
|
+
if(rcGhostObserver){rcGhostObserver.disconnect();rcGhostObserver=null;}
|
|
13667
|
+
rcGhostAsked=new Set();rcGhostQueue=[];rcGhostFailed=false;rcGhostToldOnce=false;rcGhostFrameWanted=null;
|
|
13668
|
+
const v=window.Steel3DView;if(v&&v.clearReferenceGhosts)v.clearReferenceGhosts();
|
|
13669
|
+
}
|
|
13670
|
+
|
|
13671
|
+
/** Queue one removed row's ghost. Idempotent per id, which is what makes a scroll cheap. */
|
|
13672
|
+
function rcGhostWant(gid){
|
|
13673
|
+
if(!gid||rcGhostAsked.has(gid)||rcGhostFailed)return;
|
|
13674
|
+
if(!rcPreviousVersionId())return; // a first version has nothing before it to read from
|
|
13675
|
+
rcGhostAsked.add(gid);rcGhostQueue.push(gid);rcGhostSchedule();
|
|
13676
|
+
}
|
|
13677
|
+
|
|
13678
|
+
/**
|
|
13679
|
+
* WHAT "BROUGHT INTO VIEW" ACTUALLY MEANS, measured by the browser rather than guessed at.
|
|
13680
|
+
*
|
|
13681
|
+
* An IntersectionObserver against the panel's own scroll container, re-armed on every repaint because
|
|
13682
|
+
* `rcPaintList` rebuilds every row. Rows that are already on screen when the list first draws fire
|
|
13683
|
+
* immediately, which is right: they are in view.
|
|
13684
|
+
*/
|
|
13685
|
+
function rcObserveGhosts(host){
|
|
13686
|
+
if(rcGhostObserver){rcGhostObserver.disconnect();rcGhostObserver=null;}
|
|
13687
|
+
if(!rcPreviousVersionId()||typeof IntersectionObserver!=='function')return;
|
|
13688
|
+
const rows=host.querySelectorAll('.rcrow[data-status="removed"]');
|
|
13689
|
+
if(!rows.length)return;
|
|
13690
|
+
rcGhostObserver=new IntersectionObserver((entries)=>{
|
|
13691
|
+
for(const e of entries)if(e.isIntersecting){rcGhostWant(e.target.dataset.gid);rcGhostObserver.unobserve(e.target);}
|
|
13692
|
+
},{root:rv$('rvBody'),rootMargin:'120px'});
|
|
13693
|
+
for(const row of rows)rcGhostObserver.observe(row);
|
|
13694
|
+
}
|
|
13695
|
+
|
|
13696
|
+
/** A click on a removed row: there is nothing to select, so fetch its ghost and fly to it. */
|
|
13697
|
+
function rcGhostFor(ch){
|
|
13698
|
+
const v=window.Steel3DView;
|
|
13699
|
+
if(!rcPreviousVersionId()){
|
|
13700
|
+
toast('“'+(refObjNamed(ch.name)?String(ch.name).trim():'That object')+'” was removed — this reference has no earlier version on file to draw it from.');
|
|
13701
|
+
return;
|
|
13702
|
+
}
|
|
13703
|
+
if(v&&v.frameReferenceGhost&&v.frameReferenceGhost(ch.id))return;
|
|
13704
|
+
if(rcGhostFailed){
|
|
13705
|
+
toast('“'+(refObjNamed(ch.name)?String(ch.name).trim():'That object')+'” was removed, but its shape could not be read from the earlier version.');
|
|
13706
|
+
return;
|
|
13707
|
+
}
|
|
13708
|
+
// Not drawn yet. Ask for it AT THE FRONT of the queue and jump the batch timer — this one is a
|
|
13709
|
+
// direct request rather than a row drifting past, and it is framed when it lands (never on a timer).
|
|
13710
|
+
rcGhostFrameWanted=ch.id;
|
|
13711
|
+
if(!rcGhostAsked.has(ch.id)){rcGhostAsked.add(ch.id);rcGhostQueue.unshift(ch.id);}
|
|
13712
|
+
if(rcGhostTimer){clearTimeout(rcGhostTimer);rcGhostTimer=null;}
|
|
13713
|
+
rcGhostFlush();
|
|
13714
|
+
}
|
|
13715
|
+
|
|
13716
|
+
/**
|
|
13717
|
+
* WHAT COULD NOT BE COMPARED, named rather than only counted.
|
|
13718
|
+
*
|
|
13719
|
+
* An object whose GlobalId is blank, or repeated inside its own file, cannot be matched to anything: a
|
|
13720
|
+
* file where every id is `''` makes "the id matches" trivially true. Saying WHICH ones is what stops a
|
|
13721
|
+
* clean-looking list being read as a complete one.
|
|
13722
|
+
*/
|
|
13723
|
+
function rcPaintUncomparable(){
|
|
13724
|
+
const host=rv$('rcUncomparable');host.replaceChildren();
|
|
13725
|
+
const id=rcData&&rcData.identity;
|
|
13726
|
+
const total=rcData&&rcData.summary?rcData.summary.uncomparable:0;
|
|
13727
|
+
if(!total||!id){host.style.display='none';return;}
|
|
13728
|
+
host.style.display='';
|
|
13729
|
+
host.appendChild(Object.assign(document.createElement('h4'),{textContent:'What could not be compared'}));
|
|
13730
|
+
host.appendChild(Object.assign(document.createElement('div'),{className:'rcuwhy',
|
|
13731
|
+
textContent:'These objects carry no usable identity in their own file — the id is blank, or the same id is used more than once — so nothing could be matched to them either way. They are counted here and never folded into “unchanged”.'}));
|
|
13732
|
+
const rowOf=(label,value)=>{
|
|
13733
|
+
const d=document.createElement('div');d.className='rcurow';
|
|
13734
|
+
d.append(Object.assign(document.createElement('span'),{textContent:label}),
|
|
13735
|
+
Object.assign(document.createElement('span'),{className:'rcuv',textContent:Number(value||0).toLocaleString()}));
|
|
13736
|
+
host.appendChild(d);
|
|
13737
|
+
};
|
|
13738
|
+
for(const [label,sideKey] of [['In the version you had','base'],['In the new version','revised']]){
|
|
13739
|
+
const s=id[sideKey];if(!s||!s.uncomparable)continue;
|
|
13740
|
+
rowOf(label,s.uncomparable.count);
|
|
13741
|
+
if(s.uncomparable.blank)rowOf(' · no id at all',s.uncomparable.blank);
|
|
13742
|
+
if(s.uncomparable.duplicated)rowOf(' · an id used more than once',s.uncomparable.duplicated);
|
|
13743
|
+
}
|
|
13744
|
+
}
|
|
13745
|
+
|
|
13746
|
+
/** The receipt: WHICH questions were asked. Quiet, because it qualifies the list rather than being it. */
|
|
13747
|
+
function rcPaintFoot(){
|
|
13748
|
+
const note=rv$('rvFootNote');
|
|
13749
|
+
const c=rcData&&rcData.criteria;
|
|
13750
|
+
note.textContent=c&&c.length?'Compared by: '+c.join(', ')+'.':'';
|
|
13751
|
+
}
|
|
13752
|
+
|
|
13753
|
+
rv$('rvClose').onclick=rvClose;
|
|
13754
|
+
rv$('rvCancel').onclick=rvClose;
|
|
13755
|
+
rv$('rvDone').onclick=rvClose;
|
|
13756
|
+
// THE BACKDROP IS NOT AN EXIT MID-RUN — the same rule the import modal states: hiding one of two
|
|
13757
|
+
// identical exits and leaving the invisible one is the version of that rule that does not hold.
|
|
13758
|
+
rv$('rvBackdrop').onclick=()=>{if(!(rvBusy&&rvStageNow==='prog'))rvClose();};
|
|
13759
|
+
rv$('rvDrop').onclick=()=>rv$('rvFile').click();
|
|
13760
|
+
rv$('rvDrop').onkeydown=e=>{if(e.key==='Enter'||e.key===' '){e.preventDefault();rv$('rvFile').click();}};
|
|
13761
|
+
rv$('rvFile').onchange=e=>{const f=e.target.files&&e.target.files[0];e.target.value='';rvReadFile(f);};
|
|
13762
|
+
for(const ev of ['dragenter','dragover'])rv$('rvDrop').addEventListener(ev,e=>{e.preventDefault();rv$('rvDrop').classList.add('drag');});
|
|
13763
|
+
for(const ev of ['dragleave','drop'])rv$('rvDrop').addEventListener(ev,e=>{e.preventDefault();rv$('rvDrop').classList.remove('drag');});
|
|
13764
|
+
rv$('rvDrop').addEventListener('drop',e=>{const f=e.dataTransfer&&e.dataTransfer.files&&e.dataTransfer.files[0];rvReadFile(f);});
|
|
13765
|
+
}
|
|
13766
|
+
|
|
12105
13767
|
// ── Apply a favourite in-editor: arm the placement crosshair (sticky → repeat), then click a target ──────────
|
|
12106
13768
|
function armFavouriteInsert(f){if(!f)return;
|
|
12107
13769
|
if(!view3d){toast('Switch to the 3D view to place a connection');return;}
|
|
@@ -12603,33 +14265,199 @@ function wire3DBar(){if(bar3dWired||!window.Steel3DView)return;bar3dWired=true;
|
|
|
12603
14265
|
d3.setWorkPlanePrincipal(b.dataset.wpp,offIn*25.4);});
|
|
12604
14266
|
{const show=document.getElementById('m3dWpShow');show.checked=d3.workPlaneInfo().visible;show.onchange=e=>{d3.toggleWorkPlaneVisible(e.target.checked);};}
|
|
12605
14267
|
document.getElementById('m3dWpOff').addEventListener('keydown',ev=>{ev.stopPropagation();if(ev.key==='Enter'){ev.preventDefault();const xy=wpMenu.querySelector('button[data-wpp=xy]');if(xy)xy.click();}});} // Enter in the offset = apply XY (the common case); stopPropagation keeps editor shortcuts out
|
|
12606
|
-
function applyViewState(on){ // flip the toggle
|
|
12607
|
-
|
|
14268
|
+
function applyViewState(on){ // TRANSITION: flip the toggle, swap the panes, end the operation
|
|
14269
|
+
viewMode=SplitView.sanitizeMode(on===true?'3d':on===false?'2d':on);
|
|
14270
|
+
activePane=SplitView.resolveActivePane(viewMode,activePane);
|
|
14271
|
+
// Ending the current operation belongs HERE and not in reflectViewChrome: a mode change really does end
|
|
14272
|
+
// what you were doing, while a click across the divider does not.
|
|
12608
14273
|
snapOnly=null;const V=window.Steel3DView;if(V&&V.setSnapOnly)V.setSnapOnly(null);closeSnapMenu();updSnapStat(); // switching views ends the operation → any snap override reverts
|
|
12609
|
-
const
|
|
12610
|
-
|
|
12611
|
-
|
|
12612
|
-
document.
|
|
12613
|
-
|
|
12614
|
-
|
|
14274
|
+
const segs={'2d':document.getElementById('vt2d'),'3d':document.getElementById('vt3d'),split:document.getElementById('vtSplit')};
|
|
14275
|
+
for(const [m,el] of Object.entries(segs)){if(!el)continue;const on2=viewMode===m;el.classList.toggle('on',on2);el.setAttribute('aria-pressed',String(on2));}
|
|
14276
|
+
const panes=SplitView.panesShown(viewMode);
|
|
14277
|
+
document.body.classList.toggle('split-view',viewMode==='split');
|
|
14278
|
+
// BOTH HALVES MATTER. The pane wrapper drives layout — it is what a split resizes — while #stage3d's
|
|
14279
|
+
// own `display` is still the engine's authority: seven sites in steel-3d-view.js read
|
|
14280
|
+
// canvasEl.style.display to decide whether to paint labels, and show()/hide() set it.
|
|
14281
|
+
document.getElementById('pane2d').style.display=panes.two?'flex':'none';
|
|
14282
|
+
document.getElementById('pane3d').style.display=panes.three?'block':'none';
|
|
14283
|
+
document.getElementById('stage').style.display=panes.two?'':'none';
|
|
14284
|
+
document.getElementById('stage3d').style.display=panes.three?'block':'none';
|
|
14285
|
+
// closePlans() before the combo is hidden — a popover left open across the switch is hidden with its
|
|
14286
|
+
// wrapper, but would strand `aria-expanded=true` and the .open caret behind it.
|
|
14287
|
+
if(!panes.two)closePlans(false);
|
|
14288
|
+
// Clamp the ratio against THIS stage on the way in. Entering split is the moment a ratio saved at some
|
|
14289
|
+
// other width first has to hold, and nothing else on this path was checking it. (Code review.)
|
|
14290
|
+
if(viewMode==='split')applySplitRatio(splitRatio,false);
|
|
14291
|
+
reflectViewChrome(); // everything idempotent, shared with setActivePane
|
|
14292
|
+
reflectSplitAvailability(); // PURE reflection — it must never call setView.
|
|
14293
|
+
}
|
|
14294
|
+
// The IDEMPOTENT half of a view change: derive view3d/view3dShown and reflect the chrome. Split out of
|
|
14295
|
+
// applyViewState because that function is a TRANSITION (it clears the snap override, closes the snap menu
|
|
14296
|
+
// and the plan popover, and re-runs the pane show/hide), and a click across the split divider is not a
|
|
14297
|
+
// view switch — running the transition on every cross-pane pointerdown would shut a menu the user had
|
|
14298
|
+
// just opened and drop a snap override mid-operation.
|
|
14299
|
+
function reflectViewChrome(){
|
|
14300
|
+
view3d=activePane==='3d';
|
|
14301
|
+
const panes=SplitView.panesShown(viewMode),chrome=SplitView.chromeVisibility({mode:viewMode,activePane});
|
|
14302
|
+
view3dShown=panes.three;view2dShown=panes.two;
|
|
14303
|
+
document.body.classList.toggle('pane3d-shown',view3dShown);
|
|
14304
|
+
document.getElementById('zoombar').style.display=chrome.zoombar?'':'none'; // zoom slider addresses the plan canvas
|
|
12615
14305
|
// Plan switcher is 2D-only (3D shows the whole model). Hidden by `display`, not the `hidden` attribute:
|
|
12616
14306
|
// .plan-combo carries an author `display:inline-flex`, which beats the UA's [hidden] rule by ORIGIN, so
|
|
12617
|
-
// `hidden = true` would quietly do nothing here.
|
|
12618
|
-
|
|
12619
|
-
|
|
12620
|
-
document.getElementById('
|
|
12621
|
-
document.getElementById('
|
|
12622
|
-
|
|
12623
|
-
|
|
12624
|
-
|
|
12625
|
-
|
|
12626
|
-
document.getElementById('
|
|
12627
|
-
|
|
14307
|
+
// `hidden = true` would quietly do nothing here.
|
|
14308
|
+
document.getElementById('planCombo').style.display=chrome.planCombo?'':'none';
|
|
14309
|
+
document.getElementById('m3dBar').style.display=chrome.m3dChrome?'flex':'none';
|
|
14310
|
+
document.getElementById('m3dCube').style.display=chrome.m3dChrome?'block':'none';
|
|
14311
|
+
document.getElementById('m3dAxes').style.display=chrome.m3dChrome?'block':'none';
|
|
14312
|
+
// The paired Dimension controls: the ACTIVE pane's is shown, the other HIDDEN rather than disabled —
|
|
14313
|
+
// two Dimension buttons side by side with one inert is exactly the dead control the standing UX rule
|
|
14314
|
+
// exists to prevent. They are adjacent siblings carrying the same label, so the visible one lands in the
|
|
14315
|
+
// same header slot and the swap reads as "Dimension now targets this pane".
|
|
14316
|
+
const dimB=document.getElementById('dimB'),dim3d=document.getElementById('dim3dWrap');
|
|
14317
|
+
// Rescue focus BEFORE hiding: display:none on the focused element silently drops focus to <body>, which
|
|
14318
|
+
// strands a keyboard user mid-header with no visible focus ring. (UX review.)
|
|
14319
|
+
const ae=document.activeElement;
|
|
14320
|
+
if(ae&&!chrome.dim2d&&dimB&&dimB.contains(ae)&&chrome.dim3d&&dim3d){const t=dim3d.querySelector('button');if(t)t.focus();}
|
|
14321
|
+
else if(ae&&!chrome.dim3d&&dim3d&&dim3d.contains(ae)&&chrome.dim2d&&dimB)dimB.focus();
|
|
14322
|
+
dimB.style.display=chrome.dim2d?'':'none'; // 2D Dimension button — the ACTIVE pane's
|
|
14323
|
+
dim3d.style.display=chrome.dim3d?'inline-flex':'none'; // 3D Dimension cluster (moved to header) — likewise
|
|
14324
|
+
document.body.classList.toggle('v3d',chrome.v3d); // 3D-only chrome (e.g. ⋯ → Detailing → Insert detail) keys off this
|
|
14325
|
+
document.getElementById('ptrBars').classList.toggle('s3d',view3dShown); // the bars clear the world-axis TRIAD, which is drawn whenever the 3D pane is on screen; see #ptrBars.s3d
|
|
14326
|
+
if(window.Steel3DView&&window.Steel3DView.setInputActive)window.Steel3DView.setInputActive(view3d); // key ownership follows the ACTIVE pane
|
|
12628
14327
|
reflectLegendPanel(); // entering/leaving 3D honours the persisted collapsed state and keeps its launcher in sync
|
|
14328
|
+
reflectActivePane();
|
|
14329
|
+
}
|
|
14330
|
+
// A pointerdown in a pane makes it active AND still performs its action — a click that only focuses is a
|
|
14331
|
+
// click the user has to repeat. In a single mode this is a no-op: resolveActivePane forces the pane.
|
|
14332
|
+
function setActivePane(which){
|
|
14333
|
+
const next=SplitView.resolveActivePane(viewMode,which);
|
|
14334
|
+
if(next===activePane)return;
|
|
14335
|
+
onActivePaneChange(); // B6: disarm the 2D-only takeover tools BEFORE the pane changes under them
|
|
14336
|
+
activePane=next;
|
|
14337
|
+
reflectViewChrome(); // the idempotent half only — no snap reset, no menu closing
|
|
14338
|
+
panel(); // the inspector's hints are view-scoped (Add-member, Move/Copy)
|
|
14339
|
+
}
|
|
14340
|
+
function reflectActivePane(){
|
|
14341
|
+
const split=viewMode==='split';
|
|
14342
|
+
for(const [id,mine] of [['pane2d','2d'],['pane3d','3d']]){
|
|
14343
|
+
const el=document.getElementById(id);if(!el)continue;
|
|
14344
|
+
const on=split&&activePane===mine;
|
|
14345
|
+
el.classList.toggle('pane-active',on);
|
|
14346
|
+
// The 2px brand ring is the only cue a sighted user gets; aria-current is its counterpart for
|
|
14347
|
+
// assistive tech, which otherwise had no way to perceive which pane owns the tools. (Code review.)
|
|
14348
|
+
if(on)el.setAttribute('aria-current','true');else el.removeAttribute('aria-current');
|
|
14349
|
+
}
|
|
14350
|
+
}
|
|
14351
|
+
// B6, re-scoped for the split exactly as the backlog anticipated: "in a split where 2D+3D coexist there's
|
|
14352
|
+
// no switch to interrupt" — so what needs interrupting is a change of ACTIVE PANE, the same event under a
|
|
14353
|
+
// new name. The tools below take over #panel and draw pick hotspots into the 2D SVG; left armed while the
|
|
14354
|
+
// other pane holds the tools they silently resume later.
|
|
14355
|
+
//
|
|
14356
|
+
// Deliberately NOT shared with setView's own disarm block, though the plan proposed it. That block is
|
|
14357
|
+
// ASYMMETRIC — it gates the dim/dim-style/qdPick disarm on entering 3D, clears sel3dDimIds, and renders
|
|
14358
|
+
// BEFORE the Move/Copy cleanup — and collapsing the two would change 2D↔3D behaviour that the phase-2
|
|
14359
|
+
// characterization baseline does not cover. Two call sites with genuinely different orderings are worth
|
|
14360
|
+
// more than one shared function that is wrong for one of them.
|
|
14361
|
+
//
|
|
14362
|
+
// Deliberately NOT disarmed here, all cross-pane by design: Move/Copy (cmTool), Add-member (mode==='add')
|
|
14363
|
+
// and Extend/Trim/Split (geoMode — the 3D view arms it via E/S and drives it through
|
|
14364
|
+
// view3dApi.onTrimExtend/onSplit, so cancelling it would kill an active 3D trim).
|
|
14365
|
+
function onActivePaneChange(){
|
|
14366
|
+
drawDraft=null;drawPrevClear();
|
|
14367
|
+
let disarmed2d=gridMode||csaxisMode||picking;
|
|
14368
|
+
if(gridMode)setGridMode(false);
|
|
14369
|
+
if(csaxisMode){csaxisMode=false;setCsMode();}
|
|
14370
|
+
if(picking){picking=false;pickKind='profile';pickEnd=null;}
|
|
14371
|
+
if(activePane==='2d'){ // about to LEAVE 2D: these share keys with the 3D dim tool
|
|
14372
|
+
if(dimMode||dimChain||dimSplitMode){disarmed2d=true;dimMode=dimChain=dimSplitMode=false;selDimIds.clear();setDimMode();document.body.classList.remove('dimsplit');}
|
|
14373
|
+
if(dimStyleMode){disarmed2d=true;dimStyleMode=false;}
|
|
14374
|
+
if(qdPick){disarmed2d=true;qdPick=null;setQdPickCls();}
|
|
14375
|
+
}
|
|
14376
|
+
// DEFERRED past the current dispatch, unlike setView's otherwise-identical block. This runs from a
|
|
14377
|
+
// CAPTURE-phase pointerdown, so an inline render() would replace #svg's innerHTML while that very
|
|
14378
|
+
// pointerdown is still propagating: the clicked <line> is detached before #svg's own bubble-phase
|
|
14379
|
+
// handler reads e.target, every hit-test misses, and the click is swallowed. Deferring keeps the
|
|
14380
|
+
// repaint and lets the click through — setActivePane promises a click that also performs its action.
|
|
14381
|
+
// (Code review.)
|
|
14382
|
+
// setTimeout, NOT queueMicrotask: a microtask checkpoint runs between listeners of the SAME dispatch
|
|
14383
|
+
// (the JS stack empties after each one), so a microtask would still repaint before #svg's bubble handler.
|
|
14384
|
+
if(disarmed2d)setTimeout(()=>render(),0);
|
|
14385
|
+
if(cmTool){cmDraft=null;cmPrevClear();cmHudClose();}
|
|
14386
|
+
return disarmed2d;
|
|
14387
|
+
}
|
|
14388
|
+
// Reflect ONLY. Enabling/disabling the segment and showing the reason are idempotent, so this is safe to
|
|
14389
|
+
// call from applyViewState. Changing the mode from here is NOT, and two ways that bit:
|
|
14390
|
+
// · Leaving split deliberately: setView('2d') applies 2D, this ran, saw requestedMode still 'split'
|
|
14391
|
+
// (it is only updated at the END of setView) and immediately re-entered setView('split'). The outer
|
|
14392
|
+
// call then hid the renderer the nested one had just shown.
|
|
14393
|
+
// · A failed 3D open: the catch calls applyViewState('2d'), this retried the saved split against the
|
|
14394
|
+
// renderer that had just failed — synchronous recursion when there is no renderer at all.
|
|
14395
|
+
// So mode changes live in onStageResize below, which fires on a real EDGE and never from a transition.
|
|
14396
|
+
// Clamp the divider ratio against the CURRENT stage and write it to the DOM. Deliberately top-level and
|
|
14397
|
+
// not closed over inside the divider IIFE: while it lived there, the only things that could clamp were
|
|
14398
|
+
// drag / arrows / dblclick / window-resize, and the two paths that ENTER split — the boot restore and
|
|
14399
|
+
// applyViewState — wrote a raw ratio straight past MIN_PANE_PX. A 0.85 saved on a wide window then
|
|
14400
|
+
// reopened on a ~600px stage gave the 3D pane 89px, and #m3dLegend (min-width:210px at left:12px) hung
|
|
14401
|
+
// out through the pane edge — precisely the defect MIN_PANE_PX exists to prevent. It also owns
|
|
14402
|
+
// aria-valuenow, which was otherwise stale at 50 until the first drag. (Code review.)
|
|
14403
|
+
function applySplitRatio(r,save){
|
|
14404
|
+
const wrap=document.getElementById('stagewrap');if(!wrap||!SplitView)return;
|
|
14405
|
+
const res=SplitView.clampRatio(r,wrap.getBoundingClientRect().width);
|
|
14406
|
+
splitRatio=res.ratio;
|
|
14407
|
+
wrap.style.setProperty('--split-ratio',String(splitRatio));
|
|
14408
|
+
const bar=document.getElementById('splitBar');
|
|
14409
|
+
if(bar)bar.setAttribute('aria-valuenow',String(Math.round(splitRatio*100)));
|
|
14410
|
+
if(save)try{localStorage.setItem(SPLIT_RATIO_KEY,String(splitRatio));}catch(_){}
|
|
14411
|
+
}
|
|
14412
|
+
function reflectSplitAvailability(){
|
|
14413
|
+
const btn=document.getElementById('vtSplit'),why=document.getElementById('vtSplitWhy'),wrap=document.getElementById('stagewrap');
|
|
14414
|
+
if(!btn||!why||!wrap)return true;
|
|
14415
|
+
const room=SplitView.canSplit(wrap.getBoundingClientRect().width);
|
|
14416
|
+
btn.disabled=!room.ok;
|
|
14417
|
+
if(room.ok){why.hidden=true;why.textContent='';btn.removeAttribute('aria-describedby');}
|
|
14418
|
+
else{why.hidden=false;why.textContent=room.reason;btn.setAttribute('aria-describedby','vtSplitWhy');}
|
|
14419
|
+
return room.ok;
|
|
14420
|
+
}
|
|
14421
|
+
// The ONLY place a resize may change the mode, and only on a transition of availability — not on every
|
|
14422
|
+
// resize frame, and never during a mode change. `remember:false` on both: the window moved, the user did
|
|
14423
|
+
// not change their mind, so `requestedMode` survives and Split comes back when the room does.
|
|
14424
|
+
function onStageResize(){
|
|
14425
|
+
if(!SplitView)return; // a resize before boot's imports land has nothing to reflect
|
|
14426
|
+
const ok=reflectSplitAvailability(),was=splitAvailable;
|
|
14427
|
+
splitAvailable=ok;
|
|
14428
|
+
if(was===ok)return;
|
|
14429
|
+
if(!ok&&viewMode==='split')setView('2d',{remember:false});
|
|
14430
|
+
else if(ok&&viewMode!=='split'&&requestedMode==='split')setView('split',{remember:false});
|
|
14431
|
+
}
|
|
14432
|
+
window.addEventListener('resize',onStageResize);
|
|
14433
|
+
// …and on the STAGE itself, because the window is not the only thing that resizes it. Dragging the
|
|
14434
|
+
// inspector's rail or collapsing it changes #stagewrap's width and fires NO window resize event, so with
|
|
14435
|
+
// only the listener above the refusal was unactionable by the very route it prescribes: "widen the window
|
|
14436
|
+
// or collapse the Inspector" — collapse it, and nothing re-ran, so Split stayed disabled with the same
|
|
14437
|
+
// sentence. The mirror case was worse: widening the inspector could squeeze a live split below its own
|
|
14438
|
+
// minimum with no downgrade at all. Observing the element answers both. (Code review.)
|
|
14439
|
+
if(typeof ResizeObserver!=='undefined'){
|
|
14440
|
+
const wrap=document.getElementById('stagewrap');
|
|
14441
|
+
if(wrap)new ResizeObserver(()=>{onStageResize();if(viewMode==='split')applySplitRatio(splitRatio,false);}).observe(wrap);
|
|
12629
14442
|
}
|
|
12630
14443
|
let viewSeq=0; // monotonic per view switch — see the staleness check after the awaited rebuild below
|
|
12631
|
-
|
|
14444
|
+
// setView takes a MODE ('2d'|'3d'|'split'); the legacy booleans still work so existing callers do.
|
|
14445
|
+
// `mode` is what the user REQUESTED, `want` is what actually FITS — resolveMode downgrades a split the
|
|
14446
|
+
// stage cannot hold. `effects` is captured BEFORE any mutation and is the ONLY thing allowed to decide
|
|
14447
|
+
// show/hide/rebuild/fit: inferring those again from the DOM would be a second implementation of the rule
|
|
14448
|
+
// the pure module exists to own.
|
|
14449
|
+
async function setView(on,{remember=true}={}){
|
|
12632
14450
|
const seq=++viewSeq;
|
|
14451
|
+
const mode=SplitView.sanitizeMode(on===true?'3d':on===false?'2d':on); // REQUESTED
|
|
14452
|
+
const stageEl=document.getElementById('stagewrap');
|
|
14453
|
+
const resolved=SplitView.resolveMode(mode,stageEl?stageEl.getBoundingClientRect().width:0);
|
|
14454
|
+
// Toast the refusal only when the user ASKED for this switch. On the boot restore and the automatic
|
|
14455
|
+
// resize fallback (`remember:false`) the same sentence is already sitting permanently in #vtSplitWhy
|
|
14456
|
+
// beside the disabled segment, so toasting is the sentence twice for something nobody just did.
|
|
14457
|
+
if(resolved.reason&&remember)toast(resolved.reason);
|
|
14458
|
+
const want=resolved.mode; // EFFECTIVE
|
|
14459
|
+
const effects=SplitView.nextMode(viewMode,want);
|
|
14460
|
+
let failed=false; // a 3D open that threw: keep the shared tail, skip the persist
|
|
12633
14461
|
drawDraft=null;drawPrevClear(); // any view switch drops an in-progress 2D Add-member start — it's a plan-pixel point, meaningless after the switch (else a stale point finishes a member on return)
|
|
12634
14462
|
// B6: cancel the 2D-only panel-takeover / armed-pick tools on any view switch. They have no 3D counterpart, so if
|
|
12635
14463
|
// left armed they take over the panel while you're in 3D or silently resume on return to 2D (the "active command
|
|
@@ -12640,7 +14468,7 @@ async function setView(on){
|
|
|
12640
14468
|
if(gridMode)setGridMode(false); // tears down the grid panel + clears gridPick/gridLinePick + snapClear
|
|
12641
14469
|
if(csaxisMode){csaxisMode=false;setCsMode();} // drops the in-progress origin (csDraft) + the set-axes panel
|
|
12642
14470
|
if(picking){picking=false;pickKind='profile';pickEnd=null;} // an armed inspector ⌖ pick
|
|
12643
|
-
if(
|
|
14471
|
+
if(effects.show3d){
|
|
12644
14472
|
if(dimMode||dimChain||dimSplitMode){disarmed2d=true;dimMode=dimChain=dimSplitMode=false;selDimIds.clear();setDimMode();document.body.classList.remove('dimsplit');} // entering 3D disarms the 2D dim/chain/split tools so their X/Y/F/S/Esc keys don't double-fire with the 3D tool
|
|
12645
14473
|
if(dimStyleMode){disarmed2d=true;dimStyleMode=false;} // …and closes the 2D Dimension style pane (it styles the 2D overlay only)
|
|
12646
14474
|
if(qdPick){disarmed2d=true;qdPick=null;setQdPickCls();} // …and the F7 grid station pick (2D-only; a leaked pick would eat the first 3D-return click)
|
|
@@ -12653,13 +14481,13 @@ async function setView(on){
|
|
|
12653
14481
|
// the segment optimistically (see armEarlyViewToggle) — so returning here would strand the control
|
|
12654
14482
|
// claiming 3D over a 2D canvas, permanently, with nothing to correct it. The catch below already
|
|
12655
14483
|
// reverts for the same reason once the renderer exists; this branch is the path where it never did.
|
|
12656
|
-
if(!window.Steel3DView){applyViewState(
|
|
14484
|
+
if(!window.Steel3DView){applyViewState('2d');toast('3D view unavailable (renderer failed to load)');return;} // stay in 2D
|
|
12657
14485
|
try{
|
|
12658
14486
|
if(!view3dReady){window.Steel3DView.init(document.getElementById('stage3d'),view3dApi);view3dReady=true;}
|
|
12659
|
-
applyViewState(
|
|
14487
|
+
applyViewState(want);
|
|
12660
14488
|
window.Steel3DView.show();
|
|
12661
14489
|
updCS();if(typeof csSyncF3d==='function')csSyncF3d(); // reflect the (persisted) 3D local frame in the Axes chip IMMEDIATELY — before the awaited rebuild, else the chip shows a stale "Global" for the rebuild's duration (QA F14)
|
|
12662
|
-
await window.Steel3DView.rebuild(
|
|
14490
|
+
await window.Steel3DView.rebuild(effects.fit3d); // fit the camera only when the 3D pane BECOMES visible
|
|
12663
14491
|
// Nobody awaits setView — both toggle handlers and the queued-click path fire and forget — so a
|
|
12664
14492
|
// switch BACK to 2D can complete while this one is suspended on the rebuild above. Resuming would
|
|
12665
14493
|
// then reopen 3D chrome over a 2D canvas: showLegendPanel() carries no view3d guard of its own.
|
|
@@ -12669,6 +14497,7 @@ async function setView(on){
|
|
|
12669
14497
|
if(seq!==viewSeq)return;
|
|
12670
14498
|
window.Steel3DView.setSelection(selIds);
|
|
12671
14499
|
if(window.Steel3DView.setGridSelection)window.Steel3DView.setGridSelection(selGridIds); // carry the shared 2D grid selection across the rebuild; rebuild replaces the line objects/materials
|
|
14500
|
+
if(window.Steel3DView.setGridLabelPx)window.Steel3DView.setGridLabelPx(gridLabelPx); // the renderer reads the shared key at LOAD and the slider pushes live, but a size set BEFORE the module arrived reaches it through neither — so relay it here too, like every other preference in this block. Makes a 2D/3D divergence self-healing on the next switch rather than permanent.
|
|
12672
14501
|
wire3DBar();wireLegendTabs();loadSteelFavourites();build3DLegend();
|
|
12673
14502
|
// Reference models (#278). The tab exists only on the model-level contract — hidden, not disabled,
|
|
12674
14503
|
// because a tab that can never hold anything is the same dead chrome the header stats are hidden for.
|
|
@@ -12684,16 +14513,35 @@ async function setView(on){
|
|
|
12684
14513
|
// newer, healthy view back to 2D and toast about a view they had left. Same reason as the guard on
|
|
12685
14514
|
// the success path above — a staleness check on only one of the two exits is not a check.
|
|
12686
14515
|
if(seq!==viewSeq)return;
|
|
12687
|
-
applyViewState(
|
|
14516
|
+
applyViewState('2d');if(window.Steel3DView)window.Steel3DView.hide();
|
|
12688
14517
|
toast('Could not open 3D view: '+((e&&e.message)||e));
|
|
14518
|
+
// FALL THROUGH, do not return. The failure path must not persist the mode that failed — that is what
|
|
14519
|
+
// `failed` below is for — but it still needs the shared tail. An earlier revision returned here and
|
|
14520
|
+
// skipped panel(), refreshPropLabels3d() and updCS(): the success path calls updCS()/csSyncF3d()
|
|
14521
|
+
// BEFORE the awaited rebuild, so a rebuild that then threw left the Axes chip showing the 3D local
|
|
14522
|
+
// frame over a 2D canvas. (Codex review, H4.)
|
|
14523
|
+
failed=true;
|
|
12689
14524
|
}
|
|
12690
|
-
}else{if(cmTool&&window.Steel3DView&&window.Steel3DView.cmClear3d)window.Steel3DView.cmClear3d(); // 3D→2D: drop the mm-space pick the same way (tool stays armed)
|
|
12691
|
-
applyViewState(
|
|
14525
|
+
}else{if(effects.hide3d&&cmTool&&window.Steel3DView&&window.Steel3DView.cmClear3d)window.Steel3DView.cmClear3d(); // 3D→2D: drop the mm-space pick the same way (tool stays armed)
|
|
14526
|
+
applyViewState(want);
|
|
14527
|
+
// hide() is real TEARDOWN (dim tool, clip pick, insert mode, work-plane pick, frame manipulator, any
|
|
14528
|
+
// Tekla drag-out, the label hosts, the rAF loop), so it fires only when the 3D pane actually leaves.
|
|
14529
|
+
if(effects.hide3d&&window.Steel3DView)window.Steel3DView.hide();
|
|
12692
14530
|
if(disarmed2d)render();} // grid/set-axes/pick can be armed while IN 3D too (csSetB/gridEditB/pickProf carry no view3d guard, and set-axes/pick render() on arm → they suppress callouts / draw hotspots into the hidden 2D SVG). We disarmed them at the top; repaint here — now that applyViewState set view3d false — else the 2D UI comes back stale.
|
|
14531
|
+
// show2d drives a render() and NOTHING else — deliberately no fit. nextMode carries no `fit2d` (see its
|
|
14532
|
+
// doc comment): 3d→2d reveals the plan exactly as 3d→split does, so a fit here would throw away the zoom
|
|
14533
|
+
// that survives that round trip today. The 2D pane keeps its viewBox; a narrower pane just shows less.
|
|
14534
|
+
if(effects.show2d)render();
|
|
12693
14535
|
if(propPopOpen()){if(propPopPinned){dockPropPop();renderPropPop();}else closePropPop(true);} // the popup is anchored to one canvas — re-dock if pinned (renderPropPop re-syncs its "Show in this view" checkbox to the now-live view), else dismiss on the view switch
|
|
12694
14536
|
panel(); // repaint the inspector for the NOW-current view (view3d is final here): a cross-view tool stays armed but its in-progress draft was dropped above — Add-member's drawHint (:2288) and Move/Copy's cmHint are view-specific, so without this the panel keeps the stale 2D "Click 2: end" (drawDraft already null) instead of the 3D working-plane hint (and vice-versa on return)
|
|
12695
14537
|
refreshPropLabels3d();updatePropHint(); // push the label set to whichever view is now live (3D shows them; 2D hides the 3D host) + refresh the corner note
|
|
12696
14538
|
updCS();if(typeof csSyncF3d==='function')csSyncF3d(); // the Axes chip is view-scoped (2D=P.frame, 3D=frame3d) — resync it + the 3D-frame fields on every switch (applyViewState alone doesn't; Codex MAJOR 6)
|
|
14539
|
+
// `mode` is what the USER asked for. `want` is what FITS right now — resolveMode downgrades an
|
|
14540
|
+
// impossible split to '2d'. Persisting `want` is the bug: narrow the window once and the Split
|
|
14541
|
+
// preference is gone for good, with nothing on screen to say why. So the key records `mode`.
|
|
14542
|
+
// `failed` gates this, not an early return: a mode that could not open must not be persisted, or every
|
|
14543
|
+
// later reload would retry the same failing view. Re-asking is cheap; a saved broken mode is not.
|
|
14544
|
+
if(remember&&!failed){requestedMode=mode;try{localStorage.setItem(SPLIT_MODE_KEY,requestedMode);}catch(_){}}
|
|
12697
14545
|
}
|
|
12698
14546
|
// ONE entry point per direction, shared by the real buttons and by a click captured during load.
|
|
12699
14547
|
// They MUST agree about a renderer that has not arrived yet: steel-3d-view.js is a separate module
|
|
@@ -12706,13 +14554,28 @@ async function setView(on){
|
|
|
12706
14554
|
// background tab, which would stretch a counted 5 s into roughly a hundred.
|
|
12707
14555
|
let viewWantSeq=0; // any newer request supersedes an outstanding wait
|
|
12708
14556
|
function setViewBusy(on){const g=document.getElementById('viewToggle');if(g){if(on)g.setAttribute('aria-busy','true');else g.removeAttribute('aria-busy');}}
|
|
12709
|
-
|
|
14557
|
+
// Both handlers key on the MODE, not on the active pane. Keying on view3d made each a no-op in a split:
|
|
14558
|
+
// with the 2D pane active the 2D segment did nothing, with the 3D pane active the 3D segment did nothing,
|
|
14559
|
+
// and split became a trap you could not leave by the control that got you into it.
|
|
14560
|
+
function requestView2d(){viewWantSeq++;setViewBusy(false);if(viewMode!=='2d')setView('2d');}
|
|
12710
14561
|
function requestView3d(){
|
|
12711
14562
|
const want=++viewWantSeq,deadline=Date.now()+5000;
|
|
12712
14563
|
const tick=()=>{
|
|
12713
14564
|
if(want!==viewWantSeq)return; // superseded — a later click won
|
|
12714
|
-
if(
|
|
12715
|
-
if(window.Steel3DView||Date.now()>=deadline){setViewBusy(false);setView(
|
|
14565
|
+
if(viewMode==='3d'){setViewBusy(false);return;}
|
|
14566
|
+
if(window.Steel3DView||Date.now()>=deadline){setViewBusy(false);setView('3d');return;} // past the bound, setView gives its honest refusal
|
|
14567
|
+
setTimeout(tick,50);
|
|
14568
|
+
};
|
|
14569
|
+
tick();
|
|
14570
|
+
}
|
|
14571
|
+
// Split needs the renderer exactly as 3D does, so it waits on the same deadline rather than refusing
|
|
14572
|
+
// instantly — see requestView3d's comment above for why an instant refusal is the worse failure.
|
|
14573
|
+
function requestViewSplit(){
|
|
14574
|
+
const want=++viewWantSeq,deadline=Date.now()+5000;
|
|
14575
|
+
const tick=()=>{
|
|
14576
|
+
if(want!==viewWantSeq)return;
|
|
14577
|
+
if(viewMode==='split'){setViewBusy(false);return;}
|
|
14578
|
+
if(window.Steel3DView||Date.now()>=deadline){setViewBusy(false);setView('split');return;}
|
|
12716
14579
|
setTimeout(tick,50);
|
|
12717
14580
|
};
|
|
12718
14581
|
tick();
|
|
@@ -12722,6 +14585,18 @@ function requestView3d(){
|
|
|
12722
14585
|
// switch — silently doing the opposite of the last thing the user asked for.
|
|
12723
14586
|
document.getElementById('vt2d').onclick=()=>{pendingView=null;requestView2d();};
|
|
12724
14587
|
document.getElementById('vt3d').onclick=()=>{pendingView=null;requestView3d();};
|
|
14588
|
+
{const s=document.getElementById('vtSplit');if(s)s.onclick=()=>{pendingView=null;requestViewSplit();};}
|
|
14589
|
+
// CAPTURE phase, so the pane is active BEFORE the canvas's own handler runs: the 3D engine's onDown is
|
|
14590
|
+
// itself a capture-phase listener on #stage3d, and it must see inputActive already true.
|
|
14591
|
+
document.getElementById('pane2d').addEventListener('pointerdown',()=>setActivePane('2d'),true);
|
|
14592
|
+
document.getElementById('pane3d').addEventListener('pointerdown',()=>setActivePane('3d'),true);
|
|
14593
|
+
// …and on FOCUS, which is what makes split reachable without a mouse. With pointerdown as the only
|
|
14594
|
+
// trigger, a keyboard user entering split via #vtSplit was pinned to the 2D pane for good: everything
|
|
14595
|
+
// gated on the active pane (#dim3dWrap, every body.v3d menu row) became permanently unreachable, and
|
|
14596
|
+
// #stage3d — which carries tabindex=0 — was a dead end, focusable but with its keyboard switched off
|
|
14597
|
+
// by setInputActive(false). Tabbing into a pane now hands it the tools. (Code review.)
|
|
14598
|
+
document.getElementById('pane2d').addEventListener('focusin',()=>setActivePane('2d'));
|
|
14599
|
+
document.getElementById('pane3d').addEventListener('focusin',()=>setActivePane('3d'));
|
|
12725
14600
|
// Hand over from the pre-load capture (see armEarlyViewToggle). Retire it FIRST, so the two cannot
|
|
12726
14601
|
// both act on the same click, and drop aria-busy now that the group's state is authoritative again.
|
|
12727
14602
|
// A pending 2D needs no action: it is the default the toggle already shows. A pending 3D is applied on
|
|
@@ -12741,8 +14616,48 @@ viewHandlersLive=true;
|
|
|
12741
14616
|
// no 2D plan — so a user who just migrated their project would land on a blank canvas and conclude the
|
|
12742
14617
|
// migration ate their model. 3D IS the model view for it, and it shows all of it. A queued real click
|
|
12743
14618
|
// still wins: this only supplies the default when the user expressed no preference during load.
|
|
12744
|
-
|
|
12745
|
-
|
|
14619
|
+
// Restore the persisted mode + divider ratio. Runs HERE because it needs #vtSplit to be in the document
|
|
14620
|
+
// and SplitView to have loaded — both true by main().
|
|
14621
|
+
{let saved='2d';try{saved=localStorage.getItem(SPLIT_MODE_KEY)||'2d';}catch(_){}
|
|
14622
|
+
// requestedMode is seeded from the SAVED value, not from whatever setView manages to render. Opening on
|
|
14623
|
+
// a narrow window resolves to '2d' for now and the key SURVIVES — but note the mechanism, because it is
|
|
14624
|
+
// not remember:false (this path routes through pendingView into requestViewSplit, where `remember`
|
|
14625
|
+
// defaults true). It survives because setView persists `mode`, the REQUEST, rather than `want`, the
|
|
14626
|
+
// downgrade. Simplify that line to persist `want` and this invariant dies silently: narrow the window
|
|
14627
|
+
// once and the Split preference is gone for good. Widening later restores it via onStageResize's edge.
|
|
14628
|
+
requestedMode=SplitView.sanitizeMode(saved);
|
|
14629
|
+
try{splitRatio=SplitView.sanitizeRatio(parseFloat(localStorage.getItem(SPLIT_RATIO_KEY)));}catch(_){splitRatio=0.5;}
|
|
14630
|
+
applySplitRatio(splitRatio,false); // clamp against THIS stage, and seed aria-valuenow with it
|
|
14631
|
+
// SEED THE EDGE DETECTOR, unconditionally and AFTER #vtSplit exists — two bugs live here:
|
|
14632
|
+
// · splitAvailable starts true, and reflectSplitAvailability ALSO returns true when the button is
|
|
14633
|
+
// absent. Booting narrow then widening would be true→true: no edge, no restore, and the saved
|
|
14634
|
+
// Split silently never comes back.
|
|
14635
|
+
// · A plain 2D boot never calls setView at all, so without this the Split button would sit enabled
|
|
14636
|
+
// with no reason text on a window too narrow to honour it, until the first resize.
|
|
14637
|
+
splitAvailable=reflectSplitAvailability();
|
|
14638
|
+
// A real click queued during load still wins — the restore only applies when the user expressed no
|
|
14639
|
+
// preference, exactly as the MODEL_RO default above does. It goes through setView DIRECTLY rather than
|
|
14640
|
+
// through pendingView so it can pass remember:false: a restore is not a fresh decision, so it must
|
|
14641
|
+
// neither rewrite the key nor toast a refusal the user did not just ask for (#vtSplitWhy already says
|
|
14642
|
+
// it, permanently, beside the disabled segment). Deferred a tick for the same reason the pending-click
|
|
14643
|
+
// hand-over below is: main() is still wiring the state setView acts on.
|
|
14644
|
+
if(pendingView===null&&requestedMode!=='2d'){
|
|
14645
|
+
const want=requestedMode;
|
|
14646
|
+
setTimeout(()=>{if(pendingView!==null)return;setView(want,{remember:false});},0);
|
|
14647
|
+
}
|
|
14648
|
+
// DEFAULT TO 3D for a read-only model (unit 5, P7d §8.5). The toggle defaults to 2D and a v2 model has
|
|
14649
|
+
// no 2D plan, so a user who just migrated their project would land on a blank canvas and conclude the
|
|
14650
|
+
// migration ate their model. 3D IS the model view for it.
|
|
14651
|
+
//
|
|
14652
|
+
// This runs AFTER the restore and is gated on requestedMode==='2d', which is the whole correction: it
|
|
14653
|
+
// supplies a default only where the user expressed NO preference. Sitting above the restore (where it
|
|
14654
|
+
// used to), it claimed pendingView first, so a read-only model with a saved Split reopened in 3D and
|
|
14655
|
+
// then had no availability edge to bring Split back — the saved preference was unreachable for good.
|
|
14656
|
+
// A queued real click still wins over both. (Codex review, H6.)
|
|
14657
|
+
else if(MODEL_RO&&pendingView===null&&requestedMode==='2d')pendingView='3d';}
|
|
14658
|
+
// Dispatch on the MODE STRING now that there are three of them. '2d' still needs no switch — it is the
|
|
14659
|
+
// default already on screen — so it falls to the else and simply ends the busy state.
|
|
14660
|
+
if(pendingView==='3d'||pendingView==='split'){const want=pendingView;setTimeout(()=>{if(pendingView!==want)return;pendingView=null;if(want==='split')requestViewSplit();else requestView3d();},0);}
|
|
12746
14661
|
else{pendingView=null;setViewBusy(false);}
|
|
12747
14662
|
// Block the browser's Ctrl+wheel page-zoom anywhere in the app (fires even when the pointer isn't over the canvas). Canvas zoom below still runs.
|
|
12748
14663
|
window.addEventListener('wheel',e=>{if(e.ctrlKey)e.preventDefault();},{passive:false});
|