@floless/app 0.130.1 → 0.131.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floless-server.cjs +375 -229
- package/dist/web/reference-changes.js +279 -0
- package/dist/web/reference-session.js +141 -0
- package/dist/web/steel-3d-view.js +205 -3
- package/dist/web/steel-editor.html +2698 -201
- package/dist/web/steel-split-view.js +188 -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}
|
|
@@ -585,7 +616,36 @@
|
|
|
585
616
|
the two surfaces cannot overlap at narrower widths. In 3D the whole dock stops before the world-axis
|
|
586
617
|
triad, preserving the old 104px clearance without independently-positioned bars. */
|
|
587
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}
|
|
588
|
-
|
|
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}
|
|
622
|
+
/* SPLIT: the dock's LEFT group belongs to a pane, not to the stage's corner. The rule above already
|
|
623
|
+
clears #ptrBars onto the 3D pane; the left side never got the equivalent, so #m3dLegendLauncher —
|
|
624
|
+
which expands the 3D pane's OWN panel (aria-controls=m3dLegend) — and the gesture hint both sat in the
|
|
625
|
+
plan's bottom-left. This moves their PLACEMENT only. The hint's TEXT is written by updateStatusChip()
|
|
626
|
+
in steel-3d-view.js from 3D-renderer state alone; it does not read activePane and is not changed here,
|
|
627
|
+
so in split it still reads as the 3D sentence wherever it sits. Say so plainly rather than letting the
|
|
628
|
+
comment imply this fixed that too. (Second review, finding 7.)
|
|
629
|
+
--dock-pane3d-left is DERIVED in applySplitRatio() — not measured off the pane, which would force a
|
|
630
|
+
layout inside every sample of a divider drag.
|
|
631
|
+
3D ACTIVE: shift the whole left group onto the 3D pane, so launcher and hint stay adjacent exactly as
|
|
632
|
+
they read in a single view. Padding only shrinks the content box, so #ptrBars stays right-aligned.
|
|
633
|
+
The +12px is DOCK_GUTTER_PX — the inset every other pane-anchored control uses, and the thing that
|
|
634
|
+
keeps the launcher's 8px-wider hit target off the divider. Keep it in step with the JS constant, which
|
|
635
|
+
subtracts the same 12 from the fit budget. */
|
|
636
|
+
body.split-view.v3d #bottomDock.dock-per-pane{padding-left:calc(var(--dock-pane3d-left,0px) + 12px)}
|
|
637
|
+
/* 2D ACTIVE: the hint belongs over the plan, but the launcher still belongs to the pane it controls. So
|
|
638
|
+
take the launcher OUT of the flex flow — being first, any offset on it would drag the hint along too —
|
|
639
|
+
and pin it to the 3D pane. bottom:0 reproduces the dock's own align-items:flex-end. The +12px matches
|
|
640
|
+
the padding above, so the launcher does not shift when the active pane changes. */
|
|
641
|
+
body.split-view:not(.v3d) #bottomDock.dock-per-pane #m3dLegendLauncher{position:absolute;left:calc(var(--dock-pane3d-left,0px) + 12px);bottom:0}
|
|
642
|
+
/* …and stop the hint growing across the divider into the pane it is not describing.
|
|
643
|
+
The cap goes on #canvasStatus, the visible pill — NOT on its #bottomDockLeft parent. That parent's
|
|
644
|
+
flex:1 is what pushes #ptrBars to the dock's right edge, so capping IT dragged Select/Snap ~160px
|
|
645
|
+
leftwards and straight under the launcher. Capping the child leaves the spacer free to expand.
|
|
646
|
+
The -12px is the gutter: the 7px divider plus ~5px of air, so the pill stops short of the seam
|
|
647
|
+
rather than butting against it. MIN_PANE_PX keeps the offset ≥275, so the cap never goes negative. */
|
|
648
|
+
body.split-view:not(.v3d) #bottomDock.dock-per-pane #canvasStatus{max-width:calc(var(--dock-pane3d-left,100%) - 12px)}
|
|
589
649
|
#bottomDockLeft{display:flex;align-items:center;gap:8px;flex:1;min-width:0;pointer-events:none}
|
|
590
650
|
#ptrBars{position:static;z-index:auto;display:flex;align-items:flex-end;gap:8px;flex:none;pointer-events:auto}
|
|
591
651
|
#canvasStatus{display:none;align-items:center;gap:0;flex:1;min-width:0;pointer-events:auto}
|
|
@@ -1009,12 +1069,26 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1009
1069
|
.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}
|
|
1010
1070
|
/* 2D|3D view toggle — segmented, far-left; active segment filled (--panel) with a --brand underline */
|
|
1011
1071
|
#viewToggle{display:inline-flex;border:1px solid var(--line);border-radius:6px;overflow:hidden;flex:none}
|
|
1072
|
+
/* The anchor for #vtSplitWhy below. It cannot hang off #viewToggle itself: that carries overflow:hidden
|
|
1073
|
+
to clip its segments' corners, which would also clip the reason chip out of existence. */
|
|
1074
|
+
#viewToggleWrap{position:relative;display:inline-flex;flex:none}
|
|
1075
|
+
/* The too-narrow reason, ANCHORED to the toggle and out of header flow. Inline it reflowed every stat
|
|
1076
|
+
chip after it and pushed the header between one and two rows the moment the window crossed the
|
|
1077
|
+
threshold — a layout jump caused by the very resize it is describing. Reuses the floating-chip recipe
|
|
1078
|
+
(--panel/--line/--shadow-float), so no new visual vocabulary. The span stays in the DOM permanently
|
|
1079
|
+
and only its text changes: several screen readers only announce mutations of an aria-live element
|
|
1080
|
+
that already existed. (UX review.) */
|
|
1081
|
+
#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)}
|
|
1082
|
+
#vtSplitWhy[hidden]{display:none}
|
|
1012
1083
|
#viewToggle .seg{padding:5px 11px;margin:0;border:0;border-radius:0;background:transparent;color:var(--mut);font:600 12px system-ui;cursor:pointer}
|
|
1013
1084
|
#viewToggle .seg+.seg{border-left:1px solid var(--line)}
|
|
1014
|
-
#viewToggle .seg:hover{color:var(--text)}
|
|
1085
|
+
#viewToggle .seg:hover:not(:disabled){color:var(--text)}
|
|
1086
|
+
/* The segment's own `cursor:pointer` outranks the global button:disabled rule by specificity, so a
|
|
1087
|
+
disabled Split still brightened on hover and offered a pointer — a dead control advertising itself
|
|
1088
|
+
as live. Its transparent background is already correct (the ID selector wins there too, which is
|
|
1089
|
+
why no background override is needed here). (Code review.) */
|
|
1090
|
+
#viewToggle .seg:disabled{cursor:default}
|
|
1015
1091
|
#viewToggle .seg.on{background:var(--panel);color:var(--text);box-shadow:inset 0 -2px 0 var(--brand)}
|
|
1016
|
-
#stagewrap{position:relative}
|
|
1017
|
-
#stage3d{position:absolute;inset:0;width:100%;height:100%;display:none;outline:none}
|
|
1018
1092
|
/* yellow = START (end 1), magenta = END (end 2) — also the drag handles. Same colours in 3D. */
|
|
1019
1093
|
circle.handle.ep-start{fill:#facc15;stroke:#0b1220;stroke-width:2}
|
|
1020
1094
|
circle.handle.ep-end{fill:#f472b6;stroke:#0b1220;stroke-width:2}
|
|
@@ -1288,10 +1362,10 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1288
1362
|
(unchecked box, :checked, indeterminate, :focus-visible, forced-colors). */
|
|
1289
1363
|
#riPickToggle{margin-top:10px}
|
|
1290
1364
|
#refImportModal .reftree{max-height:168px;overflow:auto;border:1px solid var(--line);border-radius:7px;background:var(--bg);padding:3px 2px;margin-bottom:8px}
|
|
1291
|
-
#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}
|
|
1292
|
-
#refImportModal .ripick-row:hover{background:var(--hover-soft)}
|
|
1293
|
-
#refImportModal .ripick-row .rpname{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
|
|
1294
|
-
#refImportModal .ripick-row .rpcount{flex:none;color:var(--mut);font-variant-numeric:tabular-nums;font-size:10px}
|
|
1365
|
+
#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}
|
|
1366
|
+
#refImportModal .ripick-row:hover,#refVersionModal .ripick-row:hover{background:var(--hover-soft)}
|
|
1367
|
+
#refImportModal .ripick-row .rpname,#refVersionModal .ripick-row .rpname{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
|
|
1368
|
+
#refImportModal .ripick-row .rpcount,#refVersionModal .ripick-row .rpcount{flex:none;color:var(--mut);font-variant-numeric:tabular-nums;font-size:10px}
|
|
1295
1369
|
/* The storey-less row. NOT a disabled checkbox — a disabled control says "you may not do this yet",
|
|
1296
1370
|
and the truth is that the reader cannot express it at all, so there is no control to disable. */
|
|
1297
1371
|
#refImportModal .ripick-row--fixed{cursor:default}
|
|
@@ -1310,6 +1384,147 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1310
1384
|
#riFootNote{display:none;flex:1;align-self:center;font-size:11px;line-height:1.4;text-align:left}
|
|
1311
1385
|
#riFootNote.warn{color:var(--warn)} #riFootNote.refuse{color:var(--err)}
|
|
1312
1386
|
#riInsert[disabled]{opacity:.5;cursor:not-allowed}
|
|
1387
|
+
/* ── The new-version modal (#refVersionModal) and its change list (#734, design §7.3) — #refImportModal's
|
|
1388
|
+
recipe under its own ids, a sibling for the reason that modal gives for not being a stage of
|
|
1389
|
+
#connImportModal: its last screen is "confirm the one thing you are about to add", and this one's is
|
|
1390
|
+
"here is what changed between two versions of it", which is a different question wearing the same
|
|
1391
|
+
clothes. The upload stages ARE the same question, so they wear the same chrome.
|
|
1392
|
+
|
|
1393
|
+
ONE SCROLL CONTAINER — `.rvbody` — owns the whole panel (design pass, decision K). Nothing below opens
|
|
1394
|
+
a second SCROLLPORT: a nested one is both where a native bar leaks in and a worse interaction. (The
|
|
1395
|
+
remedy picker's `.rfpick .reftree` does name both properties, to NEUTRALISE the import picker's
|
|
1396
|
+
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`
|
|
1397
|
+
without a strip of content scrolling behind it; each stage pads itself instead.
|
|
1398
|
+
|
|
1399
|
+
NO SCROLLBAR CSS IS NEEDED — the page's global `*{scrollbar-width…}` and `*::-webkit-scrollbar*` rules
|
|
1400
|
+
(line 179) already reach any container added here, the same reason the import picker declares none
|
|
1401
|
+
(:1273). `npm run verify:scrollbars` is what proves that rather than the eye.
|
|
1402
|
+
|
|
1403
|
+
NO NEW COLOUR AND NO NEW FONT. Every value below is a `:root` token from this page. The `changedBy`
|
|
1404
|
+
chips are deliberately NOT monospace even though the design pass suggested it: this surface
|
|
1405
|
+
establishes no monospace family and `--mono` does not exist here; `showEmpty`'s own doc records why
|
|
1406
|
+
introducing one would be a new font against the locked baseline ("Deliberately NOT monospace: no
|
|
1407
|
+
monospace family is established on this surface"). Size, fill and ink de-emphasise them just as well. ── */
|
|
1408
|
+
#refVersionModal{display:none;position:fixed;inset:0;z-index:60;align-items:center;justify-content:center}
|
|
1409
|
+
#refVersionModal .mbackdrop{position:absolute;inset:0;background:var(--backdrop)}
|
|
1410
|
+
#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)}
|
|
1411
|
+
#refVersionModal .mhead{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 14px;border-bottom:1px solid var(--line)}
|
|
1412
|
+
#refVersionModal .rvbody{overflow:auto;min-height:0}
|
|
1413
|
+
/* ── THE ANSWER IS NOT A DIALOG. The upload stages are a transaction and hold the screen like one; the
|
|
1414
|
+
change list is something you READ WHILE LOOKING AT THE MODEL. Every row says "click to fly there",
|
|
1415
|
+
a removed row draws its ghost on the canvas, and a scrim over that canvas makes both unusable —
|
|
1416
|
+
found in the real browser pass, where the backdrop swallowed the Fit button while ghosts were on
|
|
1417
|
+
screen behind it. So on the result stage the scrim goes inert and invisible and the panel becomes a
|
|
1418
|
+
floating pane: the canvas orbits, zooms and shows what a click just flew to.
|
|
1419
|
+
`pointer-events` on the CONTAINER, not only the backdrop — `#refVersionModal` is itself a
|
|
1420
|
+
full-viewport flex box, so it intercepts everything outside the panel whatever the scrim does. ── */
|
|
1421
|
+
#refVersionModal.rvfloat{pointer-events:none}
|
|
1422
|
+
#refVersionModal.rvfloat .mbackdrop{background:transparent}
|
|
1423
|
+
#refVersionModal.rvfloat .rvpanel{pointer-events:auto}
|
|
1424
|
+
#refVersionModal .rvfoot{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:10px 14px;border-top:1px solid var(--line)}
|
|
1425
|
+
#refVersionModal .rvfoot .rvnote{flex:1;min-width:0;color:var(--mut);font-size:11px;line-height:1.4;text-align:left}
|
|
1426
|
+
#rvDropStage,#rvProgStage,#rvRefuseStage{padding:14px}
|
|
1427
|
+
/* THREE WEIGHTS, NO NEW COLOUR (decision H): --brand for the primary, this page's default button for the
|
|
1428
|
+
secondary, and the existing `.ghost` for the quietest. Deliberately NOT `class=primary`, which #riInsert
|
|
1429
|
+
carries and which has no rule anywhere in this file — a weight that exists only in the markup is the
|
|
1430
|
+
same class of thing as the colour at :1294 that was authored and never rendered. */
|
|
1431
|
+
#refVersionModal button.rvprimary{background:var(--brand);border-color:var(--brand);color:var(--brand-ink)}
|
|
1432
|
+
#refVersionModal button.rvprimary:hover{background:var(--brand-hover);border-color:var(--brand-hover)}
|
|
1433
|
+
#rvSubject{color:var(--mut);font-size:12px;line-height:1.55;margin-bottom:10px}
|
|
1434
|
+
#rvSubject b{color:var(--text);font-weight:600}
|
|
1435
|
+
#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}
|
|
1436
|
+
#rvDrop:hover,#rvDrop.drag{border-color:var(--brand);color:var(--text);background:var(--brand-wash-faint)}
|
|
1437
|
+
#rvDropErr{display:none;margin-top:8px;color:var(--err);font-size:11.5px;line-height:1.5}
|
|
1438
|
+
/* ── The refusal, and every other named refusal code, in the NEUTRAL tokens (decision H). Not `--err`
|
|
1439
|
+
red: "these two files do not relate" is a complete, correct answer about somebody else's export, not
|
|
1440
|
+
a failure of ours, and alarm colour would say otherwise. ── */
|
|
1441
|
+
#rvRefuseStage .rflead{color:var(--text);font-size:13px;line-height:1.6;margin-bottom:8px}
|
|
1442
|
+
#rvRefuseStage .rfwhy{color:var(--mut);font-size:12px;line-height:1.6}
|
|
1443
|
+
#rvRefuseStage .rflist{color:var(--mut);font-size:11.5px;line-height:1.6;margin:8px 0 0;padding-left:18px}
|
|
1444
|
+
#rvRefuseStage .rfacts{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;margin-top:14px}
|
|
1445
|
+
#rvRefuseStage .rfpick{margin-top:12px;border-top:1px solid var(--line);padding-top:10px}
|
|
1446
|
+
#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}
|
|
1447
|
+
/* ── The change list ── */
|
|
1448
|
+
#rvResultStage .rcregion{padding:0 14px}
|
|
1449
|
+
#rcHead{position:sticky;top:0;z-index:1;background:var(--panel);padding:12px 14px 10px;border-bottom:1px solid var(--line)}
|
|
1450
|
+
#rcHead .rcsubject{color:var(--mut);font-size:12px;line-height:1.5;margin-bottom:8px}
|
|
1451
|
+
#rcHead .rcsubject b{color:var(--text);font-weight:600}
|
|
1452
|
+
#rcStats{display:flex;flex-wrap:wrap;gap:6px}
|
|
1453
|
+
/* Every count is a chip of equal weight, never a sentence: rendered as prose "12,806 unchanged" is the
|
|
1454
|
+
widest and loudest span on the line purely because it has five digits (decision G). */
|
|
1455
|
+
#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}
|
|
1456
|
+
#refVersionModal .rcstat .rcn{font-variant-numeric:tabular-nums;font-weight:600}
|
|
1457
|
+
#refVersionModal .rcstat .rcg{font-weight:700}
|
|
1458
|
+
#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}
|
|
1459
|
+
/* THE FOUR STATUS TREATMENTS, shared by the header chips and the row badges so the two cannot drift.
|
|
1460
|
+
Each carries a glyph and a word in the DOM as well as a colour (decision B) — colour alone is not an
|
|
1461
|
+
encoding. `uncomparable` is DASHED and unfilled rather than a second amber fill: shape survives losing
|
|
1462
|
+
colour entirely, and "we do not know" must not look like the asserted fact beside it.
|
|
1463
|
+
PLACED AFTER the two base rules above and at the SAME specificity, so source order is what decides —
|
|
1464
|
+
the trap at :1294 was a modifier that lost to a longer selector and never rendered. */
|
|
1465
|
+
#refVersionModal .rc-add{color:var(--ok);background:var(--ok-bg);border-color:var(--ok-edge)}
|
|
1466
|
+
#refVersionModal .rc-rem{color:var(--err);background:var(--err-bg);border-color:var(--err-edge)}
|
|
1467
|
+
#refVersionModal .rc-chg{color:var(--warn);background:var(--warn-bg);border-color:var(--warn-edge)}
|
|
1468
|
+
#refVersionModal .rc-unk{color:var(--warn);background:transparent;border-color:var(--warn-edge);border-style:dashed}
|
|
1469
|
+
#refVersionModal .rc-plain{color:var(--mut);background:transparent;border-color:transparent}
|
|
1470
|
+
/* The issue banners — a decision to make and a "we could not tell you everything" both pin near the top
|
|
1471
|
+
(decision A) rather than sitting under up to 12,000 rows. Amber, because both mean "needs review". */
|
|
1472
|
+
#rcIssues{padding:10px 14px 0}
|
|
1473
|
+
#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}
|
|
1474
|
+
/* …and the one banner that is NOT a problem. What the re-read could not carry over from your session is
|
|
1475
|
+
ordinary housekeeping after an act you asked for, so amber — which the rule above uses to mean "needs
|
|
1476
|
+
review" — would misreport it as a fault. Recedes exactly as `rc-plain` does one tier down, in the same
|
|
1477
|
+
two tokens. TWO classes beats the one above on specificity, which is the trap at :1294: a modifier
|
|
1478
|
+
that loses to a longer selector is authored, shipped, and never rendered. */
|
|
1479
|
+
#rcIssues .rcban.plain{border-color:var(--line);color:var(--mut)}
|
|
1480
|
+
#rcIssues .rcban .rcbantx{flex:1;min-width:0}
|
|
1481
|
+
#rcControls{display:flex;align-items:center;gap:8px;padding:10px 14px 6px}
|
|
1482
|
+
#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}
|
|
1483
|
+
#rcSearch:focus{border-color:var(--brand)}
|
|
1484
|
+
#rcSearch::placeholder{color:var(--mut)}
|
|
1485
|
+
#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}
|
|
1486
|
+
#rcList .rcrow:hover{background:var(--hover-soft)}
|
|
1487
|
+
#rcList .rcrow:focus-visible{outline:1px solid var(--brand);outline-offset:-1px}
|
|
1488
|
+
#rcList .rcrow.sel{box-shadow:inset 2px 0 0 var(--brand);background:var(--brand-wash)}
|
|
1489
|
+
#rcList .rcnm{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;color:var(--text)}
|
|
1490
|
+
#rcList .rcby{display:inline-flex;gap:4px;flex:none}
|
|
1491
|
+
#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}
|
|
1492
|
+
#rcList .rcmv{flex:none;color:var(--mut);font-variant-numeric:tabular-nums;font-size:10.5px}
|
|
1493
|
+
/* The cap SAYS SO (decision D). A list that stops at 300 with no explanation reads as "that is all there
|
|
1494
|
+
was", which on a change list is the same class of lie as folding `uncomparable` into `unchanged`. */
|
|
1495
|
+
#rcList .rccap{color:var(--mut);font-size:10px;padding:4px 4px 4px 34px;line-height:1.45}
|
|
1496
|
+
#rcList .rcempty{color:var(--mut);font-size:11.5px;line-height:1.6;padding:14px 4px;text-align:center}
|
|
1497
|
+
#rcList .rcempty b{color:var(--text);display:block;font-size:13px;margin-bottom:4px}
|
|
1498
|
+
#rcUncomparable{padding:12px 14px 16px;margin-top:10px;border-top:1px solid var(--line)}
|
|
1499
|
+
#rcUncomparable h4{margin:0 0 6px;font-size:12px;color:var(--text);font-weight:600}
|
|
1500
|
+
#rcUncomparable .rcuwhy{color:var(--mut);font-size:11.5px;line-height:1.6}
|
|
1501
|
+
#rcUncomparable .rcurow{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:2px 0;font-size:11.5px;color:var(--mut)}
|
|
1502
|
+
#rcUncomparable .rcurow .rcuv{color:var(--text);font-variant-numeric:tabular-nums}
|
|
1503
|
+
/* ── The version history (#734 Phase 6). One row per version, newest first.
|
|
1504
|
+
NO NESTED SCROLLPORT: `#rvBody` is this modal's one scroll container and the page's global `*`
|
|
1505
|
+
scrollbar rules (:179) already reach it, which is why the change list declares none either. A
|
|
1506
|
+
version chain is short — a `max-height` here would add a second bar for nothing. ── */
|
|
1507
|
+
#rvHistoryStage{padding:14px}
|
|
1508
|
+
#rvhSubject{color:var(--mut);font-size:12px;line-height:1.55;margin-bottom:10px}
|
|
1509
|
+
#rvhSubject b{color:var(--text);font-weight:600}
|
|
1510
|
+
#rvhList .rvhrow{display:flex;align-items:center;gap:10px;padding:8px 10px;border:1px solid var(--line);border-radius:7px;margin-bottom:6px;background:var(--sunken)}
|
|
1511
|
+
/* The row you are ON, in the idiom this page already uses four times over (`.rcrow.sel`, `.refrow.sel`,
|
|
1512
|
+
`.refobjrow.sel`, `.lrow.clip.sel`) — one selected-ness in this modal, not two. */
|
|
1513
|
+
#rvhList .rvhrow.now{box-shadow:inset 2px 0 0 var(--brand);background:var(--brand-wash)}
|
|
1514
|
+
#rvhList .rvhnum{flex:none;color:var(--mut);font-size:10.5px;font-variant-numeric:tabular-nums;min-width:56px}
|
|
1515
|
+
#rvhList .rvhmain{flex:1;min-width:0}
|
|
1516
|
+
#rvhList .rvhnm{color:var(--text);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1517
|
+
#rvhList .rvhwhen{color:var(--mut);font-size:10.5px;line-height:1.6}
|
|
1518
|
+
#rvhList .rvhacts{flex:none;display:flex;align-items:center;gap:8px}
|
|
1519
|
+
/* The confirm sits INSIDE the row it is about, so a list of eight versions cannot leave you unsure
|
|
1520
|
+
which one you just agreed to. Muted rather than amber: a rollback is a supported action the user
|
|
1521
|
+
asked for, not a fault — the same reasoning the refusal stage states for staying out of `--err`. */
|
|
1522
|
+
#rvhList .rvhconfirm{flex:1;min-width:0;color:var(--mut);font-size:11.5px;line-height:1.5}
|
|
1523
|
+
/* The post-rollback sentence, in `.rcban.plain`'s two tokens rather than `--ok` green. This modal's
|
|
1524
|
+
vocabulary for a good, uneventful outcome is colourless everywhere else (`.rcempty` included), and a
|
|
1525
|
+
success-green would be a tone this surface does not otherwise have. */
|
|
1526
|
+
#rvhNote{margin-top:10px;padding:7px 10px;border:1px solid var(--line);border-radius:7px;color:var(--mut);font-size:11.5px;line-height:1.55}
|
|
1527
|
+
#rvhNote:empty{display:none;padding:0;border:0}
|
|
1313
1528
|
/* ── Favourites tab (#m3dFavBody) — the Views-tab row/search recipe. No create button (★ lives in the
|
|
1314
1529
|
Inspector); a kind-filter + search header, per-row kind swatch + portability badge + row-click-to-arm. ── */
|
|
1315
1530
|
#favHeadRow{display:flex;align-items:stretch;gap:6px;margin-bottom:6px;flex:none}
|
|
@@ -1374,8 +1589,8 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1374
1589
|
these are scoped to #m3dLegend, which is not an ancestor of #refImportModal. The picker is the
|
|
1375
1590
|
identical shape (a header standing for several rows, with a tri-state toggle), so it gets the
|
|
1376
1591
|
identical chrome rather than a second copy that drifts. */
|
|
1377
|
-
#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}
|
|
1378
|
-
#m3dLegend .cat-hdr:hover,#refImportModal .cat-hdr:hover{background:#33415580}
|
|
1592
|
+
#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}
|
|
1593
|
+
#m3dLegend .cat-hdr:hover,#refImportModal .cat-hdr:hover,#refVersionModal .cat-hdr:hover{background:#33415580}
|
|
1379
1594
|
/* …but NOT in the import modal, where only the nested toggle acts. In #m3dLegend the whole header
|
|
1380
1595
|
collapses its group, so the pointer and the hover fill are honest there; borrowing them here would
|
|
1381
1596
|
promise a click that does nothing. Placed AFTER the rule it overrides — same specificity, so source
|
|
@@ -1385,17 +1600,17 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1385
1600
|
#refImportModal .cat-tog{cursor:pointer}
|
|
1386
1601
|
#m3dLegend .cat-hdr.empty .cat-label,#m3dLegend .cat-hdr.empty .cat-count{opacity:.55}
|
|
1387
1602
|
#m3dLegend .cat-hdr.drop-target{outline:1px solid var(--brand);background:rgba(59,130,246,.18)}
|
|
1388
|
-
#m3dLegend .cat-chevron{font-size:10px;color:var(--mut);width:12px;flex:none;text-align:center}
|
|
1389
|
-
#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}
|
|
1390
|
-
#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}
|
|
1603
|
+
#m3dLegend .cat-chevron,#refVersionModal .cat-chevron{font-size:10px;color:var(--mut);width:12px;flex:none;text-align:center}
|
|
1604
|
+
#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}
|
|
1605
|
+
#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}
|
|
1391
1606
|
/* `min-width:0` + ellipsis because a flex item that cannot shrink below its content OVERFLOWS the row
|
|
1392
1607
|
rather than truncating, and `.cat-hdr` is `white-space:nowrap`. The legend's own categories were
|
|
1393
1608
|
always short enough to hide this; the reference tree's disambiguated headers ("Wall · IFCWALL…")
|
|
1394
1609
|
are the first labels long enough to test it. Same recipe as `.refname` directly above. */
|
|
1395
|
-
#m3dLegend .cat-label,#refImportModal .cat-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;font-size:12px;color:var(--text)}
|
|
1396
|
-
#m3dLegend .cat-count,#refImportModal .cat-count{font-size:10px;color:var(--mut);font-variant-numeric:tabular-nums}
|
|
1610
|
+
#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)}
|
|
1611
|
+
#m3dLegend .cat-count,#refImportModal .cat-count,#refVersionModal .cat-count{font-size:10px;color:var(--mut);font-variant-numeric:tabular-nums}
|
|
1397
1612
|
#m3dLegend .lrow.typed{padding-left:20px}
|
|
1398
|
-
#m3dLegend .cat-hdr.sub{padding-left:20px} /* a nested (middle) category, e.g. Dimensions → Base-plate */
|
|
1613
|
+
#m3dLegend .cat-hdr.sub,#refVersionModal .cat-hdr.sub{padding-left:20px} /* a nested (middle) category, e.g. Dimensions → Base-plate */
|
|
1399
1614
|
#m3dLegend .lrow.sub{padding-left:34px} /* a row inside a nested category — indented one level deeper */
|
|
1400
1615
|
#m3dLegend .drag-handle{font-size:11px;color:var(--mut);cursor:grab;opacity:0;transition:opacity .1s;flex:none;padding:0 1px;line-height:1}
|
|
1401
1616
|
#m3dLegend .lrow:hover .drag-handle{opacity:1}
|
|
@@ -1480,10 +1695,20 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1480
1695
|
<!-- grid-core is an ES module; the editor's classic script reaches it via window.GridCore (set before
|
|
1481
1696
|
the async contract fetch resolves in practice; gridcore-ready re-renders as a safety net). -->
|
|
1482
1697
|
<script type="module">import * as GC from './grid-core.js';window.GridCore=GC;document.dispatchEvent(new Event('gridcore-ready'));</script>
|
|
1698
|
+
<!-- reference-changes is an ES module for the same reason and reached the same way: the change-list
|
|
1699
|
+
panel's pure core (counts, status encoding, the cap, the refusal's copy) lives in a file a unit test
|
|
1700
|
+
can import, while the DOM that renders it belongs to this page's classic script. Neither can see the
|
|
1701
|
+
other's bindings, which is why RC_CAP restates REF_TREE_CAP's number rather than importing it. -->
|
|
1702
|
+
<script type="module">import * as RC from './reference-changes.js';window.ReferenceChanges=RC;</script>
|
|
1703
|
+
<!-- reference-session, likewise: the label-matching that carries the object tree's open groups across a
|
|
1704
|
+
re-read, and the one sentence that reports whatever could not be carried, are decisions a unit test
|
|
1705
|
+
can pin (server/reference-session.test.ts) while the state they act on — refGeom, refTreeGroups, the
|
|
1706
|
+
selection, the measurement — belongs to this page's classic script. -->
|
|
1707
|
+
<script type="module">import * as RS from './reference-session.js';window.ReferenceSession=RS;</script>
|
|
1483
1708
|
</head><body>
|
|
1484
1709
|
<header>
|
|
1485
1710
|
<b>Steel Model</b>
|
|
1486
|
-
<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>
|
|
1711
|
+
<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>
|
|
1487
1712
|
<!-- Plan switcher. See the .plan-* rules for why this is not a <select>. Unlike the sibling page's sheet
|
|
1488
1713
|
switcher it is NOT hidden for a single plan: this control is the only place the name of the plan you
|
|
1489
1714
|
are LOOKING AT appears, so hiding it for a one-plan model would delete information rather than a
|
|
@@ -1647,130 +1872,132 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1647
1872
|
<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>
|
|
1648
1873
|
</div>
|
|
1649
1874
|
<main>
|
|
1875
|
+
<!-- ONE PANE PER CANVAS, and each canvas's floating chrome lives INSIDE its own pane (F10a). Only
|
|
1876
|
+
#bottomDock and #selFly stay on #stagewrap: they address whichever canvas you are working in, so
|
|
1877
|
+
they span the whole stage rather than belonging to one side of it.
|
|
1878
|
+
#stage3d keeps position:absolute;inset:0, which is what lets the 3D engine's resize() and its
|
|
1879
|
+
ResizeObserver(canvas.parentElement) keep working untouched — they now measure #pane3d. -->
|
|
1650
1880
|
<div id=stagewrap>
|
|
1651
|
-
<div id=
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1881
|
+
<div id=pane2d>
|
|
1882
|
+
<div id=stage><svg id=svg></svg></div>
|
|
1883
|
+
<div id=zoombar>
|
|
1884
|
+
<button id=zOut data-tip="Zoom out">−</button>
|
|
1885
|
+
<input id=zRange type=range min=10 max=400 step=1 value=100>
|
|
1886
|
+
<button id=zIn data-tip="Zoom in">+</button>
|
|
1887
|
+
<span id=zPct>100%</span>
|
|
1888
|
+
<button id=zFit data-tip="Zoom to fit (Home)">Fit</button>
|
|
1889
|
+
</div>
|
|
1659
1890
|
</div>
|
|
1660
|
-
<
|
|
1661
|
-
<div id=
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
<div
|
|
1665
|
-
|
|
1666
|
-
<div
|
|
1667
|
-
<button
|
|
1668
|
-
<
|
|
1891
|
+
<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>
|
|
1892
|
+
<div id=pane3d>
|
|
1893
|
+
<canvas id=stage3d tabindex=0 aria-label="3D model"></canvas>
|
|
1894
|
+
<div id=connCrumb role=navigation aria-label="Connection breadcrumb"></div>
|
|
1895
|
+
<div id=m3dBar role=group aria-label="3D view controls">
|
|
1896
|
+
<!-- Camera projection — dropdown (like Plane / Work area); the button shows the current mode -->
|
|
1897
|
+
<div class=m3dwrap>
|
|
1898
|
+
<button id=m3dProjBtn data-tip="Camera projection — perspective, or orthographic (true scale)">Persp ▾</button>
|
|
1899
|
+
<div id=m3dProj class=m3dmenu role=menu>
|
|
1900
|
+
<button data-proj=persp class=on data-tip="Perspective — natural depth">Perspective</button>
|
|
1901
|
+
<button data-proj=ortho data-tip="Orthographic — true scale, no perspective">Orthographic</button>
|
|
1902
|
+
</div>
|
|
1669
1903
|
</div>
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1904
|
+
<button id=m3dFit data-tip="Fit all to view (Home)">Fit</button>
|
|
1905
|
+
<button id=m3dFitSel data-tip="Zoom to selected — frame just the selected members (Alt+Z)">Zoom sel</button>
|
|
1906
|
+
<span class=tb-sep></span>
|
|
1907
|
+
<!-- Display mode — dropdown; the button shows the current mode -->
|
|
1908
|
+
<div class=m3dwrap>
|
|
1909
|
+
<button id=m3dModeBtn data-tip="Display mode — solid, wireframe, see-through (X-ray) or realistic materials">Solid ▾</button>
|
|
1910
|
+
<div id=m3dMode class=m3dmenu role=menu>
|
|
1911
|
+
<button data-mode=solid class=on data-tip="Solid shaded model">Solid</button>
|
|
1912
|
+
<button data-mode=wire data-tip="Wireframe — edges only">Wire</button>
|
|
1913
|
+
<button data-mode=xray data-tip="See-through — reveal hidden parts">X-ray</button>
|
|
1914
|
+
<button data-mode=realistic data-tip="Realistic — real material finishes (steel, concrete, timber…)">Realistic</button>
|
|
1915
|
+
<button data-mode=shadowed data-tip="Realistic with cast shadows — more depth, at a cost to frame rate">Shadowed</button>
|
|
1916
|
+
</div>
|
|
1683
1917
|
</div>
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1918
|
+
<div class=m3dwrap id=m3dIsoWrap style="display:none">
|
|
1919
|
+
<button id=m3dIso aria-haspopup=menu aria-controls=m3dIsoMenu aria-expanded=false data-tip="Visibility actions for the selected objects">Isolate ▾</button>
|
|
1920
|
+
<div id=m3dIsoMenu class=m3dmenu role=menu>
|
|
1921
|
+
<button role=menuitem data-vis=show-all data-tip="Restore every hidden or isolated object" style="display:none">Show all</button>
|
|
1922
|
+
<hr data-vis-divider style="display:none">
|
|
1923
|
+
<button role=menuitem data-vis=isolate data-tip="Show only the selected objects (Esc to restore)">Isolate selected</button>
|
|
1924
|
+
<button role=menuitem data-vis=hide data-tip="Hide the selected objects">Hide selected</button>
|
|
1925
|
+
</div>
|
|
1692
1926
|
</div>
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1927
|
+
<button id=m3dViewsBtn data-tip="Saved views — save, switch, and manage named viewpoints">Views</button>
|
|
1928
|
+
<span class=tb-sep></span>
|
|
1929
|
+
<!-- Display toggles: reference lines + mark labels (grouped into a menu, like Plane / Work area).
|
|
1930
|
+
The Dimension tool moved to the header so it lives in one place across 2D and 3D. -->
|
|
1931
|
+
<div class=m3dwrap>
|
|
1932
|
+
<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>
|
|
1933
|
+
<div id=m3dViewMenu class=m3dmenu role=menu>
|
|
1934
|
+
<label data-tip="Show each member's reference line (centreline)"><input type=checkbox id=m3dRef> Ref line</label>
|
|
1935
|
+
<label data-tip="Show each member's mark / id label in the 3D view"><input type=checkbox id=m3dLabels> Mark labels</label>
|
|
1936
|
+
<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>
|
|
1937
|
+
<hr>
|
|
1938
|
+
<div class=m3d-actions id=m3dViewActions>
|
|
1939
|
+
<button id=m3dViewHideAll role=menuitem data-tip="Hide reference lines, mark labels, and property labels">Hide all</button>
|
|
1940
|
+
<button id=m3dViewShowAll class=mprimary role=menuitem data-tip="Show reference lines, mark labels, and property labels">Show all</button>
|
|
1941
|
+
</div>
|
|
1708
1942
|
</div>
|
|
1709
1943
|
</div>
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1944
|
+
<span class=tb-sep></span>
|
|
1945
|
+
<!-- Section -->
|
|
1946
|
+
<div class=m3dwrap>
|
|
1947
|
+
<button id=m3dClip data-tip="Clip planes and boxes — section your model to see inside">Clip ▾</button>
|
|
1948
|
+
<div id=m3dClipMenu class=m3dmenu role=menu>
|
|
1949
|
+
<button data-clip=plane data-tip="Click a model face to cut the view there (Shift+X)">Add clip plane</button>
|
|
1950
|
+
<button data-clip=box data-tip="Click two corners, then a height, to cut away everything outside (Shift+B)">Add clip box</button>
|
|
1951
|
+
<hr>
|
|
1952
|
+
<button data-clip=clear class=mdanger data-tip="Remove every clip">Clear all clips</button>
|
|
1953
|
+
</div>
|
|
1720
1954
|
</div>
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1955
|
+
<div class=m3dwrap>
|
|
1956
|
+
<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>
|
|
1957
|
+
<div id=m3dWpMenu class=m3dmenu role=menu>
|
|
1958
|
+
<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>
|
|
1959
|
+
<button data-wp=3pt data-tip="Three snapped points: origin, X direction, a point on the Y side">3 points…</button>
|
|
1960
|
+
<hr>
|
|
1961
|
+
<div class=mlabel>Principal + offset</div>
|
|
1962
|
+
<div class=wpprow>
|
|
1963
|
+
<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>
|
|
1964
|
+
<input id=m3dWpOff inputmode=decimal placeholder="16'-6" autocomplete=off data-tip="Offset along the plane normal (ft-in)">
|
|
1965
|
+
</div>
|
|
1966
|
+
<hr>
|
|
1967
|
+
<label data-tip="Show or hide the reference plane surface"><input type=checkbox id=m3dWpShow> Show plane</label>
|
|
1968
|
+
<button data-wp=reset data-tip="Back to the active plan's level">Reset to level</button>
|
|
1732
1969
|
</div>
|
|
1733
|
-
<hr>
|
|
1734
|
-
<label data-tip="Show or hide the reference plane surface"><input type=checkbox id=m3dWpShow> Show plane</label>
|
|
1735
|
-
<button data-wp=reset data-tip="Back to the active plan's level">Reset to level</button>
|
|
1736
1970
|
</div>
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1971
|
+
<div class=m3dwrap>
|
|
1972
|
+
<button id=m3dWork data-tip="Working area — bound the view to a box">Work area ▾</button>
|
|
1973
|
+
<div id=m3dWorkMenu class=m3dmenu role=menu>
|
|
1974
|
+
<button data-wa=all data-tip="Bound the work area to the whole model">Set to all objects</button>
|
|
1975
|
+
<button data-wa=sel data-tip="Bound the work area to the current selection">Define from selection</button>
|
|
1976
|
+
<hr>
|
|
1977
|
+
<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>
|
|
1978
|
+
<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>
|
|
1979
|
+
</div>
|
|
1746
1980
|
</div>
|
|
1747
1981
|
</div>
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1982
|
+
<div id=m3dLegend>
|
|
1983
|
+
<div id=m3dPanelHeader>
|
|
1984
|
+
<div id=m3dTabs role=tablist aria-label="3D panel tabs">
|
|
1985
|
+
<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>
|
|
1986
|
+
<button class=m3dtab role=tab data-tab=views aria-selected=false data-tip="Saved views — save, switch, and manage named viewpoints">Views</button>
|
|
1987
|
+
<button class=m3dtab role=tab data-tab=fav aria-selected=false data-tip="Favourite connections — save and re-apply detailed connections">Favourites</button>
|
|
1988
|
+
<!-- Reference models (#278). HIDDEN, not disabled, until the project holds the model-level contract:
|
|
1989
|
+
a tab that can never hold anything is the same dead chrome the header stat spans are hidden for. -->
|
|
1990
|
+
<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>
|
|
1991
|
+
</div>
|
|
1992
|
+
<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>
|
|
1758
1993
|
</div>
|
|
1759
|
-
<
|
|
1994
|
+
<div id=m3dLegendBody class="m3dbody on" role=tabpanel aria-label=Objects></div>
|
|
1995
|
+
<div id=m3dViewsBody class=m3dbody role=tabpanel aria-label=Views></div>
|
|
1996
|
+
<div id=m3dFavBody class=m3dbody role=tabpanel aria-label=Favourites></div>
|
|
1997
|
+
<div id=m3dRefsBody class=m3dbody role=tabpanel aria-label="Reference models"></div>
|
|
1760
1998
|
</div>
|
|
1761
|
-
<div id=
|
|
1762
|
-
<div id=
|
|
1763
|
-
<div id=m3dFavBody class=m3dbody role=tabpanel aria-label=Favourites></div>
|
|
1764
|
-
<div id=m3dRefsBody class=m3dbody role=tabpanel aria-label="Reference models"></div>
|
|
1765
|
-
</div>
|
|
1766
|
-
<div id=m3dCube data-tip="Click a face for that view · right-drag to orbit"></div>
|
|
1767
|
-
<div id=m3dAxes></div>
|
|
1768
|
-
<div id=zoombar>
|
|
1769
|
-
<button id=zOut data-tip="Zoom out">−</button>
|
|
1770
|
-
<input id=zRange type=range min=10 max=400 step=1 value=100>
|
|
1771
|
-
<button id=zIn data-tip="Zoom in">+</button>
|
|
1772
|
-
<span id=zPct>100%</span>
|
|
1773
|
-
<button id=zFit data-tip="Zoom to fit (Home)">Fit</button>
|
|
1999
|
+
<div id=m3dCube data-tip="Click a face for that view · right-drag to orbit"></div>
|
|
2000
|
+
<div id=m3dAxes></div>
|
|
1774
2001
|
</div>
|
|
1775
2002
|
<!-- One bottom dock: the left disclosure shrinks before the right pointer controls, so they cannot collide. -->
|
|
1776
2003
|
<div id=bottomDock>
|
|
@@ -1918,6 +2145,58 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1918
2145
|
<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>
|
|
1919
2146
|
</div>
|
|
1920
2147
|
</div></div>
|
|
2148
|
+
<!-- ── Load a new version of a reference, and say what changed (#734, design §7.3) ──────────────────────
|
|
2149
|
+
FOUR STAGES, one of which is the answer: drop → prog → (refuse | result). The refusal REPLACES the
|
|
2150
|
+
list rather than sitting beside it, because there is no list — AWARE returns no `changes` array at all
|
|
2151
|
+
when nothing pairs, deliberately, so that no caller can render one.
|
|
2152
|
+
REGION ORDER IS header → issues → controls → list → what could not be compared (design pass, decision
|
|
2153
|
+
A). That is a DELIBERATE DEPARTURE from design §7.3, which puts the uncomparable section below the
|
|
2154
|
+
list: the two things needing eyes — a decision, and "we could not tell you everything" — would then
|
|
2155
|
+
sit under up to 12,000 rows. Flagged in the plan, not folded in silently.
|
|
2156
|
+
The propose section (Phase 5) and the version history (Phase 6) belong between the list and the foot
|
|
2157
|
+
when they exist. They are not stubbed here: empty chrome for an unbuilt feature reads as a broken one. -->
|
|
2158
|
+
<div id=refVersionModal><div class=mbackdrop id=rvBackdrop></div>
|
|
2159
|
+
<div class=rvpanel><div class=mhead><b id=rvTitle>Load a new version</b><button id=rvClose data-tip="Close">✕</button></div>
|
|
2160
|
+
<div class=rvbody id=rvBody>
|
|
2161
|
+
<div id=rvDropStage>
|
|
2162
|
+
<div id=rvSubject></div>
|
|
2163
|
+
<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>
|
|
2164
|
+
<div id=rvDropErr role=alert></div>
|
|
2165
|
+
<input id=rvFile type=file accept=".ifc,.ifczip" style="display:none">
|
|
2166
|
+
</div>
|
|
2167
|
+
<!-- The same spinner the import modal borrows from #connImportModal, and the same honest escalating
|
|
2168
|
+
text with no percentage: there is no truthful percentage to be had for a read of two IFCs, and a
|
|
2169
|
+
fabricated bar would be a regression against a choice this feature already made (decision I). -->
|
|
2170
|
+
<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>
|
|
2171
|
+
<div id=rvRefuseStage style="display:none" role=status></div>
|
|
2172
|
+
<div id=rvResultStage style="display:none">
|
|
2173
|
+
<div id=rcHead></div>
|
|
2174
|
+
<div id=rcIssues></div>
|
|
2175
|
+
<div id=rcControls style="display:none"></div>
|
|
2176
|
+
<div id=rcList class=rcregion></div>
|
|
2177
|
+
<div id=rcUncomparable style="display:none"></div>
|
|
2178
|
+
</div>
|
|
2179
|
+
<!-- ── The version history (#734 Phase 6, design §7.3) ──────────────────────────────────────────
|
|
2180
|
+
ITS OWN STAGE, not a section under the change list, and that is DEPARTURE B — flagged rather
|
|
2181
|
+
than folded in. §7.3 puts it below the list; it has to be reachable when there is no list at
|
|
2182
|
+
all, because that is the only way to roll back. Given it must be a surface in its own right,
|
|
2183
|
+
drawing it a second time inside a panel that already holds up to 12,000 rows adds a duplicate
|
|
2184
|
+
and a second scroll region. Reverting is one `rvhPaint()` call into a host after
|
|
2185
|
+
`#rcUncomparable`. Pawel's call; asked in the PR alongside Departure A. -->
|
|
2186
|
+
<div id=rvHistoryStage style="display:none">
|
|
2187
|
+
<div id=rvhSubject></div>
|
|
2188
|
+
<div id=rvhList></div>
|
|
2189
|
+
<!-- `aria-live` as well as `role=status`: the post-rollback outcome lands on a repaint, and without
|
|
2190
|
+
it a screen-reader user gets silence where a sighted one gets the sentence. -->
|
|
2191
|
+
<div id=rvhNote role=status aria-live=polite></div>
|
|
2192
|
+
</div>
|
|
2193
|
+
</div>
|
|
2194
|
+
<div class=rvfoot id=rvFoot>
|
|
2195
|
+
<div id=rvFootNote class=rvnote role=status></div>
|
|
2196
|
+
<button id=rvCancel>Cancel</button>
|
|
2197
|
+
<button id=rvDone class=rvprimary style="display:none">Done</button>
|
|
2198
|
+
</div>
|
|
2199
|
+
</div></div>
|
|
1921
2200
|
<div id=connImportModal><div class=mbackdrop id=ciBackdrop></div>
|
|
1922
2201
|
<div class=mpanel><div class=mhead><b id=ciTitle>Import a connection</b><button id=ciClose data-tip="Close">✕</button></div>
|
|
1923
2202
|
<div id=ciBody>
|
|
@@ -2187,6 +2466,45 @@ let DetailRefs = null; // steel-detail-refs.js — what detail callouts a plan c
|
|
|
2187
2466
|
let TARGET_CONF = null; // the app's target_confidence input default (%), or null when undeclared — drives the chip's "· target N%" goal
|
|
2188
2467
|
let DEV_MODE = false; // /api/health.appChannel; every distribution uses localhost, so hostname cannot identify dev
|
|
2189
2468
|
let view3d = false, view3dReady = false; // 2D|3D toggle state; view3dReady once Steel3DView.init has run
|
|
2469
|
+
// F10(a) — the 2D/3D split. `viewMode` is the source of truth; `view3d` survives, REDEFINED as "the
|
|
2470
|
+
// active pane is 3D", which stops being the same question as "the 3D canvas is on screen" the moment a
|
|
2471
|
+
// split exists. Every variable the later view code reads is declared HERE, in one place: scattering them
|
|
2472
|
+
// into the functions that first use them is a ReferenceError at boot, not a style choice.
|
|
2473
|
+
let SplitView = null; // web/steel-split-view.js — pure layout maths, loaded like ViewGen
|
|
2474
|
+
let viewMode = '2d'; // '2d' | '3d' | 'split' — what is on screen
|
|
2475
|
+
let requestedMode = '2d'; // what the USER last asked for; diverges from viewMode only when a
|
|
2476
|
+
// split will not fit. This is what persists.
|
|
2477
|
+
let activePane = '2d'; // '2d' | '3d' — which pane owns the TOOLS; view3d is derived from it
|
|
2478
|
+
let view3dShown = false; // is the 3D canvas ON SCREEN? (true in '3d' AND in 'split')
|
|
2479
|
+
let view2dShown = true; // …and the plan canvas. Both derived in reflectViewChrome.
|
|
2480
|
+
let splitAvailable = true; // last known "the stage can hold two panes" — the resize edge detector
|
|
2481
|
+
const SPLIT_MODE_KEY='steel:viewMode:v1', SPLIT_RATIO_KEY='steel:splitRatio:v1';
|
|
2482
|
+
// The narrowest the bottom dock's LEFT group may get before it stops docking to the 3D pane and falls
|
|
2483
|
+
// back to spanning the stage. Sized for the BINDING case — 3D active, where the launcher, the hint and
|
|
2484
|
+
// Select/Snap all share the 3D pane's budget: 28px launcher + 8px gap + 28px collapsed status toggle +
|
|
2485
|
+
// 8px before Select/Snap.
|
|
2486
|
+
//
|
|
2487
|
+
// The 2D-active arrangement is cheaper (only the 28px launcher and its 8px gap sit right of the offset —
|
|
2488
|
+
// the hint is over the plan), so between 36 and 72px it would still fit and is nonetheless dropped to the
|
|
2489
|
+
// fallback. That is deliberate: ONE threshold means the two arrangements switch at the same divider
|
|
2490
|
+
// position, so dragging past it does not reshuffle the dock differently depending on which pane happens
|
|
2491
|
+
// to be active. The cost is a narrow band of extra conservatism; the alternative is two thresholds and a
|
|
2492
|
+
// seam the user can find. (Code review — the earlier comment here claimed no arrangement fits below 72,
|
|
2493
|
+
// which is not true of the 2D-active one.)
|
|
2494
|
+
const DOCK_MIN_LEFT_PX=72;
|
|
2495
|
+
// How far INSIDE the 3D pane the docked group sits. Every other pane-anchored control on this stage is
|
|
2496
|
+
// inset by the same 12px — #m3dLegend, #zoombar, and #bottomDock itself are all left:12px — so a launcher
|
|
2497
|
+
// flush on the pane edge was the odd one out, sitting ~3px off the divider's hairline with its shadow
|
|
2498
|
+
// bleeding across the seam. It is also a HIT-TEST fix, which is the half that actually bites:
|
|
2499
|
+
// #m3dLegendLauncher::before extends its target 8px to the LEFT (inset:-1px -8px), and #bottomDock's
|
|
2500
|
+
// z-index:8 beats #splitBar's 6 — so flush on the edge, the launcher was swallowing the bottom ~44px of
|
|
2501
|
+
// the divider, and a press there expanded the 3D panel instead of starting a drag. (Second review.)
|
|
2502
|
+
const DOCK_GUTTER_PX=12;
|
|
2503
|
+
// Extra room required to switch the per-pane layout ON, over what is required to keep it on. Wide enough
|
|
2504
|
+
// that a hand shaking on the divider cannot sit astride the boundary — the switch relocates the launcher
|
|
2505
|
+
// by hundreds of px, so a flicker is far more jarring than a slightly late switch. (Codex review, D2.)
|
|
2506
|
+
const DOCK_HYSTERESIS_PX=32;
|
|
2507
|
+
let splitRatio = 0.5;
|
|
2190
2508
|
// Fallback palette (colorFor indexes this array by profile order) when a contract ships no `palette`
|
|
2191
2509
|
// — e.g. a contract shared/committed with raster_b64 + palette stripped for confidentiality.
|
|
2192
2510
|
const DEFAULT_PAL=['#60a5fa','#94a3b8','#f59e0b','#34d399','#f472b6','#a78bfa','#fb7185','#22d3ee','#facc15','#4ade80'];
|
|
@@ -2253,14 +2571,14 @@ function showEmpty(icon, headline, bodyText, appIdText, opts) {
|
|
|
2253
2571
|
* and this one CAN honour the click, just not yet.
|
|
2254
2572
|
*
|
|
2255
2573
|
* The reflection is optimistic, and main() is what makes it truthful: it routes the pending click
|
|
2256
|
-
* through setView(), whose own failure path (a renderer that did not load) calls applyViewState(
|
|
2574
|
+
* through setView(), whose own failure path (a renderer that did not load) calls applyViewState('2d')
|
|
2257
2575
|
* and puts the toggle back on 2D. Every early return in boot() is a showEmpty(), which replaces the
|
|
2258
2576
|
* whole body — so a queued intent can never outlive the toggle it belongs to.
|
|
2259
2577
|
*/
|
|
2260
|
-
let pendingView = null; // null = untouched;
|
|
2578
|
+
let pendingView = null; // null = untouched; otherwise the MODE string '2d' | '3d' | 'split'
|
|
2261
2579
|
let viewHandlersLive = false; // main() sets it once the real onclick handlers are assigned
|
|
2262
2580
|
function armEarlyViewToggle() {
|
|
2263
|
-
const t2 = document.getElementById('vt2d'), t3 = document.getElementById('vt3d');
|
|
2581
|
+
const t2 = document.getElementById('vt2d'), t3 = document.getElementById('vt3d'), tS = document.getElementById('vtSplit');
|
|
2264
2582
|
if (!t2 || !t3) return;
|
|
2265
2583
|
// Silent by default — nothing is announced and nothing is styled — but it is the correct ARIA for
|
|
2266
2584
|
// "this group's state is mid-update", which is exactly the window a queued press sits in. Cleared at
|
|
@@ -2282,10 +2600,11 @@ function armEarlyViewToggle() {
|
|
|
2282
2600
|
// still sitting at its static zeros and reads the flip as "loading", while a screen-reader user
|
|
2283
2601
|
// gets none of that context and would simply be told "pressed" about a view that is not on screen.
|
|
2284
2602
|
// aria-busy on the group above says "mid-update" instead, which is true.
|
|
2285
|
-
|
|
2286
|
-
|
|
2603
|
+
// A LOOP over the three segments, matching applyViewState — with a third mode, `toggle('on', !want)`
|
|
2604
|
+
// on a pair can no longer express "exactly one of these is pressed".
|
|
2605
|
+
for (const [m, el] of [['2d', t2], ['3d', t3], ['split', tS]]) { if (el) el.classList.toggle('on', want === m); }
|
|
2287
2606
|
});
|
|
2288
|
-
arm(t2,
|
|
2607
|
+
arm(t2, '2d'); arm(t3, '3d'); if (tS) arm(tS, 'split');
|
|
2289
2608
|
}
|
|
2290
2609
|
|
|
2291
2610
|
/**
|
|
@@ -2368,10 +2687,11 @@ function contractFailureState(status, code, serverError, projectScoped) {
|
|
|
2368
2687
|
async function boot() {
|
|
2369
2688
|
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; }
|
|
2370
2689
|
armEarlyViewToggle(); // BEFORE the first await — that is the whole point; see above
|
|
2371
|
-
[SteelCore, ViewGen, ModelCmd, DetailRefs, V2Projection, V2Commands, V2Validation] = await Promise.all([
|
|
2690
|
+
[SteelCore, ViewGen, ModelCmd, DetailRefs, V2Projection, V2Commands, V2Validation, SplitView] = await Promise.all([
|
|
2372
2691
|
import('./steel-3d-core.js'), import('./steel-view-generation.js'), import('./steel-model-commands.js'),
|
|
2373
2692
|
import('./steel-detail-refs.js'), import('./steel-model-v2-projection.js'),
|
|
2374
2693
|
import('./steel-model-v2-commands.js'), import('./steel-model-v2-client-validation.js'),
|
|
2694
|
+
import('./steel-split-view.js'),
|
|
2375
2695
|
]);
|
|
2376
2696
|
const res = await fetch('/api/contract/' + encodeURIComponent(APP_ID) + CONTRACT_QS);
|
|
2377
2697
|
// 204 = the project-scoped "nothing stored yet", the quiet twin of the generic 404 below. It carries
|
|
@@ -4932,7 +5252,7 @@ function updGridToggle(){const b=document.getElementById('gridToggleB');if(!b)re
|
|
|
4932
5252
|
// and the ⋯ menu item — all call this. grid.on is contract data, so the flip is undoable like every
|
|
4933
5253
|
// other grid operation.
|
|
4934
5254
|
function gridSetVisible(on){if(!C||!gridOf()||on===gridOn())return;
|
|
4935
|
-
editGrid(()=>{ModelCmd.patchGrid(gridOf(),{on:!!on});});updGridToggle();refresh3DGrid();if(
|
|
5255
|
+
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
|
|
4936
5256
|
document.addEventListener('gridcore-ready',()=>{try{if(C)render();}catch(_){}}); // module shim finished after boot → paint the grid layer
|
|
4937
5257
|
function setGridMode(on){if(!C)return;gridMode=!!on;
|
|
4938
5258
|
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
|
|
@@ -5372,7 +5692,7 @@ function render(){
|
|
|
5372
5692
|
// killed every call after it on this line (stats/panel/upd*/syncDisplayRows). Measured in Chromium.
|
|
5373
5693
|
svg.innerHTML=s; stats(); panel(); updUR(); updDup(); updConf(); updCS(); updConnBtn(); updBpBtn(); updSpBtn(); syncDisplayRows();
|
|
5374
5694
|
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()).
|
|
5375
|
-
if(
|
|
5695
|
+
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)
|
|
5376
5696
|
try{updateConnCrumb();}catch(_){} // Connection Component breadcrumb follows the selection (3D-only; hidden at root)
|
|
5377
5697
|
syncPropLabelsAfterRender(); // corner-note + push labels to 3D + refresh the popup rows against the (possibly changed) selection
|
|
5378
5698
|
}
|
|
@@ -5504,7 +5824,10 @@ function treeSelectConn(conn,mods){
|
|
|
5504
5824
|
// 3D view's own ascend/whole-select so the canvas selection + envelope stay in lockstep. 3D-only; hidden at root.
|
|
5505
5825
|
function updateConnCrumb(){
|
|
5506
5826
|
const el=document.getElementById('connCrumb'); if(!el) return;
|
|
5507
|
-
|
|
5827
|
+
// view3dShown: #connCrumb is a floating breadcrumb OVER the 3D canvas (moved into #pane3d with it), not
|
|
5828
|
+
// inspector content. Drill into a connection, click the plan, and it would vanish while the envelope it
|
|
5829
|
+
// labels stayed on screen.
|
|
5830
|
+
const cs=view3dShown?connSelInfo():null;
|
|
5508
5831
|
if(!cs){ el.style.display='none'; el.innerHTML=''; return; }
|
|
5509
5832
|
const name=connKindLabel(cs.kind)+' · '+cs.main;
|
|
5510
5833
|
let html='<button class=seg data-lvl=root data-tip="Back to the model (deselect)">Model</button><span class=sep>▸</span>';
|
|
@@ -6859,7 +7182,7 @@ function renderPropLabels(){const pl=C.prop_labels;propLabelsHidden=0;if(!pl||!p
|
|
|
6859
7182
|
// right-click a member. Measured by review, not reasoned about. The honest place for that explanation is
|
|
6860
7183
|
// the popup where "Clear all" lives, not the canvas.
|
|
6861
7184
|
function updatePropHint(){let el=document.getElementById('plHint');
|
|
6862
|
-
const show
|
|
7185
|
+
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
|
|
6863
7186
|
if(!show){if(el)el.style.display='none';return;}
|
|
6864
7187
|
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);}
|
|
6865
7188
|
const st=document.getElementById('stage').getBoundingClientRect();
|
|
@@ -7648,10 +7971,15 @@ function updCS(){const s=document.getElementById('csStat');const r=document.getE
|
|
|
7648
7971
|
// themed transient toast (baseline tokens — never a native alert)
|
|
7649
7972
|
// `sticky` holds the toast up with no timer — for an operation whose result the user must see land
|
|
7650
7973
|
// (the Tekla send takes seconds); the next plain toast() replaces the text and re-arms the timer.
|
|
7651
|
-
|
|
7652
|
-
|
|
7974
|
+
// `ms` stretches the ordinary timer for a message that is genuinely longer to READ (the session-carryover
|
|
7975
|
+
// sentence runs to three clauses). It is not a second sticky: it always expires on its own.
|
|
7976
|
+
// `max-width` because a sentence that long would otherwise stretch to the full width of a wide monitor
|
|
7977
|
+
// before it wrapped, which is a line the eye cannot track back from.
|
|
7978
|
+
const TOAST_MS=2600;
|
|
7979
|
+
function toast(msg,sticky,ms){let t=document.getElementById('toast');
|
|
7980
|
+
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);}
|
|
7653
7981
|
t.setAttribute('role','status');t.setAttribute('aria-live','polite');t.setAttribute('aria-atomic','true');
|
|
7654
|
-
t.textContent=msg;t.style.opacity='1';clearTimeout(t._h);if(!sticky)t._h=setTimeout(()=>{t.style.opacity='0';},
|
|
7982
|
+
t.textContent=msg;t.style.opacity='1';clearTimeout(t._h);if(!sticky)t._h=setTimeout(()=>{t.style.opacity='0';},ms>0?ms:TOAST_MS);}
|
|
7655
7983
|
// --- pointer: select(+ctrl toggle / box) + group-move + endpoint (Shift = ortho) ---
|
|
7656
7984
|
svg.addEventListener('pointerdown',e=>{if(e.button!==0)return;const t=e.target;
|
|
7657
7985
|
if(csaxisMode){csClick(e);e.preventDefault();return;} // set-local-axes armed → clicks define origin then X-direction
|
|
@@ -7954,7 +8282,7 @@ document.getElementById('csArm3dB').onclick=()=>{const d3=window.Steel3DView;if(
|
|
|
7954
8282
|
*
|
|
7955
8283
|
* WHAT A ROW ON A READ-ONLY DOCUMENT REPORTS. Dimensions and Callouts draw onto the 2D plan, and
|
|
7956
8284
|
* Reference sheet draws the traced sheet under it. A v2 document has no 2D plan — render() returns before
|
|
7957
|
-
* drawing one and the 2D tab
|
|
8285
|
+
* drawing one, and the 2D tab has nothing honest to draw — so those three are OFF and disabled.
|
|
7958
8286
|
* Member length is deliberately different: it is a model-space read that paints in 3D, the view a v2
|
|
7959
8287
|
* document opens in. It therefore reports the shared preference and remains live in read-only mode.
|
|
7960
8288
|
*
|
|
@@ -8369,11 +8697,104 @@ reflectOriginGrid();
|
|
|
8369
8697
|
let startX=0,startW=0;
|
|
8370
8698
|
const onMove=e=>apply(startW+(startX-e.clientX),false); // handle on the panel's LEFT edge → drag left = wider
|
|
8371
8699
|
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())));};
|
|
8372
|
-
|
|
8700
|
+
// Same explicit focus, and for the same reason, as the split divider below: preventDefault() kills the
|
|
8701
|
+
// browser's click-to-focus, so this resizer's own arrow-key nudge was unreachable after a click too. It
|
|
8702
|
+
// is the older of the two separators and shipped that way; the split divider is documented as "the
|
|
8703
|
+
// #panelResizer recipe, gesture for gesture", which is only true if both are fixed. (UX review.)
|
|
8704
|
+
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);});
|
|
8373
8705
|
rz.addEventListener('dblclick',()=>{root.style.removeProperty('--panelw');localStorage.removeItem(KEY);}); // reset to the 240px default
|
|
8374
|
-
|
|
8706
|
+
// stopPropagation for the same reason the split divider below carries it: steel-3d-view.js binds onKey
|
|
8707
|
+
// on WINDOW and only skips INPUT/SELECT/TEXTAREA, so a div[tabindex=0] sails through. This handler was
|
|
8708
|
+
// unreachable by mouse until the focus() above, which is exactly what made the collision reachable —
|
|
8709
|
+
// with the 3D pane active, click + ArrowLeft resized the panel AND panned the camera. (Codex review of
|
|
8710
|
+
// the fix, F5: measured 240→252px with the 3D view moving underneath it.)
|
|
8711
|
+
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);}});
|
|
8375
8712
|
window.addEventListener('resize',()=>{if(root.style.getPropertyValue('--panelw'))apply(curW(),false);}); // re-clamp if the viewport shrank
|
|
8376
8713
|
})();
|
|
8714
|
+
// The split divider. Deliberately the #panelResizer recipe above, gesture for gesture — drag,
|
|
8715
|
+
// double-click to reset, arrow keys with a Shift coarse step — so the editor's two separators behave the
|
|
8716
|
+
// same. The difference is the UNIT: this one stores a RATIO, not a width, so the split survives a window
|
|
8717
|
+
// resize proportionally instead of pinning one pane and squeezing the other into its minimum.
|
|
8718
|
+
(function(){
|
|
8719
|
+
const bar=document.getElementById('splitBar'); if(!bar)return;
|
|
8720
|
+
const wrap=document.getElementById('stagewrap');
|
|
8721
|
+
const apply=applySplitRatio;
|
|
8722
|
+
// Read the divider width back from CSS rather than repeating the number — clampRatio's denominator
|
|
8723
|
+
// (stage width − divider) has to be the SAME quantity the pane calc() subtracts, and two 7s that drift
|
|
8724
|
+
// apart would put the panes and their minimum-width rule quietly out of step.
|
|
8725
|
+
const dividerPx=()=>{const v=parseFloat(getComputedStyle(wrap).getPropertyValue('--split-divider'));return Number.isFinite(v)?v:SplitView.DIVIDER_PX;};
|
|
8726
|
+
// Measure from the pointer MINUS half the divider, because the ratio addresses the divider's left edge
|
|
8727
|
+
// while the user grabs its middle. Without the offset the bar jumps ~3.5px toward the pointer on the
|
|
8728
|
+
// first move of every drag — small, but it makes a careful adjustment feel like it slipped. (Codex
|
|
8729
|
+
// review, H10.)
|
|
8730
|
+
const ratioAt=clientX=>{const r=wrap.getBoundingClientRect(),d=dividerPx();return (clientX-r.left-d/2)/Math.max(1,r.width-d);};
|
|
8731
|
+
// onMove is the STREAM — no `settled`, so the fit gate keeps its full turn-on slack against hand jitter.
|
|
8732
|
+
// The pointerup that ENDS a real drag settles, so the layout comes to rest on what actually fits rather
|
|
8733
|
+
// than on whichever side of the slack the last sample happened to land.
|
|
8734
|
+
//
|
|
8735
|
+
// …but ONLY if the divider actually moved, which is what `moved` is for. Every pointerdown gets a pointerup
|
|
8736
|
+
// whether or not it was a drag, so settling unconditionally meant a bare CLICK on the divider — the one that
|
|
8737
|
+
// focuses it for the arrow keys — could re-dock the chrome on its own, and a DOUBLE-click fired two settled
|
|
8738
|
+
// pointerups and THEN the dblclick reset: starting off with room in [72,104) the first pointerup docked and
|
|
8739
|
+
// the reset to 50% could immediately undock, a visible teleport inside one gesture. That is the very
|
|
8740
|
+
// oscillation the slack exists to prevent, so a pointerup that moved nothing must change nothing.
|
|
8741
|
+
// (Codex review, E1.)
|
|
8742
|
+
// …and `moved` keys on DISPLACEMENT, not on the event: a pointermove can fire at the same coordinates
|
|
8743
|
+
// (the spec lets it report a change in pressure or contact geometry alone), and a hand delivering a click
|
|
8744
|
+
// rarely holds still to the pixel — either would have made a click a "drag" again and reopened the whole
|
|
8745
|
+
// defect. DRAG_SLOP is the usual click-vs-drag tolerance; below it the divider still tracks the pointer
|
|
8746
|
+
// through the stream, it simply does not count as a gesture that may settle. (Codex review, F3.)
|
|
8747
|
+
const DRAG_SLOP=3;
|
|
8748
|
+
// ONE gesture at a time, identified by its pointerId. The handlers live on `window` and the state below is
|
|
8749
|
+
// shared, so without this a second finger's pointerdown re-based pressX mid-drag (making the slop measure
|
|
8750
|
+
// from the wrong origin) and ANY pointerup or pointercancel — from a pointer that never touched the
|
|
8751
|
+
// divider — tore the live gesture down. A second press does not RE-USE this state, it replaces it: see the
|
|
8752
|
+
// pointerdown handler, which ends the standing gesture first. (Codex review, G4 and H1.)
|
|
8753
|
+
let dragId=null,pressX=0,pressRatio=0.5,moved=false;
|
|
8754
|
+
const endDrag=()=>{if(dragId!==null){try{bar.releasePointerCapture(dragId);}catch(_){}}dragId=null;bar.classList.remove('drag');document.body.style.userSelect='';window.removeEventListener('pointermove',onMove);window.removeEventListener('pointerup',onUp);window.removeEventListener('pointercancel',onCancel);};
|
|
8755
|
+
const onMove=e=>{if(e.pointerId!==dragId)return;if(Math.abs(e.clientX-pressX)>DRAG_SLOP)moved=true;apply(ratioAt(e.clientX),false);};
|
|
8756
|
+
const onUp=e=>{if(e.pointerId!==dragId)return;endDrag();apply(splitRatio,true,moved);};
|
|
8757
|
+
// A CANCEL IS NOT A RELEASE. pointercancel means the gesture was taken away — the browser claimed it for a
|
|
8758
|
+
// scroll, the pen left range, the touch was interrupted — so it must not keep the position the user never
|
|
8759
|
+
// finished choosing. It restores the ratio captured at pointerdown, which the stream has been overwriting
|
|
8760
|
+
// all along; running the success path here instead would persist a half-made drag and could re-dock on it.
|
|
8761
|
+
// Sharing only the teardown is what stops an interrupted drag stranding `.drag`, the userSelect lock, the
|
|
8762
|
+
// listeners, and a `moved:true` that a later unrelated pointerup would have settled on.
|
|
8763
|
+
//
|
|
8764
|
+
// NEITHER `save` NOR `settled`, and both omissions are the point. Saving would write the RESTORED number
|
|
8765
|
+
// over the stored preference — and those are not the same thing: a wide-window 0.85 that this narrow stage
|
|
8766
|
+
// clamped to 0.596 is still 0.85 in storage, so a cancel that saved would quietly destroy the wider layout
|
|
8767
|
+
// the user chose. Settling would let a cancel turn the dock gate ON through the bare threshold, moving the
|
|
8768
|
+
// launcher hundreds of px as the outcome of a gesture that was ABANDONED. (Codex review, F1, G3 and H3.)
|
|
8769
|
+
const onCancel=e=>{if(e.pointerId!==dragId)return;endDrag();apply(pressRatio,false);};
|
|
8770
|
+
// focus() explicitly, because the preventDefault() on the line before it suppresses the browser's OWN
|
|
8771
|
+
// click-to-focus — and this separator promises an arrow-key nudge, which needs focus to reach the keydown
|
|
8772
|
+
// handler below. Without it, "click the divider, then press Left/Right" silently did nothing: focus
|
|
8773
|
+
// stayed on #stage and aria-valuenow never moved off 50. Once per pointerdown and never in pointermove,
|
|
8774
|
+
// so a drag does not re-announce the separator on every sample. Chromium DOES match `:focus-visible` for
|
|
8775
|
+
// this focus (measured), so a clicked divider keeps the brand tint until focus leaves — kept deliberately:
|
|
8776
|
+
// it is the existing focus state, not a new one, and it says the separator now owns the arrow keys.
|
|
8777
|
+
// (Independent QA E2E, item 14.)
|
|
8778
|
+
// A new press ENDS any gesture still standing rather than being refused. Refusing was the obvious reading of
|
|
8779
|
+
// "one at a time" and it is the one that can wedge: nothing captured the pointer, so a release outside the
|
|
8780
|
+
// browser window was never delivered, `dragId` stayed set, and every later press was turned away — a
|
|
8781
|
+
// divider dead for the rest of the page's life. Taking over cannot wedge, and the pointerId filter still
|
|
8782
|
+
// stops the OLD pointer's events from touching the new gesture. setPointerCapture is the other half: it is
|
|
8783
|
+
// what makes the terminal event arrive at all once the pointer leaves the window, which is exactly what a
|
|
8784
|
+
// slider-like control needs. (Codex review, G4 and H1.)
|
|
8785
|
+
bar.addEventListener('pointerdown',e=>{if(dragId!==null)endDrag();e.preventDefault();bar.focus({preventScroll:true});bar.classList.add('drag');document.body.style.userSelect='none';dragId=e.pointerId;pressX=e.clientX;pressRatio=splitRatio;moved=false;try{bar.setPointerCapture(e.pointerId);}catch(_){}window.addEventListener('pointermove',onMove);window.addEventListener('pointerup',onUp);window.addEventListener('pointercancel',onCancel);});
|
|
8786
|
+
bar.addEventListener('dblclick',()=>apply(0.5,true,true));
|
|
8787
|
+
// stopPropagation, not just preventDefault: steel-3d-view.js binds onKey on WINDOW and only skips
|
|
8788
|
+
// INPUT/SELECT/TEXTAREA, so a div[tabindex=0] sails through it. Without this, an arrow key on the
|
|
8789
|
+
// focused divider moved the divider AND panned the 3D camera — and this divider exists only in the mode
|
|
8790
|
+
// where the 3D canvas is always on screen, so that collision is routine, not theoretical. (Code review.)
|
|
8791
|
+
bar.addEventListener('keydown',e=>{const step=(e.shiftKey?0.1:0.02);
|
|
8792
|
+
if(e.key==='ArrowLeft'){e.preventDefault();e.stopPropagation();apply(splitRatio-step,true,true);}
|
|
8793
|
+
else if(e.key==='ArrowRight'){e.preventDefault();e.stopPropagation();apply(splitRatio+step,true,true);}});
|
|
8794
|
+
// Re-clamp the geometry on every resize frame. Distinct from onStageResize, which changes the MODE and
|
|
8795
|
+
// only on an availability edge; both may coexist because they answer different questions.
|
|
8796
|
+
window.addEventListener('resize',()=>{if(viewMode==='split')apply(splitRatio,false);});
|
|
8797
|
+
})();
|
|
8377
8798
|
// Properties panel: collapse the inspector and its resizer as one unit, but retain the user's saved width.
|
|
8378
8799
|
// The edge button lives outside #panel because panel() replaces that aside's contents on every selection.
|
|
8379
8800
|
(function(){
|
|
@@ -9132,7 +9553,9 @@ const view3dApi={
|
|
|
9132
9553
|
// Re-extrude the 3D model after a structural edit (keeps the camera where it is). Selection-only
|
|
9133
9554
|
// changes go through render()'s setSelection — only geometry mutations need a rebuild.
|
|
9134
9555
|
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)
|
|
9135
|
-
|
|
9556
|
+
// view3dShown, not view3d: in a split with the PLAN pane active, an edit must still rebuild the model in
|
|
9557
|
+
// the pane beside it — that is the one thing the split exists to let you watch.
|
|
9558
|
+
function sync3D(){invalidateConnectionDiagnostics();panel();if(view3dShown&&view3dReady&&window.Steel3DView){window.Steel3DView.rebuild(false).then(()=>{
|
|
9136
9559
|
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
|
|
9137
9560
|
else window.Steel3DView.setSelection(selIds);
|
|
9138
9561
|
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
|
|
@@ -9377,9 +9800,11 @@ function saveLegendTab(){try{localStorage.setItem('floless.legendTab',legendTab)
|
|
|
9377
9800
|
function reflectLegendPanel(){
|
|
9378
9801
|
const p=document.getElementById('m3dLegend'),launch=document.getElementById('m3dLegendLauncher'),collapse=document.getElementById('m3dLegendCollapse');
|
|
9379
9802
|
syncLegendClearance();
|
|
9380
|
-
|
|
9803
|
+
// The Objects panel lives INSIDE the 3D pane, so it follows that pane being on screen — hiding it
|
|
9804
|
+
// because the plan happens to hold the tools would blank a panel the user can still see the pane of.
|
|
9805
|
+
const open=!!view3dShown&&!legendCollapsed;
|
|
9381
9806
|
if(p)p.style.display=open?'flex':'none';
|
|
9382
|
-
if(launch){launch.style.display=
|
|
9807
|
+
if(launch){launch.style.display=view3dShown&&legendCollapsed?'flex':'none';launch.setAttribute('aria-expanded',String(open));}
|
|
9383
9808
|
if(collapse)collapse.setAttribute('aria-expanded',String(open));
|
|
9384
9809
|
updateViewsBtn();
|
|
9385
9810
|
}
|
|
@@ -9417,7 +9842,10 @@ wireLegendTabs(); // the panel shell is static markup — wire it immediately so
|
|
|
9417
9842
|
// Keep the bottom-left panel below the toolbar's real wrapped height. ResizeObserver also catches
|
|
9418
9843
|
// width changes caused by the properties panel opening/closing, not just window resizes.
|
|
9419
9844
|
function syncLegendClearance(){
|
|
9420
|
-
|
|
9845
|
+
// #pane3d, not #stagewrap: the panel and the toolbar both live in the 3D pane now, so the clearance
|
|
9846
|
+
// must be measured against — and set on — the box that actually bounds them. In a single mode the pane
|
|
9847
|
+
// IS the whole stage, so this computes the same number it always did.
|
|
9848
|
+
const stage=document.getElementById('pane3d'),bar=document.getElementById('m3dBar');if(!stage||!bar)return;
|
|
9421
9849
|
const sr=stage.getBoundingClientRect(),br=bar.getBoundingClientRect();
|
|
9422
9850
|
const clearance=Math.ceil(Math.max(0,br.bottom-sr.top)+72)+'px'; // 8px gap + 64px bottom chrome
|
|
9423
9851
|
if(stage.style.getPropertyValue('--m3d-legend-clearance')!==clearance)stage.style.setProperty('--m3d-legend-clearance',clearance);
|
|
@@ -9978,7 +10406,7 @@ const refApi=(suffix)=>'/api/steel/'+encodeURIComponent(APP_ID)+'/reference'+suf
|
|
|
9978
10406
|
|
|
9979
10407
|
/** Hand the 3D layer everything it draws. Called after any geometry arrival or display/placement edit. */
|
|
9980
10408
|
function pushReferences(){
|
|
9981
|
-
if(!window.Steel3DView||!window.Steel3DView.setReferences||!
|
|
10409
|
+
if(!window.Steel3DView||!window.Steel3DView.setReferences||!view3dShown)return; // reference geometry must reach a VISIBLE 3D pane, whichever pane holds the tools
|
|
9982
10410
|
window.Steel3DView.setReferences(refList().map(r=>({
|
|
9983
10411
|
id:r.id,name:r.name,placement:r.placement||null,display:refDisp(r),
|
|
9984
10412
|
objects:(refGeom.get(r.id)||{}).objects||[],
|
|
@@ -10577,7 +11005,7 @@ function buildRefRow(r){
|
|
|
10577
11005
|
// The tip ENUMERATES the menu, so adding an item without touching it leaves the anchor advertising a
|
|
10578
11006
|
// menu that no longer exists. (Caught in the browser pass: Stage D's item shipped while this still read
|
|
10579
11007
|
// "move it next to your model, reload, remove".)
|
|
10580
|
-
dots.setAttribute('role','button');dots.dataset.tip='More — measure a distance, move it next to your model, reload, remove';
|
|
11008
|
+
dots.setAttribute('role','button');dots.dataset.tip='More — measure a distance, move it next to your model, load a new version, reload, remove';
|
|
10581
11009
|
dots.addEventListener('click',e=>{e.stopPropagation();openRefRowMenu(r,dots);});
|
|
10582
11010
|
row.appendChild(dots);
|
|
10583
11011
|
|
|
@@ -10970,6 +11398,173 @@ function groupReferenceObjects(objects){
|
|
|
10970
11398
|
return out;
|
|
10971
11399
|
}
|
|
10972
11400
|
|
|
11401
|
+
/**
|
|
11402
|
+
* The session state a re-read destroys — captured before it happens, re-attached after (#734 Phase 5).
|
|
11403
|
+
*
|
|
11404
|
+
* `Reload its geometry` and `Load a new version…` both replace a reference's objects wholesale, and three
|
|
11405
|
+
* pieces of live state are addressed by exactly what that replaces: the drilled-into object (by ARRAY
|
|
11406
|
+
* INDEX), the tree's open/closed groups (by POSITION — '2:1' is the second storey's second type), and the
|
|
11407
|
+
* measurement (by RAW WORLD POINTS). Dropping all three is honest but wasteful, because two of them do
|
|
11408
|
+
* carry identity the new read can be matched on. So they are migrated, and only what could NOT be matched
|
|
11409
|
+
* is said out loud. Nothing here is ever allowed to vanish silently.
|
|
11410
|
+
*
|
|
11411
|
+
* TWO HALVES, because the new objects do not exist yet at the moment the old ones are thrown away.
|
|
11412
|
+
* `refSessionSnapshot` resolves the positional state into LABELS while the old objects are still in
|
|
11413
|
+
* `refGeom`; `refSessionMigrate` resolves those labels back into positions against the new ones and
|
|
11414
|
+
* returns what it could not place.
|
|
11415
|
+
*/
|
|
11416
|
+
function refSessionSnapshot(id){
|
|
11417
|
+
const objects=(refGeom.get(id)||{}).objects;
|
|
11418
|
+
const groups=Array.isArray(objects)?groupReferenceObjects(objects):[];
|
|
11419
|
+
const keys=[];
|
|
11420
|
+
for(const [key,val] of (refTreeGroups.get(id)||[])){
|
|
11421
|
+
const [si,ti]=key.split(':');
|
|
11422
|
+
const s=groups[Number(si)];
|
|
11423
|
+
if(!s)continue; // a key with no group behind it is already dead — there is nothing to carry
|
|
11424
|
+
if(ti===undefined){keys.push({storey:s.storey,type:undefined,val});continue;}
|
|
11425
|
+
const t=s.types[Number(ti)];
|
|
11426
|
+
if(t)keys.push({storey:s.storey,type:t.type,val});
|
|
11427
|
+
}
|
|
11428
|
+
return {
|
|
11429
|
+
// WHETHER there was one is all that is wanted. The drilled-into object migrates a layer down —
|
|
11430
|
+
// `revalidateSubSelection` keys on GlobalId and moves the selection to wherever that object now sits —
|
|
11431
|
+
// so the answer to "did it survive" is read off the editor's own index afterwards, which that layer has
|
|
11432
|
+
// by then either rewritten or cleared.
|
|
11433
|
+
hadObject:refSelectedId===id&&refSelectedObjIdx!==null,
|
|
11434
|
+
// ITS IDENTITY, not just its index — so whether it survived can be answered from the objects that
|
|
11435
|
+
// arrive rather than from whether the 3D layer happened to run. See `objectSurvives`.
|
|
11436
|
+
objectGid:(refSelectedId===id&&refSelectedObjIdx!==null&&Array.isArray(objects)&&objects[refSelectedObjIdx])
|
|
11437
|
+
?(objects[refSelectedObjIdx].globalId||null):null,
|
|
11438
|
+
// A FINISHED MEASUREMENT ONLY. The tool being armed with no result yet is a disarm, not a loss, and
|
|
11439
|
+
// saying "your measurement was dropped" about a measurement that was never taken is a false report.
|
|
11440
|
+
hadMeasure:!!(refMeasure&&refMeasure.refId===id),
|
|
11441
|
+
keys,
|
|
11442
|
+
};
|
|
11443
|
+
}
|
|
11444
|
+
|
|
11445
|
+
/**
|
|
11446
|
+
* Re-attach what the snapshot holds to the geometry that has now arrived, and return what could not be.
|
|
11447
|
+
*
|
|
11448
|
+
* Called AFTER `pushReferences()`, which is what runs the 3D layer's own object migration — reading
|
|
11449
|
+
* `refSelectedObjIdx` any earlier asks whether the object survived before anything has tried to save it.
|
|
11450
|
+
* Returns the FACT PHRASES for `refCarryoverSentence`, in the order they read best, or an empty array
|
|
11451
|
+
* when everything carried — which is the ordinary outcome and must stay silent.
|
|
11452
|
+
*/
|
|
11453
|
+
function refSessionMigrate(id,snap){
|
|
11454
|
+
const RS=window.ReferenceSession;
|
|
11455
|
+
const facts=[];
|
|
11456
|
+
// GONE MEANS GONE, AND MEANS SAY NOTHING. A reference can be removed while its re-read is still in
|
|
11457
|
+
// flight — the version route detaches from the client on purpose, so the read really does finish — and
|
|
11458
|
+
// everything below would then be true but useless: "the object you had open didn't carry over" about a
|
|
11459
|
+
// file the user has just deliberately deleted. `refRemove` has already said what happened, and nothing
|
|
11460
|
+
// here is a loss this re-read caused. (Codex review.)
|
|
11461
|
+
if(!refById(id))return facts;
|
|
11462
|
+
const objects=(refGeom.get(id)||{}).objects;
|
|
11463
|
+
// THE OBJECT IS ASKED ABOUT EVEN WHEN NOTHING ARRIVED — a failed read genuinely does take the drilled
|
|
11464
|
+
// object away, and that is the case where an unexplained empty panel is most confusing.
|
|
11465
|
+
//
|
|
11466
|
+
// ASKED OF THE OBJECTS, NOT OF THE SELECTION. Whether the re-read kept this object is a question about
|
|
11467
|
+
// the file; whether the user is still looking at it is not. Reading the editor's index instead gets both
|
|
11468
|
+
// directions wrong: it is stale while the 3D view is inactive (`pushReferences` no-ops), which reads as
|
|
11469
|
+
// "survived"; and it changes whenever the user clicks something else during a read that can run for a
|
|
11470
|
+
// minute, which would report a loss for an object that is still there. A false report costs exactly what
|
|
11471
|
+
// a missing one costs. (Codex + review.)
|
|
11472
|
+
if(snap.hadObject&&!refObjectSurvives(snap.objectGid,objects))facts.push('the object you had open');
|
|
11473
|
+
// A READ THAT BROUGHT NOTHING BACK STILL TOOK THE GROUPS. The keys were cleared before the fetch, so
|
|
11474
|
+
// there is nothing to re-key onto and the state is gone for good — saying nothing here left the user to
|
|
11475
|
+
// discover it on the retry, which is the one place the object and the measurement were reported and the
|
|
11476
|
+
// groups silently were not. The row says the file could not be read; this says what it cost. (Review.)
|
|
11477
|
+
if(!Array.isArray(objects)){
|
|
11478
|
+
if(snap.keys.some((k)=>k.val&&k.val.open))facts.push('the groups you had open');
|
|
11479
|
+
if(snap.keys.length)console.warn('[reference] the re-read of',id,'returned no objects — its tree state could not be carried');
|
|
11480
|
+
}else if(RS){
|
|
11481
|
+
const {keys,lost}=RS.migrateGroupKeys(snap.keys,groupReferenceObjects(objects));
|
|
11482
|
+
// MERGED OVER WHAT IS ALREADY THERE, not written over it. `pushReferences` runs before this and can
|
|
11483
|
+
// reach `revealRefTreeObject`, which opens the path to the drilled object under its own `q:null` mark;
|
|
11484
|
+
// a whole-map replace here would discard exactly the opens that make the migrated selection visible.
|
|
11485
|
+
// The reveal wins, because it describes where the selection actually is now.
|
|
11486
|
+
//
|
|
11487
|
+
// AND EACH CHOICE IS RE-FILED AGAINST THE QUERY THAT IS ACTUALLY IN THE BOX. A choice records the
|
|
11488
|
+
// query it was made under and applies only when that query returns, so carrying the OLD query forward
|
|
11489
|
+
// makes every restored choice inert the moment anything has changed the filter — and the reveal above
|
|
11490
|
+
// is itself one of the things that changes it (it clears the box when the drilled object no longer
|
|
11491
|
+
// matches). Re-filing keeps the user's open/closed intent applicable instead of technically preserved
|
|
11492
|
+
// and permanently unused. (Review.)
|
|
11493
|
+
const q=(refTreeQuery.get(id)||'').trim().toLowerCase();
|
|
11494
|
+
const refiled=new Map([...keys].map(([k,v])=>[k,v&&v.q===null?v:{open:!!(v&&v.open),q}]));
|
|
11495
|
+
const revealed=refTreeGroups.get(id);
|
|
11496
|
+
const next=revealed&&revealed.size?new Map([...refiled,...revealed]):refiled;
|
|
11497
|
+
// Set even when empty, so a migration that placed nothing CLEARS the stale positional keys rather than
|
|
11498
|
+
// leaving them addressing whatever now sits at those positions.
|
|
11499
|
+
refTreeGroups.set(id,next);
|
|
11500
|
+
// Worded here, because `ifcTypeWords` and "No storey recorded" are this page's vocabulary — the module
|
|
11501
|
+
// matches on the file's raw tokens and deliberately knows nothing about how a header reads.
|
|
11502
|
+
const g=RS.groupsFact(lost.map((k)=>(k.storey||'No storey recorded')
|
|
11503
|
+
+(k.type===undefined?'':' · '+(ifcTypeWords(k.type)||'No type recorded'))));
|
|
11504
|
+
if(g)facts.push(g);
|
|
11505
|
+
}else{
|
|
11506
|
+
// THE MODULE IS ABSENT AND THE GROUPS CANNOT BE RE-KEYED. Reported rather than skipped: they were
|
|
11507
|
+
// cleared before the read, so this is a real loss, and a missing script is exactly when a feature
|
|
11508
|
+
// that promises never to drop state silently must not start doing so. (Review.)
|
|
11509
|
+
console.error('[reference] reference-session.js did not load — the tree state of',id,'could not be carried');
|
|
11510
|
+
if(snap.keys.some((k)=>k.val&&k.val.open))facts.push('the groups you had open');
|
|
11511
|
+
}
|
|
11512
|
+
if(snap.hadMeasure)facts.push('your measurement');
|
|
11513
|
+
return facts;
|
|
11514
|
+
}
|
|
11515
|
+
|
|
11516
|
+
/**
|
|
11517
|
+
* The one sentence, in the voice each path can honestly use. `null` means say nothing — and mean it.
|
|
11518
|
+
*
|
|
11519
|
+
* IT COMPOSES WITHOUT THE MODULE IF IT HAS TO. `reference-session.js` is one 404, one CSP rule or one
|
|
11520
|
+
* future syntax error away from being absent, and returning `null` there would throw away facts that
|
|
11521
|
+
* were computed without it — leaving the geometry replaced and the user told nothing, which is the exact
|
|
11522
|
+
* behaviour this feature exists to end. The fallback is a worse sentence, not no sentence. (Review.)
|
|
11523
|
+
*/
|
|
11524
|
+
const CARRYOVER_TAIL_FALLBACK={reload:'into the re-read file',version:'from the version you had'};
|
|
11525
|
+
/**
|
|
11526
|
+
* Did the drilled-into object survive this read? Same rule as the module's, usable without it.
|
|
11527
|
+
*
|
|
11528
|
+
* An id that is absent says nothing and an id that repeats cannot say which object you were on, so only
|
|
11529
|
+
* an id appearing EXACTLY once counts — the rule `revalidateSubSelection` applies one layer down. The
|
|
11530
|
+
* in-page arm exists for the same reason the sentence has one: a missing module must not silently turn
|
|
11531
|
+
* "your object is gone" into "everything carried".
|
|
11532
|
+
*/
|
|
11533
|
+
function refObjectSurvives(gid,objects){
|
|
11534
|
+
const RS=window.ReferenceSession;
|
|
11535
|
+
if(RS)return RS.objectSurvives(gid,objects);
|
|
11536
|
+
if(gid===null||gid===undefined||gid==='')return false;
|
|
11537
|
+
let seen=0;
|
|
11538
|
+
for(const o of objects||[]){if(o&&o.globalId===gid&&++seen>1)return false;}
|
|
11539
|
+
return seen===1;
|
|
11540
|
+
}
|
|
11541
|
+
function refCarryoverSentence(facts,path){
|
|
11542
|
+
const RS=window.ReferenceSession;
|
|
11543
|
+
if(RS)return RS.carryoverSentence(facts,RS.CARRYOVER_TAIL[path]);
|
|
11544
|
+
const list=(facts||[]).filter(Boolean);
|
|
11545
|
+
if(!list.length)return null;
|
|
11546
|
+
const words=list.length===1?list[0]:list.slice(0,-1).join(', ')+' and '+list[list.length-1];
|
|
11547
|
+
return (list.length===1?'One thing didn’t carry over ':'A few things didn’t carry over ')
|
|
11548
|
+
+CARRYOVER_TAIL_FALLBACK[path]+': '+words+'.';
|
|
11549
|
+
}
|
|
11550
|
+
|
|
11551
|
+
/**
|
|
11552
|
+
* Say it, on the reload path, where there is no panel to hang it on.
|
|
11553
|
+
*
|
|
11554
|
+
* A TOAST, AND DELIBERATELY NOT A STICKY ONE. `sticky` has no dismiss control — it is cleared only by
|
|
11555
|
+
* the next plain toast (:7802) — and a reload has no guaranteed follow-up, so it would strand a bar with
|
|
11556
|
+
* nothing to take it down. The timer is stretched per fact instead: a three-clause sentence is not
|
|
11557
|
+
* readable in the 2.6 s a one-line confirmation needs.
|
|
11558
|
+
*/
|
|
11559
|
+
function refSessionSay(id,facts){
|
|
11560
|
+
const s=refCarryoverSentence(facts,'reload');
|
|
11561
|
+
if(!s)return;
|
|
11562
|
+
const r=refById(id);
|
|
11563
|
+
// NAMED, unlike the version panel's copy of this sentence — that one sits under a header already saying
|
|
11564
|
+
// which reference and which version this is, and this one sits under nothing at all.
|
|
11565
|
+
toast((r&&r.name?'“'+r.name+'” — ':'')+s,false,TOAST_MS+1400*(facts.length-1));
|
|
11566
|
+
}
|
|
11567
|
+
|
|
10973
11568
|
/** One `name: value` row. The FOUR value states are rendered differently ON PURPOSE — see the CSS. */
|
|
10974
11569
|
function buildPropRow(prop){
|
|
10975
11570
|
const row=document.createElement('div');row.className='psrow';
|
|
@@ -11647,19 +12242,73 @@ function openRefRowMenu(r,anchorEl){closeRefRowMenu();
|
|
|
11647
12242
|
// (`refMoveToOrigin` keeps its own refusal: it is reachable from the panel's advisory offer, and a
|
|
11648
12243
|
// guard that only exists in the caller is one refactor from being gone.)
|
|
11649
12244
|
if(nativeModelBounds())m.append(mk(REF_MOVE_LABEL,()=>refMoveToOrigin(r.id)));
|
|
11650
|
-
|
|
12245
|
+
// THE NEXT FILE THE PROJECT SENDS (#734). Above reload deliberately: a version swap is the stronger form
|
|
12246
|
+
// of the same act, and it is the one a user reaches for far more often. Its refusal is reload's own,
|
|
12247
|
+
// verbatim — the schema says the lock freezes a re-read, and this is a re-read that also rewrites the
|
|
12248
|
+
// history. Kept as a refusal rather than an omission for the reason the item below keeps its: unlocking
|
|
12249
|
+
// is something the user can do from the panel two clicks away, so the sentence names a remedy they have.
|
|
12250
|
+
m.append(mk('Load a new version…',()=>{
|
|
12251
|
+
if(refDisp(r).locked){toast('“'+r.name+'” is locked — unlock it to load a new version');return;}
|
|
12252
|
+
if(!window.openRefVersion){toast('The reference panel isn’t ready yet — try again in a moment');return;}
|
|
12253
|
+
window.openRefVersion(r);}));
|
|
12254
|
+
// THE HISTORY, AND THE ONLY WAY TO ROLL BACK (#734 Phase 6). Never refused on the lock: reading a list
|
|
12255
|
+
// writes nothing, and a locked reference is exactly the one whose history somebody wants to check. The
|
|
12256
|
+
// rollback ACTION inside it is refused by the server on the lock, with the sentence the schema's own
|
|
12257
|
+
// rule gives — a refusal at the act rather than an item withheld from the menu.
|
|
12258
|
+
m.append(mk('Version history…',()=>{
|
|
12259
|
+
if(!window.openRefHistory){toast('The reference panel isn’t ready yet — try again in a moment');return;}
|
|
12260
|
+
window.openRefHistory(r);}));
|
|
12261
|
+
m.append(mk('Reload its geometry',async()=>{
|
|
11651
12262
|
if(refDisp(r).locked){toast('“'+r.name+'” is locked — unlock it to reload it');return;} // the lock freezes reload, as the schema says
|
|
11652
|
-
//
|
|
11653
|
-
//
|
|
11654
|
-
//
|
|
11655
|
-
//
|
|
12263
|
+
// ALREADY BEING READ — REFUSE BEFORE DESTROYING ANYTHING. `loadReferenceGeometry` returns
|
|
12264
|
+
// immediately when a load for this id is in flight, so a second click on a big file (the menu
|
|
12265
|
+
// stays live while the row reads "loading…") would clear the tree state, start nothing, find
|
|
12266
|
+
// no geometry to re-key onto, and say nothing at all. Said out loud rather than made a no-op,
|
|
12267
|
+
// because the user asked for something. (Review.)
|
|
12268
|
+
if(refLoading.has(r.id)){toast('“'+r.name+'” is already being re-read — this will finish on its own');return;}
|
|
12269
|
+
// WHAT THIS RE-READ WOULD OTHERWISE DESTROY, taken while the old objects are still here (#734
|
|
12270
|
+
// Phase 5). The drilled-into object and the tree's open groups both carry identity the new read
|
|
12271
|
+
// can be matched on, so they are migrated below rather than dropped.
|
|
12272
|
+
const snap=refSessionSnapshot(r.id);
|
|
12273
|
+
// A MEASUREMENT OF THIS REFERENCE DOES NOT SURVIVE ITS GEOMETRY BEING RE-READ, and unlike the
|
|
12274
|
+
// other two it cannot be migrated. `refMeasureKept` stores raw world points and no object
|
|
12275
|
+
// identity at all, and a reload is not a comparison — nothing here classifies an object as
|
|
12276
|
+
// unchanged, so "keep it if both ends landed on something that did not move" is not merely hard
|
|
12277
|
+
// to evaluate, it is undefined. Keeping the dashed segment and its number against a fresh
|
|
12278
|
+
// tessellation would present a wrong dimension as a measured one, so it goes — and the report
|
|
12279
|
+
// below SAYS it went, which is the half that was missing.
|
|
11656
12280
|
refMeasureDropFor(r.id);
|
|
11657
12281
|
refGeom.delete(r.id);refFailed.delete(r.id);refEmpty.delete(r.id);refUnresolved.delete(r.id);
|
|
11658
|
-
// The tree's group keys are POSITIONAL ('2:1' is the second storey's second type), so a
|
|
11659
|
-
//
|
|
11660
|
-
//
|
|
11661
|
-
|
|
11662
|
-
|
|
12282
|
+
// The tree's group keys are POSITIONAL ('2:1' is the second storey's second type), so a re-read
|
|
12283
|
+
// that adds, drops or reorders anything makes them address different groups. Cleared here and
|
|
12284
|
+
// re-derived from the snapshot's storey/type LABELS once the new objects land — the identity
|
|
12285
|
+
// the file itself supplies, which position is only this read's rendering of.
|
|
12286
|
+
refTreeGroups.delete(r.id);
|
|
12287
|
+
// THE FILTER TEXT STAYS. Nothing about a re-read invalidates the words the user typed, and
|
|
12288
|
+
// dropping it would silently disarm the migration above: a group choice records the query it
|
|
12289
|
+
// was made under and applies only when that query returns, so clearing the box would leave
|
|
12290
|
+
// every migrated choice inert. The two are one piece of state and they move together.
|
|
12291
|
+
// THE REPORT RUNS IN A `finally`, and that is the whole point of the shape. This handler's
|
|
12292
|
+
// promise is dropped by the menu's click listener and the page installs no
|
|
12293
|
+
// `unhandledrejection` handler, so a throw anywhere inside the read — its own `finally` calls
|
|
12294
|
+
// `pushReferences`, `renderRefsTab` and `panel`, none of them guarded — would abort the
|
|
12295
|
+
// migration and the sentence together, leaving the geometry destroyed and the user told
|
|
12296
|
+
// nothing. That is the exact failure this feature exists to prevent, arriving through the one
|
|
12297
|
+
// door the feature itself opened. (Review.)
|
|
12298
|
+
let carried=[];
|
|
12299
|
+
try{
|
|
12300
|
+
await loadReferenceGeometry(r.id,{rebuild:true});
|
|
12301
|
+
}finally{
|
|
12302
|
+
try{carried=refSessionMigrate(r.id,snap);}
|
|
12303
|
+
catch(e){console.error('[reference] could not carry the session across the re-read of',r.id,e);
|
|
12304
|
+
carried=['what you had open in this reference'];}
|
|
12305
|
+
// It has already painted the tab once, from inside its own `finally`, with the group state
|
|
12306
|
+
// cleared — so the migrated keys need a repaint of their own to be seen.
|
|
12307
|
+
// Guarded on the tab, like every other repaint site: the user can switch legend tabs during a
|
|
12308
|
+
// read, and rebuilding a hidden subtree is work nobody sees.
|
|
12309
|
+
try{if(legendTab==='refs')renderRefsTab();}catch(e){console.error('[reference] the repaint after re-reading',r.id,'failed',e);}
|
|
12310
|
+
refSessionSay(r.id,carried);
|
|
12311
|
+
}}));
|
|
11663
12312
|
m.appendChild(document.createElement('hr'));
|
|
11664
12313
|
m.appendChild(mk('Remove',()=>refRemove(r),true));
|
|
11665
12314
|
document.body.appendChild(m);
|
|
@@ -11707,6 +12356,11 @@ async function refRemove(r){
|
|
|
11707
12356
|
*/
|
|
11708
12357
|
function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverEtag=etag;restampDraftBase(prev,etag);conflicted=false;}
|
|
11709
12358
|
|
|
12359
|
+
// The upload size limit, mirroring MAX_BYTES in server/reference-import.ts (pinned by the parity test,
|
|
12360
|
+
// which finds it by a line-anchored `const RI_MAX_BYTES = …`). AT FILE SCOPE rather than inside the
|
|
12361
|
+
// import modal's block because TWO modals now refuse the same file: adding a reference, and loading a new
|
|
12362
|
+
// version of one. A second copy under a second name would be a mirror the parity test does not watch.
|
|
12363
|
+
const RI_MAX_BYTES=150*1024*1024;
|
|
11710
12364
|
// ── The import modal: drop → probe → confirm ──────────────────────────────────────────────────────
|
|
11711
12365
|
{ const ri$=id=>document.getElementById(id);
|
|
11712
12366
|
// `riProbeCentre` is reset alongside the rest on every open — it used to survive from the PREVIOUS
|
|
@@ -11766,7 +12420,6 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
11766
12420
|
riStop();riClearSoft();ri$('refImportModal').style.display='none';
|
|
11767
12421
|
}
|
|
11768
12422
|
|
|
11769
|
-
const RI_MAX_BYTES=150*1024*1024; // mirrors MAX_BYTES in server/reference-import.ts (pinned by the parity test)
|
|
11770
12423
|
// Mirrors MAX_OBJECTS / WARN_OBJECTS in server/reference-import.ts (pinned by the same parity test).
|
|
11771
12424
|
// MIRRORED rather than fetched because the picker re-judges the total on every checkbox: a round
|
|
11772
12425
|
// trip per tick is not a control. The SERVER still owns the decision — it refuses the insert on its
|
|
@@ -12235,6 +12888,1506 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
12235
12888
|
ri$('riDrop').addEventListener('drop',e=>{const f=e.dataTransfer&&e.dataTransfer.files&&e.dataTransfer.files[0];riReadFile(f);});
|
|
12236
12889
|
}
|
|
12237
12890
|
|
|
12891
|
+
// ── Load a new version of a reference, and say what changed (#734, design §7.3) ─────────────────────
|
|
12892
|
+
//
|
|
12893
|
+
// THIS BLOCK RENDERS AN ANSWER IT DOES NOT COMPUTE. AWARE matches the two files' objects — on IFC
|
|
12894
|
+
// GlobalId and nothing else — `server/reference-compare.ts` validates the response, and
|
|
12895
|
+
// `web/reference-changes.js` holds the pure decisions (which counts, how a status reads, where the cap
|
|
12896
|
+
// falls, the refusal's words). Everything here is the DOM for what those return. floless never parses IFC
|
|
12897
|
+
// and never compares geometry (CLAUDE.md).
|
|
12898
|
+
//
|
|
12899
|
+
// THE REFUSAL IS NOT AN ERROR STATE. When no ids pair, "everything added and everything removed" is the
|
|
12900
|
+
// symptom of an exporter that regenerated every id, so AWARE returns no `changes` array at all and the
|
|
12901
|
+
// server relays a typed refusal. That is a correct, complete answer about two files that do not relate —
|
|
12902
|
+
// so it is drawn in neutral tokens, never red, and THERE IS NO "COMPARE ANYWAY": with no geometry
|
|
12903
|
+
// fallback the button could only produce the fabricated list the refusal exists to prevent.
|
|
12904
|
+
{
|
|
12905
|
+
const rv$=id=>document.getElementById(id);
|
|
12906
|
+
/** The pure core, read LAZILY — it is an ES module surfaced on `window` by a deferred shim (:1572), so
|
|
12907
|
+
* it does not exist yet while this classic script is being evaluated. Same shape as `GC()`.
|
|
12908
|
+
* CITED BY SYMBOL, not by line: find it as `window.ReferenceChanges=RC`. Every line number this
|
|
12909
|
+
* feature wrote had drifted by 20-150 lines inside the very commit that wrote it. */
|
|
12910
|
+
const RC=()=>window.ReferenceChanges||null;
|
|
12911
|
+
|
|
12912
|
+
let rvRef=null; // the reference a version is being loaded for
|
|
12913
|
+
let rvSha=null,rvName='',rvSoftT=null,rvBusy=false,rvRun=0,rvAbort=null;
|
|
12914
|
+
/**
|
|
12915
|
+
* Has the user closed this modal while its read was still running?
|
|
12916
|
+
*
|
|
12917
|
+
* THE ANSWER STILL HAS TO REACH THEM. Closing mid-run is a BACKGROUNDING action here — the route
|
|
12918
|
+
* detaches from the client deliberately, so the upload finishes and commits either way — and without
|
|
12919
|
+
* this flag every outcome was painted into a hidden panel and lost: a refusal rendered into an
|
|
12920
|
+
* invisible `#rvRefuseStage` with no toast, and a SUCCESS painted the change list, the entire point of
|
|
12921
|
+
* the feature, somewhere nobody could see. Reopening then reset to the dropzone, so it was
|
|
12922
|
+
* unreachable. The import modal solves the same problem with `riBackgrounded` and this is its sibling.
|
|
12923
|
+
*/
|
|
12924
|
+
let rvBackgrounded=false;
|
|
12925
|
+
/**
|
|
12926
|
+
* WHICH of the three flows owns this modal right now: 'upload' | 'rollback' | 'compare' | null.
|
|
12927
|
+
*
|
|
12928
|
+
* `rvBusy` says something is running; it cannot say what should happen when the user closes mid-run,
|
|
12929
|
+
* and the three answers genuinely differ. An upload and a rollback both own a contract mutation whose
|
|
12930
|
+
* route DETACHES from the client, so closing is a BACKGROUNDING action and the answer must come back
|
|
12931
|
+
* on screen when it lands. A per-version compare writes nothing and its route keeps the ordinary
|
|
12932
|
+
* disconnect guard, so closing really is a cancel — and letting it background instead would leave an
|
|
12933
|
+
* AWARE run grinding through two whole-building IFCs for a panel nobody will see. (#734 Phase 6.)
|
|
12934
|
+
*/
|
|
12935
|
+
let rvFlow=null;
|
|
12936
|
+
/** The version this upload was compared against — see `rcPreviousVersionId`. */
|
|
12937
|
+
let rvComparedAgainst=null;
|
|
12938
|
+
/** `undefined` keeps the reference's own filter (the default), `null` is an explicit unfiltered read,
|
|
12939
|
+
* an object is a filter the user picked in the §6.3 remedy. The three are three different requests —
|
|
12940
|
+
* see the route's own note on the body field. */
|
|
12941
|
+
let rvFilterChoice;
|
|
12942
|
+
let rvStageNow='drop';
|
|
12943
|
+
|
|
12944
|
+
const rvStop=()=>{rvRun++;if(rvAbort){try{rvAbort.abort();}catch(_){/* already settled */}rvAbort=null;}};
|
|
12945
|
+
const rvClearSoft=()=>{if(rvSoftT){clearTimeout(rvSoftT);rvSoftT=null;}};
|
|
12946
|
+
const rvErr=msg=>{const e=rv$('rvDropErr');if(msg){e.textContent=msg;e.style.display='block';}else{e.style.display='none';e.textContent='';}};
|
|
12947
|
+
/** An honest "still working", never a fake percentage — the import modal's own choice (decision I). */
|
|
12948
|
+
const rvProg=(label,soft)=>{rvClearSoft();rv$('rvProgTxt').textContent=label;
|
|
12949
|
+
if(soft)rvSoftT=setTimeout(()=>{rv$('rvProgTxt').textContent=soft;},6000);};
|
|
12950
|
+
|
|
12951
|
+
function rvStage(s){ // 'drop' | 'prog' | 'refuse' | 'result' | 'history'
|
|
12952
|
+
rvStageNow=s;
|
|
12953
|
+
// The answer floats over a LIVE canvas; the three stages before it hold the screen. See the CSS.
|
|
12954
|
+
rv$('refVersionModal').classList.toggle('rvfloat',s==='result');
|
|
12955
|
+
rv$('rvDropStage').style.display=s==='drop'?'':'none';
|
|
12956
|
+
rv$('rvProgStage').style.display=s==='prog'?'':'none';
|
|
12957
|
+
rv$('rvRefuseStage').style.display=s==='refuse'?'':'none';
|
|
12958
|
+
rv$('rvResultStage').style.display=s==='result'?'':'none';
|
|
12959
|
+
rv$('rvHistoryStage').style.display=s==='history'?'':'none';
|
|
12960
|
+
// THE FOOT IS HIDDEN ON THE REFUSAL, because that state draws its OWN weighted actions and one of
|
|
12961
|
+
// them is Cancel. Two Cancels, one of them the quiet default, is the shape the import modal removed
|
|
12962
|
+
// from its backdrop for exactly this reason.
|
|
12963
|
+
rv$('rvFoot').style.display=s==='refuse'?'none':'';
|
|
12964
|
+
rv$('rvCancel').style.display=s==='result'?'none':'';
|
|
12965
|
+
// ON THE HISTORY IT IS `Close`, NOT `Cancel`. Nothing is in flight to cancel, and offering to cancel
|
|
12966
|
+
// a list somebody is merely reading invites the reading that something is pending.
|
|
12967
|
+
rv$('rvCancel').textContent=s==='history'?'Close':'Cancel';
|
|
12968
|
+
rv$('rvDone').style.display=s==='result'?'':'none';
|
|
12969
|
+
// The way back to the history, offered only from the change list — it is created lazily by
|
|
12970
|
+
// `rcPaintFoot`, so it may not exist yet, and it must never offer the history you are already on.
|
|
12971
|
+
const hist=rv$('rvFoot').querySelector('.rvhist');
|
|
12972
|
+
if(hist)hist.style.display=s==='result'?'':'none';
|
|
12973
|
+
// THE FOOT NOTE BELONGS TO THE CHANGE LIST ALONE. `rcPaintFoot` writes "Compared by: location,
|
|
12974
|
+
// geometry, …" there, and the foot survives every stage change — so opening the history after a
|
|
12975
|
+
// comparison left that sentence sitting under a list of versions, where it describes nothing on
|
|
12976
|
+
// screen. Cleared on the way out rather than re-blanked by each stage that does not want it.
|
|
12977
|
+
if(s!=='result')rv$('rvFootNote').textContent='';
|
|
12978
|
+
rv$('rvClose').style.display=s==='prog'?'none':''; // mid-run, Cancel owns the exit
|
|
12979
|
+
rv$('rvProgNote').style.display='none';
|
|
12980
|
+
rv$('rvTitle').textContent=s==='prog'?'Reading the files'
|
|
12981
|
+
:s==='result'?'What changed'
|
|
12982
|
+
:s==='refuse'?'These files could not be compared'
|
|
12983
|
+
:s==='history'?'Version history'
|
|
12984
|
+
:'Load a new version';
|
|
12985
|
+
}
|
|
12986
|
+
|
|
12987
|
+
/** The version the client believes is current. `null` — a reference with no chain — is the MAIN path. */
|
|
12988
|
+
const rvCurrentVersionId=r=>{const v=Array.isArray(r&&r.versions)?r.versions:[];return v.length?(v[v.length-1].id||null):null;};
|
|
12989
|
+
|
|
12990
|
+
function openRefVersion(r){
|
|
12991
|
+
if(!r)return;
|
|
12992
|
+
if(rvBusy){rv$('refVersionModal').style.display='flex';return;}
|
|
12993
|
+
rvStop();rvClearSoft();
|
|
12994
|
+
rvRef=r;rvSha=null;rvName='';rvFilterChoice=undefined;rvErr('');
|
|
12995
|
+
rv$('rvDrop').classList.remove('drag');
|
|
12996
|
+
const sub=rv$('rvSubject');sub.replaceChildren();
|
|
12997
|
+
const b=document.createElement('b');b.textContent='“'+r.name+'”';
|
|
12998
|
+
const versions=Array.isArray(r.versions)?r.versions.length:0;
|
|
12999
|
+
sub.append(b,document.createTextNode(versions>1
|
|
13000
|
+
? ' is on version '+versions+'. Drop the next one and FloLess will tell you what moved.'
|
|
13001
|
+
: ' 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.'));
|
|
13002
|
+
rvStage('drop');rv$('refVersionModal').style.display='flex';
|
|
13003
|
+
}
|
|
13004
|
+
window.openRefVersion=openRefVersion;
|
|
13005
|
+
|
|
13006
|
+
// ── The version history (#734 Phase 6) — the only surface a reference can be rolled back from ──────
|
|
13007
|
+
//
|
|
13008
|
+
// `rvhRef` rather than `rvRef`: the two flows share this modal but not their subject's lifetime. An
|
|
13009
|
+
// upload replaces `rvRef` wholesale with `d.reference` mid-flight, so reading it here after a
|
|
13010
|
+
// backgrounded upload landed would paint one reference's history under another's title.
|
|
13011
|
+
let rvhRef=null;
|
|
13012
|
+
|
|
13013
|
+
function openRefHistory(r){
|
|
13014
|
+
if(!r)return;
|
|
13015
|
+
// A READ IS NOT A CANCEL. An upload in flight owns this modal; showing the history over it would
|
|
13016
|
+
// hide the spinner and lose the answer, so the read waits — the same rule `openRefVersion` follows.
|
|
13017
|
+
if(rvBusy){rv$('refVersionModal').style.display='flex';return;}
|
|
13018
|
+
rvStop();rvClearSoft();
|
|
13019
|
+
rvhRef=r;rvhNote('');
|
|
13020
|
+
rvhPaint();
|
|
13021
|
+
rvStage('history');rv$('refVersionModal').style.display='flex';rv$('rvBody').scrollTop=0;
|
|
13022
|
+
}
|
|
13023
|
+
window.openRefHistory=openRefHistory;
|
|
13024
|
+
|
|
13025
|
+
/**
|
|
13026
|
+
* The one-time outcome sentence under the list.
|
|
13027
|
+
*
|
|
13028
|
+
* CLEARED BY ITS THREE CALLERS, NOT BY `rvhPaint` — and that is deliberate rather than an oversight.
|
|
13029
|
+
* The rollback success path runs `rvhPaint(); rvStage('history'); rvhNote(…)`, so a paint that cleared
|
|
13030
|
+
* the note would wipe it a moment before it is written. `openRefHistory`, the foot's `Version history`
|
|
13031
|
+
* button and `rvhRollback`'s entry each clear it explicitly instead. (An earlier version of this
|
|
13032
|
+
* comment claimed the opposite invariant, which would have invited exactly that bug back.)
|
|
13033
|
+
*
|
|
13034
|
+
* The PERMANENT record of a restore is the row itself ("restored 16 Aug — restored from version 1");
|
|
13035
|
+
* this is a one-time confirmation, not a second copy of history.
|
|
13036
|
+
*/
|
|
13037
|
+
const rvhNote=msg=>{rv$('rvhNote').textContent=msg||'';};
|
|
13038
|
+
|
|
13039
|
+
function rvhPaint(){
|
|
13040
|
+
const host=rv$('rvhList');host.replaceChildren();
|
|
13041
|
+
const sub=rv$('rvhSubject');sub.replaceChildren();
|
|
13042
|
+
const r=rvhRef;if(!r)return;
|
|
13043
|
+
const core=RC();
|
|
13044
|
+
const rows=core?core.versionRows(r.versions):[];
|
|
13045
|
+
const b=document.createElement('b');b.textContent='“'+r.name+'”';
|
|
13046
|
+
sub.append(b,document.createTextNode(rows.length
|
|
13047
|
+
? ' — '+rows.length+' version'+(rows.length===1?'':'s')+'. Every version keeps its own file, so you can go back to one and still ask what changed since.'
|
|
13048
|
+
: ' was added before FloLess started recording versions, so there is nothing to list yet. The next version you load starts its history.'));
|
|
13049
|
+
// NO DEAD BUTTON ON THE EMPTY STATE. A chainless reference — which is every reference added before
|
|
13050
|
+
// versioning existed — gets the sentence and nothing else; disabled chrome for an action that cannot
|
|
13051
|
+
// apply is the exact thing CLAUDE.md's design rule was written after.
|
|
13052
|
+
for(const row of rows)host.appendChild(rvhRow(row));
|
|
13053
|
+
}
|
|
13054
|
+
|
|
13055
|
+
function rvhRow(row){
|
|
13056
|
+
const el=document.createElement('div');el.className='rvhrow'+(row.current?' now':'');
|
|
13057
|
+
el.dataset.vid=row.id||'';
|
|
13058
|
+
el.appendChild(Object.assign(document.createElement('span'),{className:'rvhnum',textContent:'version '+row.n}));
|
|
13059
|
+
const main=document.createElement('div');main.className='rvhmain';
|
|
13060
|
+
main.appendChild(Object.assign(document.createElement('div'),{className:'rvhnm',textContent:row.name}));
|
|
13061
|
+
// THE DATE IN THE READER'S OWN LOCALE, and the WORD from the pure core — "recorded", "restored" and
|
|
13062
|
+
// "imported" are three different facts and the module owns which one this row is. TRAILING PROSE
|
|
13063
|
+
// RATHER THAN A CHIP, deliberately: a chip would need its qualifier on hover, and hover-only content
|
|
13064
|
+
// reaches neither a keyboard nor a screen reader. (UX review.)
|
|
13065
|
+
const when=row.importedAt?new Date(row.importedAt):null;
|
|
13066
|
+
const date=when&&!isNaN(when)?when.toLocaleDateString():null;
|
|
13067
|
+
main.appendChild(Object.assign(document.createElement('div'),{className:'rvhwhen',
|
|
13068
|
+
textContent:(date?row.dateWord+' '+date:row.dateWord)+(row.note?' — '+row.note:'')}));
|
|
13069
|
+
el.appendChild(main);
|
|
13070
|
+
const acts=document.createElement('div');acts.className='rvhacts';
|
|
13071
|
+
if(row.current){
|
|
13072
|
+
// A LABEL, NOT AN EMPTY SLOT. Rolling back to where you already are does nothing and comparing a
|
|
13073
|
+
// version with itself is refused by the server, so neither control could do anything but produce a
|
|
13074
|
+
// refusal — but leaving the slot blank reads as unfinished rather than as "correctly nothing",
|
|
13075
|
+
// which is the disabled-vs-hidden trap one tier along. `rc-plain` is this modal's own recede
|
|
13076
|
+
// treatment. (UX review.)
|
|
13077
|
+
acts.appendChild(Object.assign(document.createElement('span'),{className:'rc-chip rc-plain',textContent:'Current version'}));
|
|
13078
|
+
el.appendChild(acts);
|
|
13079
|
+
return el;
|
|
13080
|
+
}
|
|
13081
|
+
// A ROW WITH NO ID CAN BE DRAWN BUT NOT ACTED ON — both actions address a version by id, so two
|
|
13082
|
+
// buttons here would be two clicks that do nothing, silently, which is the defect the ⋯ menu's own
|
|
13083
|
+
// rule rejects. Said instead. (Silent-failure review.)
|
|
13084
|
+
if(!row.actionable){
|
|
13085
|
+
acts.appendChild(Object.assign(document.createElement('span'),{className:'rc-chip rc-unk',
|
|
13086
|
+
textContent:'No id recorded'}));
|
|
13087
|
+
acts.firstChild.dataset.tip='This version has no id recorded, so FloLess cannot restore it or compare against it.';
|
|
13088
|
+
el.appendChild(acts);
|
|
13089
|
+
return el;
|
|
13090
|
+
}
|
|
13091
|
+
// THE QUIET ONE IS THE READ. Compare writes nothing and answers a question; rollback is what this
|
|
13092
|
+
// surface exists for, so it keeps the page's default button weight and compare drops to `.pilllink`
|
|
13093
|
+
// — the three-weight rule this modal's CSS states, applied in the order the actions actually rank.
|
|
13094
|
+
const cmp=document.createElement('button');cmp.type='button';cmp.className='pilllink';
|
|
13095
|
+
cmp.textContent='What changed since this';
|
|
13096
|
+
cmp.dataset.tip='Compare this version with the one you have. Nothing is re-read or replaced.';
|
|
13097
|
+
cmp.addEventListener('click',()=>rvhCompare(row));
|
|
13098
|
+
const back=document.createElement('button');back.type='button';
|
|
13099
|
+
back.textContent='Roll back to this';
|
|
13100
|
+
back.addEventListener('click',()=>rvhAskConfirm(row));
|
|
13101
|
+
acts.append(cmp,back);
|
|
13102
|
+
el.appendChild(acts);
|
|
13103
|
+
return el;
|
|
13104
|
+
}
|
|
13105
|
+
|
|
13106
|
+
/**
|
|
13107
|
+
* The confirm, INSIDE the row it is about, and swapped IN PLACE.
|
|
13108
|
+
*
|
|
13109
|
+
* Not `window.confirm`, which renders the light OS dialog against this page's dark theme. Not a toast
|
|
13110
|
+
* either: this is a question and a toast cannot be answered.
|
|
13111
|
+
*
|
|
13112
|
+
* A TARGETED SWAP RATHER THAN A REPAINT, and that is the whole reason this is its own function. A
|
|
13113
|
+
* `rvhPaint()` here would destroy the button that was just clicked and strand focus on `<body>` — the
|
|
13114
|
+
* single most repeated bug class in this file, which `buildRefObjRow` and the filter-caret restore
|
|
13115
|
+
* both carry comments about. (UX review.)
|
|
13116
|
+
*/
|
|
13117
|
+
function rvhAskConfirm(row){
|
|
13118
|
+
// BY A REAL ID ONLY. `[data-vid=""]` matches the FIRST idless row rather than the clicked one, so on
|
|
13119
|
+
// a chain with two of them the confirm would open inside the wrong row — and an idless row draws no
|
|
13120
|
+
// Roll back button anyway, so reaching here with one is a bug worth saying rather than absorbing.
|
|
13121
|
+
if(!row||!row.id){console.warn('[reference] no confirm for a version row with no id',row);return;}
|
|
13122
|
+
const el=rv$('rvhList').querySelector('.rvhrow[data-vid="'+CSS.escape(row.id)+'"]');
|
|
13123
|
+
if(!el){console.warn('[reference] the row to confirm in is gone',row.id);return;}
|
|
13124
|
+
const acts=el.querySelector('.rvhacts');if(!acts)return;
|
|
13125
|
+
acts.replaceChildren();
|
|
13126
|
+
const q=document.createElement('div');q.className='rvhconfirm';
|
|
13127
|
+
// IT NAMES THE COST BEFORE THE COMMIT, not after. The duration is discovered in the spinner
|
|
13128
|
+
// otherwise, by which point the user has already agreed to it; and the reassurance answers the real
|
|
13129
|
+
// anxiety, which is whether going back throws the newer versions away. It does not. (UX review.)
|
|
13130
|
+
q.textContent='Go back to version '+row.n+'? FloLess re-reads that whole file — whole-building models '
|
|
13131
|
+
+'can take several minutes — and any measurement on this reference is dropped. '
|
|
13132
|
+
+'Nothing is lost: every version stays in this history.';
|
|
13133
|
+
el.insertBefore(q,acts);
|
|
13134
|
+
const keep=document.createElement('button');keep.type='button';keep.className='ghost';
|
|
13135
|
+
keep.textContent='Keep this one';
|
|
13136
|
+
keep.addEventListener('click',()=>{const fresh=rvhRow(row);el.replaceWith(fresh);
|
|
13137
|
+
const b=fresh.querySelector('.rvhacts button:last-child');if(b)b.focus();});
|
|
13138
|
+
const go=document.createElement('button');go.type='button';go.className='rvprimary';
|
|
13139
|
+
go.textContent='Roll back';
|
|
13140
|
+
go.addEventListener('click',()=>rvhRollback(row));
|
|
13141
|
+
acts.append(keep,go);
|
|
13142
|
+
// FOCUS LANDS ON THE SAFE OPTION. The button that was pressed has just been replaced, so focus has to
|
|
13143
|
+
// be placed explicitly or it falls to `<body>`; and for an action costing minutes and dropping the
|
|
13144
|
+
// measurement, the accidental-Enter target must be the one that does nothing. (UX review.)
|
|
13145
|
+
keep.focus();
|
|
13146
|
+
}
|
|
13147
|
+
|
|
13148
|
+
/**
|
|
13149
|
+
* Roll back, and carry across everything a re-read would otherwise take.
|
|
13150
|
+
*
|
|
13151
|
+
* A ROLLBACK IS A RE-READ, so it is held to the same three answers as `Load a new version…` and
|
|
13152
|
+
* `Reload its geometry`, in the same order and for the same reasons: the tree's open groups and the
|
|
13153
|
+
* drilled-into object migrate on the identity the file supplies, the measurement CANNOT be migrated
|
|
13154
|
+
* and is dropped, and whatever could not be carried is SAID. See `refSessionMigrate`.
|
|
13155
|
+
*
|
|
13156
|
+
* IT SAYS "re-reading version 2" RATHER THAN APPEARING TO HANG. The geometry cache is keyed per
|
|
13157
|
+
* reference, not per version, so an earlier version's geometry is genuinely gone and this always pays
|
|
13158
|
+
* a full read — on a real building, minutes. Design §4.3 states it so it is not discovered here.
|
|
13159
|
+
*/
|
|
13160
|
+
async function rvhRollback(row){
|
|
13161
|
+
const r=rvhRef;if(!r||!row)return;
|
|
13162
|
+
if(!row.id){console.warn('[reference] a version row with no id cannot be rolled back to',row);
|
|
13163
|
+
rvhNote('That version has no id recorded, so FloLess cannot restore it.');return;}
|
|
13164
|
+
// ALREADY BEING RE-READ — REFUSE BEFORE DESTROYING ANYTHING. `Reload its geometry` and a rollback
|
|
13165
|
+
// both replace this reference's objects and both drop its measurement; run at once they land in
|
|
13166
|
+
// arbitrary order and the canvas ends up showing one version while the contract claims another. The
|
|
13167
|
+
// reload item makes the reciprocal check (`refLoading`) and this is its other half — said out loud,
|
|
13168
|
+
// because the user asked for something. (Silent-failure review.)
|
|
13169
|
+
if(refLoading.has(r.id)){toast('“'+r.name+'” is already being re-read — wait for that to finish first');return;}
|
|
13170
|
+
const mine=++rvRun;
|
|
13171
|
+
// `rvBackgrounded=false` for the reason `rvSubmit` clears it too: one flag, three flows, and a stale
|
|
13172
|
+
// `true` left by an abandoned earlier run would make this one reopen a modal nobody backgrounded.
|
|
13173
|
+
rvBusy=true;rvFlow='rollback';rvBackgrounded=false;
|
|
13174
|
+
rvhNote('');
|
|
13175
|
+
rvStage('prog');rv$('rvProgNote').style.display='block';
|
|
13176
|
+
rvProg('Re-reading version '+row.n+' of “'+r.name+'”…',
|
|
13177
|
+
'FloLess keeps every version’s file but only the current version’s geometry, so going back means reading that file again. Whole-building models can take several minutes.');
|
|
13178
|
+
rvAbort=new AbortController();
|
|
13179
|
+
let mid=null,d=null;
|
|
13180
|
+
try{
|
|
13181
|
+
mid=newMutationId();claimMutation(mid);
|
|
13182
|
+
const res=await fetch(refApi('/'+encodeURIComponent(r.id)+'/rollback'),{
|
|
13183
|
+
method:'POST',signal:rvAbort.signal,
|
|
13184
|
+
headers:{'content-type':'application/json','x-floless-mutation-id':mid},
|
|
13185
|
+
body:JSON.stringify({versionId:row.id,expectedVersionId:rvCurrentVersionId(r)}),
|
|
13186
|
+
});
|
|
13187
|
+
d=await res.json().catch(()=>({}));
|
|
13188
|
+
// Gone while this was in flight. The write may still have landed, and suppressing our own echo is
|
|
13189
|
+
// what would leave a committed rollback invisible — so the claim is released and the broadcast
|
|
13190
|
+
// reconciles instead. (The version route's reasoning, verbatim.)
|
|
13191
|
+
if(mine!==rvRun){releaseMutation(mid);return;}
|
|
13192
|
+
rvClearSoft();
|
|
13193
|
+
if(!res.ok||!d.ok){
|
|
13194
|
+
// EVERY REFUSAL HERE IS A NO-WRITE — the route refuses before the read for the cheap ones and
|
|
13195
|
+
// inside the lock for a stale version — so the claim must go, or it sits in a bounded 32-entry
|
|
13196
|
+
// ring wrongly suppressing somebody else's event and evicting a live claim early.
|
|
13197
|
+
releaseMutation(mid);
|
|
13198
|
+
// A REFUSAL PAINTED INTO A HIDDEN PANEL IS A REFUSAL NOBODY READ. Backgrounded, this modal is
|
|
13199
|
+
// `display:none`, so the note below would render perfectly and silently.
|
|
13200
|
+
if(rvBackgrounded){
|
|
13201
|
+
toast('Could not go back to version '+row.n+' of “'+r.name+'” — '+((d&&d.error)||'FloLess could not re-read it.'));
|
|
13202
|
+
rv$('refVersionModal').style.display='flex';rvBackgrounded=false;
|
|
13203
|
+
}
|
|
13204
|
+
rvhPaint();rvStage('history');
|
|
13205
|
+
rvhNote((d&&d.error)||'FloLess could not go back to that version.');
|
|
13206
|
+
return;
|
|
13207
|
+
}
|
|
13208
|
+
}catch(e){
|
|
13209
|
+
if(mine!==rvRun||(e&&e.name==='AbortError')){if(mid)releaseMutation(mid);return;}
|
|
13210
|
+
// A THROWN request tells us nothing about whether the write landed, which is exactly why the claim
|
|
13211
|
+
// must go: suppressing our own echo would leave a committed rollback invisible here.
|
|
13212
|
+
if(mid)releaseMutation(mid);
|
|
13213
|
+
rvClearSoft();
|
|
13214
|
+
if(rvBackgrounded){rv$('refVersionModal').style.display='flex';rvBackgrounded=false;}
|
|
13215
|
+
rvhPaint();rvStage('history');
|
|
13216
|
+
rvhNote('Could not reach the reader — check the app is running.');
|
|
13217
|
+
console.error('[reference] rollback failed',e);return;
|
|
13218
|
+
}finally{if(mine===rvRun){rvBusy=false;rvFlow=null;rvAbort=null;}}
|
|
13219
|
+
// ── PAST THE POINT OF NO RETURN. Everything above is the transaction; everything below is showing
|
|
13220
|
+
// it, and they are deliberately not one try — a throw in the presentation half must not report a
|
|
13221
|
+
// failure for a rollback that is committed on disk. (The version route learned this the hard way.)
|
|
13222
|
+
//
|
|
13223
|
+
// `carried` IS DECLARED OUT HERE, not inside the try, so the catch can still say what was lost. It
|
|
13224
|
+
// was scoped inside, which put it out of reach exactly where it matters most: by the time a throw
|
|
13225
|
+
// can land below, `refMeasureDropFor` and `refGeom.set` have already run, so the measurement is gone
|
|
13226
|
+
// and the geometry is swapped whatever happens next. Reporting the failure without the loss is the
|
|
13227
|
+
// one remaining way this feature could take somebody's session without a word — which is the thing
|
|
13228
|
+
// it exists to prevent. (Silent-failure review; the upload path already does this and says why.)
|
|
13229
|
+
let carried=[];
|
|
13230
|
+
try{
|
|
13231
|
+
// ALREADY THERE, AND HANDLED BEFORE ANYTHING ELSE. The route answers this without reading, without
|
|
13232
|
+
// committing and — the part that matters here — WITHOUT BROADCASTING, so there is no etag to adopt
|
|
13233
|
+
// and no echo will ever arrive to sweep the claim. Releasing it explicitly is not tidiness: the
|
|
13234
|
+
// ring is 32 entries, so a leak both suppresses a real event carrying that id and evicts a live
|
|
13235
|
+
// claim early.
|
|
13236
|
+
if(d.unchanged){
|
|
13237
|
+
releaseMutation(mid);
|
|
13238
|
+
rvhRef=d.reference||r;
|
|
13239
|
+
if(rvBackgrounded){rv$('refVersionModal').style.display='flex';rvBackgrounded=false;}
|
|
13240
|
+
rvhPaint();rvStage('history');
|
|
13241
|
+
rvhNote('“'+r.name+'” is already on version '+row.n+'.');return;
|
|
13242
|
+
}
|
|
13243
|
+
adoptReferenceWrite(d.etag);
|
|
13244
|
+
const i=refList().findIndex(x=>x&&x.id===r.id);
|
|
13245
|
+
// REMOVED WHILE THIS WAS IN FLIGHT. The route detaches from the client on purpose, so the rollback
|
|
13246
|
+
// really does commit; what must not happen is this tab asserting the reference is back.
|
|
13247
|
+
if(i<0){
|
|
13248
|
+
rvBackgrounded=false;
|
|
13249
|
+
console.warn('[reference] a rollback landed for',r.id,'after it was removed — not resurrecting it');
|
|
13250
|
+
rvClose();toast('“'+r.name+'” was removed while it was being rolled back, so there is nothing to show.');return;
|
|
13251
|
+
}
|
|
13252
|
+
C.reference_models[i]=d.reference;
|
|
13253
|
+
rvhRef=d.reference;
|
|
13254
|
+
// TAKEN BEFORE THE NEW OBJECTS REPLACE THE OLD ONES — `refGeom.set` below is the moment the labels
|
|
13255
|
+
// this resolves against stop existing.
|
|
13256
|
+
const snap=refSessionSnapshot(r.id);
|
|
13257
|
+
refGeom.set(r.id,refGeomFrom(d));
|
|
13258
|
+
refFailed.delete(r.id);refEmpty.delete(r.id);refUnresolved.delete(r.id);
|
|
13259
|
+
refMeasureDropFor(r.id);
|
|
13260
|
+
// SEEDED AT THE MOMENT OF THE DROP, not left to `refSessionMigrate` below. A throw between here
|
|
13261
|
+
// and there leaves `carried` empty while the measurement is already gone — and an empty `carried`
|
|
13262
|
+
// makes `refCarryoverSentence` return null, so the catch would say nothing about a measurement
|
|
13263
|
+
// that no longer exists. `refSessionMigrate` re-derives the same fact from `snap.hadMeasure`, so
|
|
13264
|
+
// the success path replaces this rather than doubling it. (Silent-failure review.)
|
|
13265
|
+
if(snap.hadMeasure)carried=['your measurement'];
|
|
13266
|
+
// Positional keys against objects that have all moved; cleared here and re-derived from the
|
|
13267
|
+
// snapshot's LABELS below. `refTreeQuery` stays, for the reason the other two paths give: a group
|
|
13268
|
+
// choice records the query it was made under, so clearing the box leaves every carried choice inert.
|
|
13269
|
+
refTreeGroups.delete(r.id);
|
|
13270
|
+
pushReferences();
|
|
13271
|
+
try{carried=refSessionMigrate(r.id,snap);}
|
|
13272
|
+
catch(e){console.error('[reference] could not carry the session across the rollback of',r.id,e);
|
|
13273
|
+
carried=['what you had open in this reference'];}
|
|
13274
|
+
renderRefsTab();panel();
|
|
13275
|
+
// THE ANSWER COMES BACK ON SCREEN if the user closed the modal while it ran. A rollback backgrounds
|
|
13276
|
+
// rather than cancels — the route detaches and commits either way — so without this the geometry
|
|
13277
|
+
// silently swaps under the user and the sentence below is painted where nobody can read it, which
|
|
13278
|
+
// is the one thing this feature exists to prevent.
|
|
13279
|
+
if(rvBackgrounded){rv$('refVersionModal').style.display='flex';rvBackgrounded=false;
|
|
13280
|
+
toast('“'+r.name+'” is back on version '+row.n+'.');}
|
|
13281
|
+
rvhPaint();rvStage('history');
|
|
13282
|
+
// THE SENTENCE, IN THE PANEL RATHER THAN A TOAST, because there is a panel to put it in — and the
|
|
13283
|
+
// `version` tail is the honest one: a rollback really does have an earlier version to name, where
|
|
13284
|
+
// `Reload its geometry` re-reads the same file and has none.
|
|
13285
|
+
const lost=refCarryoverSentence(carried,'version');
|
|
13286
|
+
// A PARTIAL RESTORE MUST NOT READ AS A CLEAN ONE. The route computes and sends `unmatched` — the
|
|
13287
|
+
// storeys or types this version's filter names that no longer resolve in the file — and saying
|
|
13288
|
+
// only "back on version 2" while silently reading less of it than the version did is the same
|
|
13289
|
+
// class of lie the import path already refuses to tell. (Silent-failure review.)
|
|
13290
|
+
const missed=Array.isArray(d.unmatched)&&d.unmatched.length
|
|
13291
|
+
? ' Nothing matched '+d.unmatched.map(u=>'“'+u+'”').join(', ')
|
|
13292
|
+
+' — that part of the file may have been renamed since this version was loaded.'
|
|
13293
|
+
: '';
|
|
13294
|
+
// …AND THE BYTES MAY NOT BE THE VERSION'S BYTES. The server compared the file's hash against what
|
|
13295
|
+
// the chain recorded and told us they differ; asserting "back on version 2" on its own would then
|
|
13296
|
+
// be a sentence the server has already contradicted.
|
|
13297
|
+
const drifted=d.fileChanged
|
|
13298
|
+
? ' The file behind that version is not the one recorded under it, so this is that file as it stands today.'
|
|
13299
|
+
: '';
|
|
13300
|
+
rvhNote('“'+r.name+'” is back on version '+row.n+', now version '+((d.versions||[]).length||'?')+' in its history.'
|
|
13301
|
+
+missed+drifted+(lost?' '+lost:''));
|
|
13302
|
+
// FOCUS AFTER A REPAINT IS EXPLICIT OR IT IS NOWHERE. The `Roll back` button that had it no longer
|
|
13303
|
+
// exists; without this a keyboard user is dropped onto `<body>`. (UX review.)
|
|
13304
|
+
const nowRow=rv$('rvhList').querySelector('.rvhrow.now');
|
|
13305
|
+
if(nowRow){nowRow.setAttribute('tabindex','-1');nowRow.focus();}
|
|
13306
|
+
}catch(e){
|
|
13307
|
+
console.error('[reference] the rollback landed, but the history could not be repainted',e);
|
|
13308
|
+
// THE SENTENCE SURVIVES THE PANEL. `#rvhNote` is never painted on this path, so the carry-over has
|
|
13309
|
+
// no other way out — and the geometry really was replaced and the measurement really was dropped,
|
|
13310
|
+
// which makes losing it here the one remaining way this feature takes the user's session without a
|
|
13311
|
+
// word. Appended to the one toast rather than fired as a second, which would replace it.
|
|
13312
|
+
const lost=refCarryoverSentence(carried,'version');
|
|
13313
|
+
rvClose();toast('Rolled “'+r.name+'” back to version '+row.n+' — reload the view to see it'
|
|
13314
|
+
+(lost?' — '+lost:''),false,lost?TOAST_MS+1400:undefined);
|
|
13315
|
+
}
|
|
13316
|
+
}
|
|
13317
|
+
|
|
13318
|
+
/**
|
|
13319
|
+
* "What changed since version N" — the question design §4.4 keeps the whole chain answerable for.
|
|
13320
|
+
*
|
|
13321
|
+
* THE REVISED SIDE IS ALWAYS THE CURRENT VERSION, and that is this panel's constraint rather than the
|
|
13322
|
+
* server's (the route takes two arbitrary ids). The change list's rows zoom to objects ON THE CANVAS
|
|
13323
|
+
* and its `removed` rows draw ghosts INTO it, so a comparison whose revised side is not what is on
|
|
13324
|
+
* screen would produce rows pointing at nothing and outlines nobody could place.
|
|
13325
|
+
*
|
|
13326
|
+
* NO SESSION MIGRATION AND NO GEOMETRY SWAP: nothing is re-read and nothing is replaced. This is the
|
|
13327
|
+
* one path into the change panel that costs the user's session nothing, so it must not fire the
|
|
13328
|
+
* carry-over sentence — `rcCarried` is cleared for exactly that reason.
|
|
13329
|
+
*/
|
|
13330
|
+
async function rvhCompare(row){
|
|
13331
|
+
const r=rvhRef;if(!r||!row)return;
|
|
13332
|
+
if(!row.id){console.warn('[reference] a version row with no id cannot be compared',row);
|
|
13333
|
+
rvhNote('That version has no id recorded, so FloLess cannot compare against it.');return;}
|
|
13334
|
+
const current=rvCurrentVersionId(r);
|
|
13335
|
+
if(!current||current===row.id)return; // the current row draws no compare button; belt and braces
|
|
13336
|
+
const mine=++rvRun;
|
|
13337
|
+
// 'compare' RATHER THAN JUST BUSY, and it is what makes closing mid-run a real cancel: this writes
|
|
13338
|
+
// nothing and its route keeps the ordinary disconnect guard, so aborting the fetch stops the AWARE
|
|
13339
|
+
// run. Backgrounded instead, it would read two whole-building IFCs for a panel nobody will see.
|
|
13340
|
+
rvBusy=true;rvFlow='compare';rvBackgrounded=false;
|
|
13341
|
+
rvStage('prog');
|
|
13342
|
+
// NO "you can close this" NOTE. That sentence is true of an upload and a rollback, whose routes
|
|
13343
|
+
// detach and commit regardless; it is false here, where closing cancels. Saying it would promise an
|
|
13344
|
+
// answer that is not coming.
|
|
13345
|
+
rvProg('Comparing version '+row.n+' with the version you have…',
|
|
13346
|
+
'AWARE is reading both files and matching their objects. Whole-building models can take several minutes.');
|
|
13347
|
+
rvAbort=new AbortController();
|
|
13348
|
+
let d=null;
|
|
13349
|
+
try{
|
|
13350
|
+
const res=await fetch(refApi('/'+encodeURIComponent(r.id)+'/compare'),{
|
|
13351
|
+
method:'POST',signal:rvAbort.signal,headers:{'content-type':'application/json'},
|
|
13352
|
+
body:JSON.stringify({baseVersionId:row.id,revisedVersionId:current}),
|
|
13353
|
+
});
|
|
13354
|
+
d=await res.json().catch(()=>({}));
|
|
13355
|
+
if(mine!==rvRun)return;
|
|
13356
|
+
rvClearSoft();
|
|
13357
|
+
if(!res.ok||!d.ok){
|
|
13358
|
+
// THE REFUSAL STATE, which already knows every one of these codes — including the one that
|
|
13359
|
+
// matters most here, `reference-compare-refused`. `readOnly` because none of its upload
|
|
13360
|
+
// remedies apply to two versions already in this chain: see `rvRefusal`'s own note.
|
|
13361
|
+
rvRefusal(d,res.status,{readOnly:true});return;
|
|
13362
|
+
}
|
|
13363
|
+
}catch(e){
|
|
13364
|
+
// AN ABORT HERE IS THE USER CLOSING THE PANEL, and `rvClose` has already torn the state down —
|
|
13365
|
+
// repainting a stage into a hidden modal would leave it there for the next open.
|
|
13366
|
+
if(mine!==rvRun||(e&&e.name==='AbortError'))return;
|
|
13367
|
+
rvClearSoft();rvhPaint();rvStage('history');
|
|
13368
|
+
rvhNote('Could not reach the reader — check the app is running.');
|
|
13369
|
+
console.error('[reference] version compare failed',e);return;
|
|
13370
|
+
}finally{if(mine===rvRun){rvBusy=false;rvFlow=null;rvAbort=null;}}
|
|
13371
|
+
// ── THE PRESENTATION HALF, GUARDED — as `rvSubmit`, `rvLoadSeparately` and `rvhRollback` all guard
|
|
13372
|
+
// theirs. This one had no handler, and the consequence is worse here than elsewhere: the `finally`
|
|
13373
|
+
// above has already cleared `rvBusy` while the stage is still 'prog', so a throw inside `rcShow`
|
|
13374
|
+
// became an unhandled rejection out of a bare click handler and stranded the user on a spinner that
|
|
13375
|
+
// was no longer spinning for anything, with nothing said. (Correctness review.)
|
|
13376
|
+
try{
|
|
13377
|
+
// NOTHING WAS LOST, so nothing is reported. This path replaces no geometry.
|
|
13378
|
+
rcCarried=[];
|
|
13379
|
+
// `rvRef` is what `rcShow` reads for the refId and what the ghost layer addresses; the two flows
|
|
13380
|
+
// share the panel, so the subject is handed over explicitly rather than assumed to already match.
|
|
13381
|
+
rvRef=r;
|
|
13382
|
+
rvComparedAgainst=row.id; // the ghosts are read from the EARLIER side — see `rcPreviousVersionId`
|
|
13383
|
+
const rows=(RC()&&RC().versionRows(r.versions))||[];
|
|
13384
|
+
const revisedRow=rows.find(x=>x.id===current);
|
|
13385
|
+
rcShow({comparison:d.comparison,version:{name:(d.revised&&d.revised.name)||r.name},
|
|
13386
|
+
versions:r.versions||[],pair:{baseN:row.n,revisedN:(revisedRow&&revisedRow.n)||rows.length}});
|
|
13387
|
+
}catch(e){
|
|
13388
|
+
console.error('[reference] the comparison arrived, but the panel could not be drawn',e);
|
|
13389
|
+
// BACK TO THE HISTORY, which is where this was launched from and is a live surface — not left on a
|
|
13390
|
+
// dead spinner. Nothing was replaced, so there is nothing to report beyond the failure itself.
|
|
13391
|
+
rvhPaint();rvStage('history');
|
|
13392
|
+
rvhNote('FloLess compared those two versions but could not draw the result.');
|
|
13393
|
+
}
|
|
13394
|
+
}
|
|
13395
|
+
|
|
13396
|
+
function rvClose(){
|
|
13397
|
+
// A READ-ONLY COMPARE IS CANCELLED, NOT BACKGROUNDED. It creates nothing durable, and its route keeps
|
|
13398
|
+
// the ordinary disconnect guard — so aborting the fetch closes the socket and stops the AWARE run.
|
|
13399
|
+
// Backgrounding it would keep two whole-building IFCs being read for an answer nobody wants.
|
|
13400
|
+
// `rvBackgrounded` is CLEARED, not merely left: one flag serves three flows, so a stale `true` would
|
|
13401
|
+
// make the next flow's landing reopen a modal nobody backgrounded.
|
|
13402
|
+
if(rvBusy&&rvStageNow==='prog'&&rvFlow==='compare'){
|
|
13403
|
+
rvStop();rvClearSoft();rvBusy=false;rvFlow=null;rvBackgrounded=false;
|
|
13404
|
+
rv$('refVersionModal').style.display='none';rcGhostReset();return;
|
|
13405
|
+
}
|
|
13406
|
+
// Mid-run this is a BACKGROUNDING action for the same reason the import's is: the route detaches from
|
|
13407
|
+
// the client deliberately, so an accepted upload finishes and commits whether this modal is on screen
|
|
13408
|
+
// or not. Cancelling it here would only hide the answer.
|
|
13409
|
+
if(rvBusy&&rvStageNow==='prog'){
|
|
13410
|
+
rvBackgrounded=true;rvClearSoft();rv$('refVersionModal').style.display='none';
|
|
13411
|
+
toast(rvFlow==='rollback'
|
|
13412
|
+
? 'FloLess will keep re-reading that version in the background.'
|
|
13413
|
+
: 'FloLess will keep reading the new version in the background.');return;
|
|
13414
|
+
}
|
|
13415
|
+
rvStop();rvClearSoft();rvFlow=null;rv$('refVersionModal').style.display='none';
|
|
13416
|
+
// THE GHOSTS GO WITH THE PANEL THAT EXPLAINS THEM. They are an annotation on a change list; left on
|
|
13417
|
+
// the canvas after it closes they are unexplained red shapes inside somebody else's building, and
|
|
13418
|
+
// nothing on screen would say they are objects that no longer exist.
|
|
13419
|
+
rcGhostReset();
|
|
13420
|
+
}
|
|
13421
|
+
|
|
13422
|
+
function rvReadFile(f){
|
|
13423
|
+
if(!f||rvBusy)return;rvErr('');
|
|
13424
|
+
if(!/\.(ifc|ifczip)$/i.test(f.name||'')){rvErr('Not an IFC file — expected .ifc or .ifczip.');return;}
|
|
13425
|
+
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;}
|
|
13426
|
+
rvName=f.name;
|
|
13427
|
+
const fr=new FileReader();
|
|
13428
|
+
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
|
|
13429
|
+
fr.onerror=()=>{if(mine!==rvRun)return;rvStage('drop');rvErr('Could not read that file.');};
|
|
13430
|
+
fr.onload=()=>{if(mine!==rvRun)return;rvProbe(String(fr.result||''),f,mine);};
|
|
13431
|
+
rvStage('prog');rvProg('Reading “'+f.name+'”…');
|
|
13432
|
+
fr.readAsDataURL(f);
|
|
13433
|
+
}
|
|
13434
|
+
|
|
13435
|
+
/**
|
|
13436
|
+
* Probe first, for the SHA — the version route takes a file that is already uploaded.
|
|
13437
|
+
*
|
|
13438
|
+
* The object-count gate is NOT re-implemented here. The route probes again and refuses with
|
|
13439
|
+
* `reference-too-many-objects` before it pays for the comparison, so a second copy of those limits in
|
|
13440
|
+
* this block would be a mirror nothing watches — the size gate the plan asks for is the server's, and
|
|
13441
|
+
* its refusal gets its own state below.
|
|
13442
|
+
*/
|
|
13443
|
+
async function rvProbe(dataUrl,f,mine){
|
|
13444
|
+
rvProg('Checking what “'+f.name+'” says about itself…','Still checking — a large model takes a moment.');
|
|
13445
|
+
rvAbort=new AbortController();
|
|
13446
|
+
try{
|
|
13447
|
+
const res=await fetch(refApi('/probe'),{method:'POST',signal:rvAbort.signal,headers:{'content-type':'application/json'},
|
|
13448
|
+
body:JSON.stringify({dataUrl,name:f.name})});
|
|
13449
|
+
const d=await res.json().catch(()=>({}));
|
|
13450
|
+
if(mine!==rvRun)return;
|
|
13451
|
+
rvClearSoft();
|
|
13452
|
+
if(!res.ok||!d.ok){rvStage('drop');rvErr(d.error||'Could not read that file.');return;}
|
|
13453
|
+
rvSha=d.sha;
|
|
13454
|
+
rvSubmit(mine);
|
|
13455
|
+
}catch(e){
|
|
13456
|
+
if(mine!==rvRun||(e&&e.name==='AbortError'))return;
|
|
13457
|
+
rvClearSoft();rvStage('drop');rvErr('Could not reach the reader — check the app is running.');
|
|
13458
|
+
}finally{if(mine===rvRun)rvAbort=null;}
|
|
13459
|
+
}
|
|
13460
|
+
|
|
13461
|
+
/**
|
|
13462
|
+
* Ask for the new version, and with it the comparison.
|
|
13463
|
+
*
|
|
13464
|
+
* `expectedVersionId` IS REQUIRED AND `null` IS THE MAIN PATH — every reference that predates this
|
|
13465
|
+
* feature is chainless, and omitting the key entirely is a 400 rather than a shorthand for null.
|
|
13466
|
+
*
|
|
13467
|
+
* The FILTER is sent by ABSENCE by default: "keep the part of the file this reference was loaded with".
|
|
13468
|
+
* That is the one thing it must never be inferred as "the whole file", so the key is spread in only
|
|
13469
|
+
* when the user has explicitly chosen something in the §6.3 remedy.
|
|
13470
|
+
*
|
|
13471
|
+
* NO `progressId`. The route supports drawing the new geometry as it arrives, and the import flow uses
|
|
13472
|
+
* it — but there the canvas is empty, and here the PREVIOUS version is still on screen underneath. Two
|
|
13473
|
+
* buildings overlaid, one of them provisional, is a worse answer than an honest spinner.
|
|
13474
|
+
*/
|
|
13475
|
+
async function rvSubmit(mine){
|
|
13476
|
+
if(!rvSha||!rvRef)return;
|
|
13477
|
+
const r=rvRef;
|
|
13478
|
+
if(mine===undefined){mine=++rvRun;} // a retry from a refusal state is a NEW attempt
|
|
13479
|
+
rvBusy=true;rvFlow='upload';rvBackgrounded=false;rcCarried=[]; // a new run never inherits the last one's carryover sentence
|
|
13480
|
+
// HELD FOR THE PANEL, not just sent: this is the version the ghosts will be read from, and knowing
|
|
13481
|
+
// it beats inferring it from the chain's array order afterwards. See `rcPreviousVersionId`.
|
|
13482
|
+
rvComparedAgainst=rvCurrentVersionId(r);
|
|
13483
|
+
rvStage('prog');rv$('rvProgNote').style.display='block';
|
|
13484
|
+
rvProg('Comparing “'+rvName+'” with the version you have…',
|
|
13485
|
+
'AWARE is reading both files and matching their objects. Whole-building models can take several minutes.');
|
|
13486
|
+
rvAbort=new AbortController();
|
|
13487
|
+
let mid=null,d=null;
|
|
13488
|
+
try{
|
|
13489
|
+
mid=newMutationId();claimMutation(mid);
|
|
13490
|
+
const res=await fetch(refApi('/'+encodeURIComponent(r.id)+'/version'),{
|
|
13491
|
+
method:'POST',signal:rvAbort.signal,
|
|
13492
|
+
headers:{'content-type':'application/json','x-floless-mutation-id':mid},
|
|
13493
|
+
body:JSON.stringify({sha:rvSha,name:rvName,expectedVersionId:rvComparedAgainst,
|
|
13494
|
+
...(rvFilterChoice===undefined?{}:{filter:rvFilterChoice})}),
|
|
13495
|
+
});
|
|
13496
|
+
d=await res.json().catch(()=>({}));
|
|
13497
|
+
if(mine!==rvRun){
|
|
13498
|
+
// Gone while this was in flight. The write may still have landed, and suppressing our own echo is
|
|
13499
|
+
// precisely what would leave a committed version invisible in the editor — so the claim is
|
|
13500
|
+
// released and the broadcast reconciles instead. (The import route's own reasoning, verbatim.)
|
|
13501
|
+
releaseMutation(mid);return;
|
|
13502
|
+
}
|
|
13503
|
+
rvClearSoft();
|
|
13504
|
+
// RELEASED ON THE REFUSAL, because a refused write produces no broadcast at all — `claimMutation`'s
|
|
13505
|
+
// own contract says an unreleased id "would otherwise sit in the list forever, where the only
|
|
13506
|
+
// thing it can do is wrongly suppress somebody else's event", and the list is a bounded ring, so a
|
|
13507
|
+
// leaked id also evicts a legitimately-claimed one early. Every refusal here is a NO-WRITE: the
|
|
13508
|
+
// route refuses before the copy for a comparison refusal and inside the lock for a stale version.
|
|
13509
|
+
// (Codex review.)
|
|
13510
|
+
if(!res.ok||!d.ok){
|
|
13511
|
+
releaseMutation(mid);
|
|
13512
|
+
// A REFUSAL PAINTED INTO A HIDDEN PANEL IS A REFUSAL NOBODY READ. Backgrounded, the modal is
|
|
13513
|
+
// display:none — so the state below would render perfectly and silently. Say it out loud and
|
|
13514
|
+
// bring the panel back, which is where its remedies live (choose another file, load unfiltered).
|
|
13515
|
+
if(rvBackgrounded){
|
|
13516
|
+
toast('Could not load a new version of “'+r.name+'” — '+((d&&d.error)||'the comparison could not be made.'));
|
|
13517
|
+
rv$('refVersionModal').style.display='flex';rvBackgrounded=false;
|
|
13518
|
+
}
|
|
13519
|
+
rvRefusal(d,res.status);return;
|
|
13520
|
+
}
|
|
13521
|
+
}catch(e){
|
|
13522
|
+
if(mine!==rvRun||(e&&e.name==='AbortError')){if(mid)releaseMutation(mid);return;}
|
|
13523
|
+
// A THROWN request tells us nothing about whether the write landed, which is exactly why the claim
|
|
13524
|
+
// must go: suppressing our own echo is what would leave a committed version invisible here.
|
|
13525
|
+
if(mid)releaseMutation(mid);
|
|
13526
|
+
rvClearSoft();rvStage('drop');rvErr('Could not load a new version — check the app is running.');
|
|
13527
|
+
console.error('[reference] version upload failed',e);return;
|
|
13528
|
+
}finally{if(mine===rvRun){rvBusy=false;rvFlow=null;rvAbort=null;}}
|
|
13529
|
+
// ── PAST THE POINT OF NO RETURN. Everything above is the transaction; everything below is showing it,
|
|
13530
|
+
// and they are deliberately not one try — a throw in the presentation half must not report a failure
|
|
13531
|
+
// for a version that is committed on disk. (The import route learned this the expensive way.)
|
|
13532
|
+
try{
|
|
13533
|
+
adoptReferenceWrite(d.etag);
|
|
13534
|
+
const i=refList().findIndex(x=>x&&x.id===r.id);
|
|
13535
|
+
// REMOVED WHILE THIS WAS IN FLIGHT — and a backgrounded upload makes that a whole minute wide.
|
|
13536
|
+
// `refRemove` drops the entry locally and neither cancels this run nor invalidates it (the route
|
|
13537
|
+
// detaches from the client on purpose, so the version really does commit). Without this guard the
|
|
13538
|
+
// presentation half then RESURRECTS it: pushing geometry for an entry that no longer exists,
|
|
13539
|
+
// re-showing the modal, and painting a change list about a reference the user has just deleted.
|
|
13540
|
+
// The write itself is already on disk and the broadcast reconciles it; what must not happen is
|
|
13541
|
+
// this tab asserting the reference is back. (Codex, re-review of the backgrounding fix.)
|
|
13542
|
+
if(i<0){
|
|
13543
|
+
rvBackgrounded=false;
|
|
13544
|
+
console.warn('[reference] a new version landed for',r.id,'after it was removed — not resurrecting it');
|
|
13545
|
+
toast('“'+r.name+'” was removed while its new version was loading, so there is nothing to show.');
|
|
13546
|
+
return;
|
|
13547
|
+
}
|
|
13548
|
+
C.reference_models[i]=d.reference;
|
|
13549
|
+
rvRef=d.reference;
|
|
13550
|
+
// TAKEN BEFORE THE NEW OBJECTS REPLACE THE OLD ONES — `refGeom.set` on the next line is the moment
|
|
13551
|
+
// the labels this resolves against stop existing (#734 Phase 5).
|
|
13552
|
+
const snap=refSessionSnapshot(r.id);
|
|
13553
|
+
refGeom.set(r.id,refGeomFrom(d));
|
|
13554
|
+
refFailed.delete(r.id);refEmpty.delete(r.id);refUnresolved.delete(r.id);
|
|
13555
|
+
// THE SAME THREE, HANDLED THE SAME WAY as `Reload its geometry` — the drilled-into object and the
|
|
13556
|
+
// tree's open groups migrate on identity, the measurement cannot and is dropped, and whatever could
|
|
13557
|
+
// not be carried is said out loud. The reasoning for each lives at that menu item; this is the same
|
|
13558
|
+
// act on a different file, so it must not be a different answer.
|
|
13559
|
+
refMeasureDropFor(r.id);
|
|
13560
|
+
// `refTreeQuery` is NOT cleared with it, here for the same reason as there: the filter text is the
|
|
13561
|
+
// user's own and a new file does not invalidate it, and clearing it would quietly disarm the
|
|
13562
|
+
// migration — a group choice records the query it was made under and applies only when that query
|
|
13563
|
+
// returns, so an emptied box leaves every carried choice inert.
|
|
13564
|
+
refTreeGroups.delete(r.id);
|
|
13565
|
+
// `pushReferences()` FIRST, `renderRefsTab()` AFTER, and the migration strictly between them. The
|
|
13566
|
+
// first is what runs the 3D layer's object migration, so asking "did the drilled object survive"
|
|
13567
|
+
// any earlier asks before anything has tried to save it; the last is what paints the tree, so
|
|
13568
|
+
// migrating after it would paint the old positions and leave the restored ones unshown.
|
|
13569
|
+
pushReferences();
|
|
13570
|
+
// ISOLATED, so a throw in the migration still leaves the catch below something honest to say. It is
|
|
13571
|
+
// the one statement here whose failure would otherwise be indistinguishable from "nothing was lost".
|
|
13572
|
+
try{rcCarried=refSessionMigrate(r.id,snap);}
|
|
13573
|
+
catch(e){console.error('[reference] could not carry the session onto the new version of',r.id,e);
|
|
13574
|
+
rcCarried=['what you had open in this reference'];}
|
|
13575
|
+
renderRefsTab();panel();
|
|
13576
|
+
// THE ANSWER COMES BACK ON SCREEN if the user closed the modal while it ran. The change list IS
|
|
13577
|
+
// the feature — painting it into a hidden panel and leaving it there loses the whole result, and
|
|
13578
|
+
// reopening from the ⋯ menu starts a NEW upload at the dropzone rather than showing this one.
|
|
13579
|
+
if(rvBackgrounded){rv$('refVersionModal').style.display='flex';rvBackgrounded=false;toast('“'+r.name+'” has a new version — here is what changed.');}
|
|
13580
|
+
rcShow(d);
|
|
13581
|
+
}catch(e){
|
|
13582
|
+
console.error('[reference] the new version landed, but the panel could not be drawn',e);
|
|
13583
|
+
// THE SENTENCE SURVIVES THE PANEL. `#rcIssues` is never painted on this path, so the carryover has
|
|
13584
|
+
// no other way out — and the geometry really was replaced, which makes dropping it here the one
|
|
13585
|
+
// remaining way this feature could take the user's session without a word. Same treatment as the
|
|
13586
|
+
// no-comparison branch above, which is the same reasoning applied to its sibling. (Review.)
|
|
13587
|
+
const lost=refCarryoverSentence(rcCarried,'version');
|
|
13588
|
+
rvClose();toast('Loaded a new version of “'+r.name+'” — reload the view to see what changed'+(lost?' — '+lost:''),false,lost?TOAST_MS+1400:undefined);
|
|
13589
|
+
}
|
|
13590
|
+
}
|
|
13591
|
+
|
|
13592
|
+
// ── The refusals. EACH CODE GETS ITS OWN STATE, because they are distinct on purpose: one says the two
|
|
13593
|
+
// files do not relate, one says somebody else moved the reference on, one says a storey was renamed and
|
|
13594
|
+
// hands back the new file's own breakdown so a new filter can be picked from it. Collapsing them into
|
|
13595
|
+
// "could not load" would throw away the remedy each one carries. ──────────────────────────────────────
|
|
13596
|
+
const rvActBtn=(label,weight,fn)=>{
|
|
13597
|
+
const b=document.createElement('button');b.type='button';b.textContent=label;
|
|
13598
|
+
if(weight==='ghost')b.className='ghost';
|
|
13599
|
+
else if(weight==='primary')b.className='rvprimary';
|
|
13600
|
+
b.addEventListener('click',fn);
|
|
13601
|
+
return b;
|
|
13602
|
+
};
|
|
13603
|
+
const RV_ACT={
|
|
13604
|
+
cancel:()=>rvClose(),
|
|
13605
|
+
otherfile:()=>{rvStop();rvSha=null;rvFilterChoice=undefined;rvErr('');rvStage('drop');},
|
|
13606
|
+
separate:()=>rvLoadSeparately(),
|
|
13607
|
+
unfiltered:()=>{rvFilterChoice=null;rvSubmit();},
|
|
13608
|
+
reload:()=>location.reload(),
|
|
13609
|
+
};
|
|
13610
|
+
|
|
13611
|
+
/**
|
|
13612
|
+
* `readOnly` marks a refusal from the per-version COMPARE, which has different remedies to an upload.
|
|
13613
|
+
*
|
|
13614
|
+
* Every one of `REFUSAL_ACTIONS`' three ways out is about a FILE THE USER JUST DROPPED — "choose a
|
|
13615
|
+
* different file" reopens the dropzone, and "load it as a separate reference instead" POSTs `rvSha`.
|
|
13616
|
+
* A history compare drops no file, so on that path `rvSha` is either null (the button is then a
|
|
13617
|
+
* control whose only outcome is nothing) or, worse, LEFT OVER from an upload earlier in the session
|
|
13618
|
+
* against a different reference — in which case the primary action inserts that file into the project
|
|
13619
|
+
* from a refusal about two historical versions. Neither is a remedy; the only honest way out of "these
|
|
13620
|
+
* two versions of your own file do not relate" is to close. (Correctness review.)
|
|
13621
|
+
*/
|
|
13622
|
+
function rvRefusal(d,status,opts){
|
|
13623
|
+
const readOnly=!!(opts&&opts.readOnly);
|
|
13624
|
+
const host=rv$('rvRefuseStage');host.replaceChildren();
|
|
13625
|
+
const code=d&&d.code;
|
|
13626
|
+
const core=RC();
|
|
13627
|
+
const lead=document.createElement('div');lead.className='rflead';
|
|
13628
|
+
const acts=document.createElement('div');acts.className='rfacts';
|
|
13629
|
+
let actions=[{id:'cancel',label:'Cancel',weight:'ghost'}];
|
|
13630
|
+
|
|
13631
|
+
if(code==='reference-compare-refused'&&core){
|
|
13632
|
+
// THE WORDS ARE THE CORE'S, built from the numbers AWARE actually reported — never assembled here,
|
|
13633
|
+
// where a missing count would become a fabricated zero inside the one answer whose whole job is to
|
|
13634
|
+
// be honest about what could not be established.
|
|
13635
|
+
// THE BASE SIDE'S OWN NAME, off the refusal, and `rvRef` only as a fallback. Both routes send it
|
|
13636
|
+
// (`baseName`) precisely so this sentence can be exact — and on the history-compare path `rvRef`
|
|
13637
|
+
// is not the subject yet, so reading it names either nothing or a DIFFERENT reference, inside the
|
|
13638
|
+
// one panel whose whole job is to be honest about what could not be established. (Review.)
|
|
13639
|
+
const copy=core.refusalCopy(d.refused,(d.refused&&d.refused.baseName)||(rvRef&&rvRef.name));
|
|
13640
|
+
lead.textContent=copy.lead;
|
|
13641
|
+
const why=document.createElement('div');why.className='rfwhy';why.textContent=copy.why;
|
|
13642
|
+
host.append(lead,why);
|
|
13643
|
+
// Three weighted ways out, quietest to loudest — but all three are about a file that was just
|
|
13644
|
+
// dropped, so a read-only comparison gets only the one that applies. THERE IS NO FOURTH.
|
|
13645
|
+
actions=readOnly?[{id:'cancel',label:'Close',weight:'primary'}]:core.REFUSAL_ACTIONS;
|
|
13646
|
+
}else{
|
|
13647
|
+
lead.textContent=(d&&d.error)||'Could not load a new version of this reference.';
|
|
13648
|
+
host.appendChild(lead);
|
|
13649
|
+
if(code==='reference-filter-unmatched'){
|
|
13650
|
+
actions=[{id:'cancel',label:'Cancel',weight:'ghost'},
|
|
13651
|
+
{id:'otherfile',label:'Choose a different file',weight:'secondary'},
|
|
13652
|
+
{id:'unfiltered',label:'Load the whole file',weight:'primary'}];
|
|
13653
|
+
if(Array.isArray(d.unmatched)&&d.unmatched.length){
|
|
13654
|
+
const ul=document.createElement('ul');ul.className='rflist';
|
|
13655
|
+
for(const u of d.unmatched)ul.appendChild(Object.assign(document.createElement('li'),{textContent:String(u)}));
|
|
13656
|
+
host.appendChild(ul);
|
|
13657
|
+
}
|
|
13658
|
+
// …and the third remedy, which needs something to pick FROM: the new file's own breakdown, which
|
|
13659
|
+
// is why the route carries `probe` on this refusal and on no other.
|
|
13660
|
+
if(d.probe)host.appendChild(rvBuildRemedyPicker(d.probe));
|
|
13661
|
+
}else if(code==='reference-compare-base-unmatched'){
|
|
13662
|
+
actions=[{id:'cancel',label:'Cancel',weight:'ghost'},{id:'separate',label:'Load it as a separate reference instead',weight:'primary'}];
|
|
13663
|
+
}else if(code==='reference-version-stale'){
|
|
13664
|
+
actions=[{id:'cancel',label:'Cancel',weight:'ghost'},{id:'reload',label:'Reload the project',weight:'primary'}];
|
|
13665
|
+
}else if(code==='reference-too-many-objects'){
|
|
13666
|
+
actions=[{id:'cancel',label:'Cancel',weight:'ghost'},{id:'otherfile',label:'Choose a different file',weight:'secondary'}];
|
|
13667
|
+
}
|
|
13668
|
+
// Everything else — locked, mirror-diverged, versions-ambiguous, unresolved, filter-unreadable,
|
|
13669
|
+
// reader-too-old, and any refusal a later server adds — keeps Cancel alone. Each of those is fixed
|
|
13670
|
+
// somewhere other than this modal, and the sentence already says where; an action that cannot help
|
|
13671
|
+
// is worse than none. `status` is logged rather than shown: the code is what a user can act on.
|
|
13672
|
+
if(!code)console.warn('[reference] a version refusal arrived with no code',status,d&&d.error);
|
|
13673
|
+
}
|
|
13674
|
+
// A BELT ON TOP OF THE BRACES, and deliberately not only on the branch above. None of the compare
|
|
13675
|
+
// route's OTHER codes currently reaches a branch that offers an upload remedy — but "currently" is
|
|
13676
|
+
// the load-bearing word: this chain keys on codes, both routes can grow one, and the failure mode is
|
|
13677
|
+
// a button that silently does nothing or inserts somebody else's file. One line makes it structural.
|
|
13678
|
+
if(readOnly)actions=actions.filter(a=>a.id==='cancel');
|
|
13679
|
+
for(const a of actions)acts.appendChild(rvActBtn(a.label,a.weight,RV_ACT[a.id]||RV_ACT.cancel));
|
|
13680
|
+
host.appendChild(acts);
|
|
13681
|
+
rvStage('refuse');
|
|
13682
|
+
}
|
|
13683
|
+
|
|
13684
|
+
/**
|
|
13685
|
+
* The §6.3 remedy: pick a new filter out of the NEW file's own storeys and types.
|
|
13686
|
+
*
|
|
13687
|
+
* Everything starts UNCHECKED — this is not the import modal's "narrow the whole file down", it is "the
|
|
13688
|
+
* names you had are gone, choose the ones that replaced them". Starting all-checked would look like the
|
|
13689
|
+
* whole file and make the primary "Load the whole file" button the same act as this one.
|
|
13690
|
+
*/
|
|
13691
|
+
function rvBuildRemedyPicker(probe){
|
|
13692
|
+
const wrap=document.createElement('div');wrap.className='rfpick';
|
|
13693
|
+
const pick={storeys:new Set(),ifcTypes:new Set()};
|
|
13694
|
+
// ENABLED AND REFUSING, NOT DISABLED. A disabled button dispatches no pointer events in Chrome, so
|
|
13695
|
+
// the shared `data-tip` handler — which is `pointerover` delegation — can never fire on one: the
|
|
13696
|
+
// sentence explaining why it is disabled is the one sentence the user cannot reach. That is the same
|
|
13697
|
+
// empty-state defect the "engage UX design on every UI change" rule was granted for. So the button
|
|
13698
|
+
// stays live and says what is missing when it is pressed. (Review.)
|
|
13699
|
+
const apply=rvActBtn('Load only what I pick','secondary',()=>{
|
|
13700
|
+
if(!pick.storeys.size&&!pick.ifcTypes.size){
|
|
13701
|
+
const e=rv$('rvDropErr');e.textContent='Tick at least one storey or type first.';e.style.display='block';
|
|
13702
|
+
return;
|
|
13703
|
+
}
|
|
13704
|
+
rvFilterChoice={...(pick.storeys.size?{storeys:[...pick.storeys]}:{}),...(pick.ifcTypes.size?{ifcTypes:[...pick.ifcTypes]}:{})};
|
|
13705
|
+
rvSubmit();
|
|
13706
|
+
});
|
|
13707
|
+
const repaintApply=()=>{
|
|
13708
|
+
const n=pick.storeys.size+pick.ifcTypes.size;
|
|
13709
|
+
apply.dataset.tip=n?'Read the new version under just these':'Tick at least one storey or type first';
|
|
13710
|
+
};
|
|
13711
|
+
const axis=(label,rows,set)=>{
|
|
13712
|
+
// The reader skips objects with no storey, so a null-named row is not something a filter can pick —
|
|
13713
|
+
// the import picker says the same thing about the same rows.
|
|
13714
|
+
const usable=(rows||[]).filter(x=>x&&x.name!==null);
|
|
13715
|
+
if(!usable.length)return;
|
|
13716
|
+
const h=document.createElement('div');h.className='cat-hdr';
|
|
13717
|
+
h.append(Object.assign(document.createElement('span'),{className:'cat-label',textContent:label}),
|
|
13718
|
+
Object.assign(document.createElement('span'),{className:'cat-count',textContent:'('+usable.length+' in this file)'}));
|
|
13719
|
+
wrap.appendChild(h);
|
|
13720
|
+
const box=document.createElement('div');box.className='reftree';
|
|
13721
|
+
for(const row of usable){
|
|
13722
|
+
const l=document.createElement('label');l.className='ripick-row';
|
|
13723
|
+
const cb=document.createElement('input');cb.type='checkbox';
|
|
13724
|
+
cb.addEventListener('change',()=>{cb.checked?set.add(row.name):set.delete(row.name);repaintApply();});
|
|
13725
|
+
l.append(cb,Object.assign(document.createElement('span'),{className:'rpname',textContent:row.name}),
|
|
13726
|
+
Object.assign(document.createElement('span'),{className:'rpcount',textContent:Number(row.elements||0).toLocaleString()}));
|
|
13727
|
+
box.appendChild(l);
|
|
13728
|
+
}
|
|
13729
|
+
wrap.appendChild(box);
|
|
13730
|
+
};
|
|
13731
|
+
axis('Storeys in the new file',probe.storeys,pick.storeys);
|
|
13732
|
+
axis('Types in the new file',probe.ifcTypes||probe.types,pick.ifcTypes);
|
|
13733
|
+
if(!wrap.childElementCount)return document.createComment('the new file offers no storeys or types to pick from');
|
|
13734
|
+
repaintApply();
|
|
13735
|
+
const row=document.createElement('div');row.className='rfacts';row.appendChild(apply);
|
|
13736
|
+
wrap.appendChild(row);
|
|
13737
|
+
return wrap;
|
|
13738
|
+
}
|
|
13739
|
+
|
|
13740
|
+
/**
|
|
13741
|
+
* "Load it as a separate reference instead" — the honest remedy, and it must not cost the upload again.
|
|
13742
|
+
*
|
|
13743
|
+
* The bytes are already on the server under `rvSha`, so this is the ordinary insert with no filter: two
|
|
13744
|
+
* versions loaded side by side is a workflow that works today, and it is what a user actually wants when
|
|
13745
|
+
* the automatic answer is unavailable. The commit half mirrors `riInsert`'s presentation block rather
|
|
13746
|
+
* than calling it — that block is inside the import modal's own scope, and reaching into it would couple
|
|
13747
|
+
* two modals through a shared mutable stage machine.
|
|
13748
|
+
*/
|
|
13749
|
+
async function rvLoadSeparately(){
|
|
13750
|
+
if(!rvSha||rvBusy)return;
|
|
13751
|
+
const mine=++rvRun;rvBusy=true;
|
|
13752
|
+
rvStage('prog');rv$('rvProgNote').style.display='block';
|
|
13753
|
+
rvProg('Adding “'+rvName+'” as its own reference…','AWARE is tessellating objects and preparing the viewer file.');
|
|
13754
|
+
rvAbort=new AbortController();
|
|
13755
|
+
let d=null,mid=null;
|
|
13756
|
+
try{
|
|
13757
|
+
mid=newMutationId();claimMutation(mid);
|
|
13758
|
+
const res=await fetch(refApi(''),{method:'POST',signal:rvAbort.signal,
|
|
13759
|
+
headers:{'content-type':'application/json','x-floless-mutation-id':mid},
|
|
13760
|
+
body:JSON.stringify({sha:rvSha,name:rvName})});
|
|
13761
|
+
d=await res.json().catch(()=>({}));
|
|
13762
|
+
if(mine!==rvRun){releaseMutation(mid);return;}
|
|
13763
|
+
rvClearSoft();
|
|
13764
|
+
if(!res.ok||!d.ok){releaseMutation(mid);rvStage('drop');rvErr(d.error||'Could not add that reference.');return;}
|
|
13765
|
+
}catch(e){
|
|
13766
|
+
if(mine!==rvRun||(e&&e.name==='AbortError')){if(mid)releaseMutation(mid);return;}
|
|
13767
|
+
if(mid)releaseMutation(mid);
|
|
13768
|
+
rvClearSoft();rvStage('drop');rvErr('Could not add that reference.');
|
|
13769
|
+
console.error('[reference] separate insert failed',e);return;
|
|
13770
|
+
}finally{if(mine===rvRun){rvBusy=false;rvFlow=null;rvAbort=null;}}
|
|
13771
|
+
rvClose();
|
|
13772
|
+
try{
|
|
13773
|
+
adoptReferenceWrite(d.etag);
|
|
13774
|
+
if(!Array.isArray(C.reference_models))C.reference_models=[];
|
|
13775
|
+
C.reference_models.push(d.reference);
|
|
13776
|
+
refGeom.set(d.reference.id,refGeomFrom(d));
|
|
13777
|
+
refSelectedId=d.reference.id;refMeasureFollowSelection();refSelectedObjIdx=null;
|
|
13778
|
+
pushReferences();setLegendTab('refs');showLegendPanel('refs',true);
|
|
13779
|
+
if(window.Steel3DView&&window.Steel3DView.frameReference)window.Steel3DView.frameReference(d.reference.id);
|
|
13780
|
+
renderRefsTab();
|
|
13781
|
+
toast('Added “'+d.reference.name+'” as a separate reference');
|
|
13782
|
+
}catch(e){
|
|
13783
|
+
console.error('[reference] added, but the view could not be updated',e);
|
|
13784
|
+
toast('Added “'+rvName+'” — reload the view to see it');
|
|
13785
|
+
}
|
|
13786
|
+
}
|
|
13787
|
+
|
|
13788
|
+
// ── The change list ────────────────────────────────────────────────────────────────────────────────
|
|
13789
|
+
let rcData=null; // {refId, changes, summary, criteria, selected, version, versions}
|
|
13790
|
+
let rcQuery='';
|
|
13791
|
+
let rcGroups=new Map(); // group key -> open?
|
|
13792
|
+
let rcSel=null; // the GlobalId of the row that is selected, or null
|
|
13793
|
+
// What THIS load could not carry over from the session (#734 Phase 5) — fact phrases, empty when
|
|
13794
|
+
// everything migrated. Filled once, immediately before `rcShow`, because it is computed from state that
|
|
13795
|
+
// no longer exists by the time the panel paints; cleared at the top of every run so a second comparison
|
|
13796
|
+
// can never inherit the first one's sentence.
|
|
13797
|
+
let rcCarried=[];
|
|
13798
|
+
|
|
13799
|
+
function rcShow(d){
|
|
13800
|
+
const c=d&&d.comparison;
|
|
13801
|
+
if(!c){
|
|
13802
|
+
// A success with no comparison is a server we do not understand. Saying so beats drawing an empty
|
|
13803
|
+
// list, which would read as "nothing changed".
|
|
13804
|
+
console.error('[reference] the new version arrived without a comparison');
|
|
13805
|
+
// THE CARRYOVER SENTENCE GOES WITH IT, appended rather than fired as a second toast — this branch
|
|
13806
|
+
// never paints `#rcIssues`, so the sentence has no other way out, and the geometry really was
|
|
13807
|
+
// replaced. Losing it here would be the one path on which this feature drops the user's session
|
|
13808
|
+
// silently, which is the single thing it exists to prevent. One toast, because two would replace
|
|
13809
|
+
// each other in the same slot.
|
|
13810
|
+
const lost=refCarryoverSentence(rcCarried,'version');
|
|
13811
|
+
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;
|
|
13812
|
+
}
|
|
13813
|
+
rcData={refId:(rvRef&&rvRef.id)||null,name:(d.version&&d.version.name)||rvName,
|
|
13814
|
+
// WHAT THIS COMPARISON WAS ACTUALLY AGAINST, captured from the request rather than re-derived —
|
|
13815
|
+
// see `rcPreviousVersionId`. Null on a chainless reference, which is the one case that falls back.
|
|
13816
|
+
comparedAgainst:rvComparedAgainst,
|
|
13817
|
+
// WHICH TWO VERSIONS THIS IS ABOUT, when it is not "the one you had vs the one you just dropped".
|
|
13818
|
+
// Absent on the upload path, which is the ordinary one, so its header is untouched.
|
|
13819
|
+
pair:d.pair||null,
|
|
13820
|
+
changes:Array.isArray(c.changes)?c.changes:[],summary:c.summary,criteria:c.criteria||[],
|
|
13821
|
+
selected:c.selected||null,identity:c.identity||null,
|
|
13822
|
+
version:d.version||null,versions:Array.isArray(d.versions)?d.versions:[]};
|
|
13823
|
+
rcQuery='';rcGroups=new Map();rcSel=null;
|
|
13824
|
+
// A NEW COMPARISON OWNS A NEW SET OF GHOSTS. Left standing, the previous one's deletions would be
|
|
13825
|
+
// drawn beside a list that no longer mentions them — geometry asserting something nothing says.
|
|
13826
|
+
rcGhostReset();
|
|
13827
|
+
rcPaintHead();rcPaintIssues();rcPaintControls();rcPaintList();rcPaintUncomparable();rcPaintFoot();
|
|
13828
|
+
rvStage('result');
|
|
13829
|
+
rv$('rvBody').scrollTop=0;
|
|
13830
|
+
}
|
|
13831
|
+
|
|
13832
|
+
/**
|
|
13833
|
+
* The header: what this is, then FIVE counts as chips of equal weight.
|
|
13834
|
+
*
|
|
13835
|
+
* EVERY COUNT APPEARS, `uncomparable` included, and including the zeroes. A zero that is drawn is a fact
|
|
13836
|
+
* ("nothing was uncomparable"); a zero that is hidden is indistinguishable from a question nobody asked.
|
|
13837
|
+
*/
|
|
13838
|
+
function rcPaintHead(){
|
|
13839
|
+
const head=rv$('rcHead');head.replaceChildren();
|
|
13840
|
+
const core=RC();if(!core||!rcData)return;
|
|
13841
|
+
const sub=document.createElement('div');sub.className='rcsubject';
|
|
13842
|
+
const b=document.createElement('b');b.textContent='“'+rcData.name+'”';
|
|
13843
|
+
const n=rcData.versions.length;
|
|
13844
|
+
const when=rcData.version&&rcData.version.importedAt?new Date(rcData.version.importedAt):null;
|
|
13845
|
+
// TWO DIFFERENT QUESTIONS, TWO DIFFERENT SENTENCES. An upload compares the file you just dropped
|
|
13846
|
+
// against the one you had; a history compare names BOTH versions, because neither of them is "the
|
|
13847
|
+
// one you just dropped" and a header saying so would be false. (#734 Phase 6.)
|
|
13848
|
+
sub.append(b,document.createTextNode(rcData.pair
|
|
13849
|
+
? ' — version '+rcData.pair.baseN+' compared with version '+rcData.pair.revisedN
|
|
13850
|
+
+' (the version you have), matching each object by the id its file gives it.'
|
|
13851
|
+
: (n?' — version '+n:'')+(when&&!isNaN(when)?', imported '+when.toLocaleDateString():'')
|
|
13852
|
+
+'. Compared with the version you had, matching each object by the id its file gives it.'));
|
|
13853
|
+
head.appendChild(sub);
|
|
13854
|
+
const stats=document.createElement('div');stats.id='rcStats';
|
|
13855
|
+
stats.setAttribute('role','list');stats.setAttribute('aria-label','What changed, in numbers');
|
|
13856
|
+
for(const s of core.summaryStats(rcData.summary)){
|
|
13857
|
+
// The MODIFIER off the core's own class string, so the header chips and the row badges take their
|
|
13858
|
+
// colour from one decision. `unchanged` lands on `rc-plain` and recedes, which is its whole job.
|
|
13859
|
+
const mod=String(core.STATUS[s.key].cls).split(/\s+/).pop();
|
|
13860
|
+
const chip=document.createElement('span');chip.className='rcstat '+mod;chip.setAttribute('role','listitem');
|
|
13861
|
+
chip.dataset.key=s.key;
|
|
13862
|
+
if(s.glyph)chip.appendChild(Object.assign(document.createElement('span'),{className:'rcg',textContent:s.glyph}));
|
|
13863
|
+
chip.appendChild(Object.assign(document.createElement('span'),{className:'rcn',textContent:s.text}));
|
|
13864
|
+
chip.appendChild(Object.assign(document.createElement('span'),{className:'rcw',textContent:s.word}));
|
|
13865
|
+
// WHY `unchanged` HAS NO ROWS, said on the chip rather than left as a silence. AWARE is never asked
|
|
13866
|
+
// for them (`include-unchanged` is deliberately never passed — they are ~99% of a real revision and
|
|
13867
|
+
// would be a list saying nothing happened), so they are counted and not listed. There is deliberately
|
|
13868
|
+
// no "show unchanged too" toggle: a control that can only reveal nothing is worse than no control.
|
|
13869
|
+
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.';
|
|
13870
|
+
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”.';
|
|
13871
|
+
stats.appendChild(chip);
|
|
13872
|
+
}
|
|
13873
|
+
head.appendChild(stats);
|
|
13874
|
+
}
|
|
13875
|
+
|
|
13876
|
+
/** The two things that need eyes, pinned near the top rather than under 12,000 rows (decision A). */
|
|
13877
|
+
function rcPaintIssues(){
|
|
13878
|
+
const host=rv$('rcIssues');host.replaceChildren();
|
|
13879
|
+
const ban=(text,actionLabel,fn,mod)=>{
|
|
13880
|
+
const d=document.createElement('div');d.className='rcban'+(mod?' '+mod:'');
|
|
13881
|
+
d.appendChild(Object.assign(document.createElement('span'),{className:'rcbantx',textContent:text}));
|
|
13882
|
+
if(actionLabel){const b=document.createElement('button');b.type='button';b.className='pilllink';b.textContent=actionLabel;
|
|
13883
|
+
b.addEventListener('click',fn);d.appendChild(b);}
|
|
13884
|
+
host.appendChild(d);
|
|
13885
|
+
};
|
|
13886
|
+
// THE TWO AMBER BANNERS ARE ABOUT THE COMPARISON, so they need its module and its data. The plain one
|
|
13887
|
+
// below is about the USER'S SESSION and needs neither — gating it on `RC()` meant a failure to load
|
|
13888
|
+
// `reference-changes.js` silently suppressed a report that has nothing to do with it. (Review.)
|
|
13889
|
+
const core=RC();
|
|
13890
|
+
if(core&&rcData){
|
|
13891
|
+
const unk=rcData.summary&&rcData.summary.uncomparable;
|
|
13892
|
+
if(unk>0){
|
|
13893
|
+
ban(unk.toLocaleString()+' object'+(unk===1?'':'s')+' could not be compared, so this list is not the whole story.',
|
|
13894
|
+
'See why',()=>{const t=rv$('rcUncomparable');if(t)try{t.scrollIntoView({block:'nearest',behavior:'smooth'});}catch(_){t.scrollIntoView();}});
|
|
13895
|
+
}
|
|
13896
|
+
// NOT LIKE FOR LIKE. A new version read under a different scope than the old one, with nothing
|
|
13897
|
+
// saying so, is design §10's "must never happen": rows would appear as added or removed because of
|
|
13898
|
+
// the FILTER rather than because the building changed.
|
|
13899
|
+
if(core.filterDiffers(rcData.selected)){
|
|
13900
|
+
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.');
|
|
13901
|
+
}
|
|
13902
|
+
}
|
|
13903
|
+
// LAST, AND PLAIN. This one is about YOUR session, not about the two files — so it reads after both
|
|
13904
|
+
// banners that mean "needs review", and in the muted tokens rather than amber. No action button: the
|
|
13905
|
+
// uncomparable banner's "See why" scrolls to a section that exists, and there is nothing here to
|
|
13906
|
+
// scroll to. Silent when everything carried, which is the ordinary case.
|
|
13907
|
+
const say=refCarryoverSentence(rcCarried,'version');
|
|
13908
|
+
if(say)ban(say,null,null,'plain');
|
|
13909
|
+
}
|
|
13910
|
+
|
|
13911
|
+
function rcPaintControls(){
|
|
13912
|
+
const host=rv$('rcControls');host.replaceChildren();
|
|
13913
|
+
if(!rcData||!rcData.changes.length){host.style.display='none';return;}
|
|
13914
|
+
host.style.display='';
|
|
13915
|
+
const inp=document.createElement('input');inp.type='text';inp.id='rcSearch';
|
|
13916
|
+
inp.placeholder='Filter by name, type or storey…';inp.autocomplete='off';
|
|
13917
|
+
inp.setAttribute('role','searchbox');inp.setAttribute('aria-label','Filter the changed objects');
|
|
13918
|
+
inp.addEventListener('keydown',e=>e.stopPropagation()); // the editor's global shortcuts must not see typing
|
|
13919
|
+
// ONLY THE LIST REPAINTS, so this input survives its own typing — the object tree has to restore its
|
|
13920
|
+
// caret by id because it rebuilds the whole tab; here there is nothing to restore.
|
|
13921
|
+
inp.addEventListener('input',()=>{rcQuery=inp.value;rcPaintList();});
|
|
13922
|
+
host.appendChild(inp);
|
|
13923
|
+
}
|
|
13924
|
+
|
|
13925
|
+
const rcMatches=(ch,q)=>{
|
|
13926
|
+
if(!q)return true;
|
|
13927
|
+
return [ch.name,ch.ifcType,ch.storey,ifcTypeWords(ch.ifcType),ch.profile,ch.material]
|
|
13928
|
+
.filter(s=>typeof s==='string').join(' ').toLowerCase().includes(q);
|
|
13929
|
+
};
|
|
13930
|
+
|
|
13931
|
+
/**
|
|
13932
|
+
* The grouped, capped list.
|
|
13933
|
+
*
|
|
13934
|
+
* ROWS ARE WHAT AWARE LISTED, which is added, removed and changed and nothing else — so the default
|
|
13935
|
+
* "needs attention" view (decision C) is what the data already is, and `needsAttention` here is the
|
|
13936
|
+
* guard that keeps it true if an unchanged row ever arrives rather than a filter with a control.
|
|
13937
|
+
*/
|
|
13938
|
+
function rcPaintList(){
|
|
13939
|
+
const host=rv$('rcList');host.replaceChildren();
|
|
13940
|
+
const core=RC();if(!core||!rcData)return;
|
|
13941
|
+
const q=rcQuery.trim().toLowerCase();
|
|
13942
|
+
const rows=rcData.changes.filter(core.needsAttention).filter(ch=>rcMatches(ch,q));
|
|
13943
|
+
if(!rcData.changes.length){
|
|
13944
|
+
// "Nothing changed" gets its OWN calm state, visually distinct from a refusal (decision J), with the
|
|
13945
|
+
// five counts still above it — "great, nothing changed" and "these could not be compared" must not
|
|
13946
|
+
// be confusable at a glance.
|
|
13947
|
+
const e=document.createElement('div');e.className='rcempty';
|
|
13948
|
+
e.appendChild(Object.assign(document.createElement('b'),{textContent:'Nothing changed'}));
|
|
13949
|
+
e.appendChild(document.createTextNode('Every object FloLess could match is where it was, the same shape, the same profile and the same material.'));
|
|
13950
|
+
host.appendChild(e);return;
|
|
13951
|
+
}
|
|
13952
|
+
if(!rows.length){
|
|
13953
|
+
host.appendChild(Object.assign(document.createElement('div'),{className:'rcempty',
|
|
13954
|
+
textContent:'Nothing matches “'+rcQuery.trim()+'”.'}));
|
|
13955
|
+
return;
|
|
13956
|
+
}
|
|
13957
|
+
const groups=groupReferenceObjects(rows);
|
|
13958
|
+
const flat=groups.length===1&&groups[0].storey===null;
|
|
13959
|
+
groups.forEach((s,si)=>{
|
|
13960
|
+
const sKey='s'+si;
|
|
13961
|
+
// A group holding something to look at opens itself; one that does not opens collapsed showing its
|
|
13962
|
+
// count (decision E) — never dump the whole building open, never hide the thing that matters either.
|
|
13963
|
+
const sOpen=rcGroups.has(sKey)?rcGroups.get(sKey)
|
|
13964
|
+
:(flat||groups.length===1||core.groupNeedsAttention(s.types.flatMap(t=>t.indices.map(i=>rows[i]))));
|
|
13965
|
+
if(!flat){
|
|
13966
|
+
const h=document.createElement('div');h.className='cat-hdr';h.setAttribute('role','button');
|
|
13967
|
+
h.setAttribute('aria-expanded',String(sOpen));
|
|
13968
|
+
h.append(Object.assign(document.createElement('span'),{className:'cat-chevron',textContent:sOpen?'▼':'▶'}),
|
|
13969
|
+
Object.assign(document.createElement('span'),{className:'cat-label',textContent:s.storey||'No storey recorded'}),
|
|
13970
|
+
Object.assign(document.createElement('span'),{className:'cat-count',textContent:'('+s.count+')'}));
|
|
13971
|
+
h.dataset.tip=(s.storey||'The file records no storey for these objects')+' — '+s.count+' changed object'+(s.count===1?'':'s');
|
|
13972
|
+
h.addEventListener('click',()=>{rcGroups.set(sKey,!sOpen);rcPaintList();});
|
|
13973
|
+
refTreeKeyOperable(h);
|
|
13974
|
+
host.appendChild(h);
|
|
13975
|
+
}
|
|
13976
|
+
if(!sOpen)return;
|
|
13977
|
+
s.types.forEach((t,ti)=>{
|
|
13978
|
+
const tKey=si+':'+ti;
|
|
13979
|
+
const tOpen=rcGroups.has(tKey)?rcGroups.get(tKey):(s.types.length===1||core.groupNeedsAttention(t.indices.map(i=>rows[i])));
|
|
13980
|
+
const h=document.createElement('div');h.className='cat-hdr'+(flat?'':' sub');h.setAttribute('role','button');
|
|
13981
|
+
h.setAttribute('aria-expanded',String(tOpen));
|
|
13982
|
+
h.append(Object.assign(document.createElement('span'),{className:'cat-chevron',textContent:tOpen?'▼':'▶'}),
|
|
13983
|
+
Object.assign(document.createElement('span'),{className:'cat-label',textContent:t.words||'No type recorded'}),
|
|
13984
|
+
Object.assign(document.createElement('span'),{className:'cat-count',textContent:'('+t.count+')'}));
|
|
13985
|
+
h.dataset.tip=(t.type||'The file records no IFC type for these objects')+' — '+t.count+' changed object'+(t.count===1?'':'s');
|
|
13986
|
+
h.addEventListener('click',()=>{rcGroups.set(tKey,!tOpen);rcPaintList();});
|
|
13987
|
+
refTreeKeyOperable(h);
|
|
13988
|
+
host.appendChild(h);
|
|
13989
|
+
if(!tOpen)return;
|
|
13990
|
+
// THE SELECTED ROW IS NEVER THE ONE THE CAP DROPS — the same centred window the object tree uses,
|
|
13991
|
+
// and `capWindow` carries the sentence that admits to the cap. A list that stops at 300 with no
|
|
13992
|
+
// explanation reads as "that is all there was".
|
|
13993
|
+
const want=rcSel?t.indices.findIndex(i=>rows[i].id===rcSel):-1;
|
|
13994
|
+
const win=core.capWindow(t.indices,want);
|
|
13995
|
+
for(const i of win.shown)host.appendChild(rcBuildRow(rows[i]));
|
|
13996
|
+
if(win.note)host.appendChild(Object.assign(document.createElement('div'),{className:'rccap',textContent:win.note}));
|
|
13997
|
+
});
|
|
13998
|
+
});
|
|
13999
|
+
// RE-ARMED ON EVERY PAINT, because this rebuilds every row — an observer holding nodes that are no
|
|
14000
|
+
// longer in the document watches nothing and reports nothing, silently.
|
|
14001
|
+
rcObserveGhosts(host);
|
|
14002
|
+
}
|
|
14003
|
+
|
|
14004
|
+
function rcBuildRow(ch){
|
|
14005
|
+
const core=RC();
|
|
14006
|
+
const row=document.createElement('div');
|
|
14007
|
+
row.className='rcrow'+(rcSel===ch.id?' sel':'');
|
|
14008
|
+
row.dataset.gid=ch.id;row.dataset.status=ch.status;
|
|
14009
|
+
row.setAttribute('role','button');row.tabIndex=0;
|
|
14010
|
+
const st=core.STATUS[ch.status]||core.STATUS.changed;
|
|
14011
|
+
// GLYPH AND WORD IN THE DOM, not only in a tooltip (decision B) — colour alone is not an encoding, and
|
|
14012
|
+
// a hover-only label is invisible to anyone not hovering.
|
|
14013
|
+
const chip=document.createElement('span');chip.className=st.cls;
|
|
14014
|
+
if(st.glyph)chip.appendChild(Object.assign(document.createElement('span'),{className:'rcg',textContent:st.glyph}));
|
|
14015
|
+
chip.appendChild(document.createTextNode(st.word));
|
|
14016
|
+
row.appendChild(chip);
|
|
14017
|
+
const named=refObjNamed(ch.name);
|
|
14018
|
+
row.appendChild(Object.assign(document.createElement('span'),{className:'rcnm',
|
|
14019
|
+
textContent:named?String(ch.name).trim():(ifcTypeWords(ch.ifcType)||'Object')}));
|
|
14020
|
+
// `changedBy` AS UP TO THREE SMALL CHIPS; `fields` is deliberately not rendered inline at all — it is
|
|
14021
|
+
// the one payload that genuinely becomes a paragraph, and it belongs in the click-through, not the row.
|
|
14022
|
+
if(Array.isArray(ch.changedBy)&&ch.changedBy.length){
|
|
14023
|
+
const by=document.createElement('span');by.className='rcby';
|
|
14024
|
+
for(const c of ch.changedBy.slice(0,3))by.appendChild(Object.assign(document.createElement('span'),{textContent:c}));
|
|
14025
|
+
if(ch.changedBy.length>3){
|
|
14026
|
+
const more=Object.assign(document.createElement('span'),{textContent:'+'+(ch.changedBy.length-3)});
|
|
14027
|
+
more.dataset.tip='Also: '+ch.changedBy.slice(3).join(', ');
|
|
14028
|
+
by.appendChild(more);
|
|
14029
|
+
}
|
|
14030
|
+
row.appendChild(by);
|
|
14031
|
+
}
|
|
14032
|
+
// The distance in words as well as numbers, and ONLY where `location` actually fired: a "0 mm" printed
|
|
14033
|
+
// against a reprofiled column would be an assertion nobody made.
|
|
14034
|
+
const moved=core.movedPhrase(ch);
|
|
14035
|
+
if(moved)row.appendChild(Object.assign(document.createElement('span'),{className:'rcmv',textContent:moved}));
|
|
14036
|
+
row.dataset.tip=(named?String(ch.name).trim():'This file gives it no name')
|
|
14037
|
+
+' — '+(ch.ifcType||'no IFC type')+(ch.storey?' · '+ch.storey:'')
|
|
14038
|
+
+(ch.profile?' · '+ch.profile:'')
|
|
14039
|
+
+' — '+st.word+(moved?', '+moved:'');
|
|
14040
|
+
row.addEventListener('click',()=>rcActivate(ch));
|
|
14041
|
+
row.addEventListener('keydown',e=>{
|
|
14042
|
+
if(e.key!=='Enter'&&e.key!==' ')return;
|
|
14043
|
+
e.preventDefault();e.stopPropagation();row.click();
|
|
14044
|
+
});
|
|
14045
|
+
return row;
|
|
14046
|
+
}
|
|
14047
|
+
|
|
14048
|
+
/** `globalId` → its index in the CURRENT version's geometry. Built per activation; the map is the only
|
|
14049
|
+
* honest bridge between a change list keyed by id and a 3D layer addressed by index. */
|
|
14050
|
+
function rcIndexOf(refId,gid){
|
|
14051
|
+
const objs=(refGeom.get(refId)||{}).objects||[];
|
|
14052
|
+
for(let i=0;i<objs.length;i++)if(objs[i]&&objs[i].globalId===gid)return i;
|
|
14053
|
+
return -1;
|
|
14054
|
+
}
|
|
14055
|
+
|
|
14056
|
+
function rcActivate(ch){
|
|
14057
|
+
if(!rcData)return;
|
|
14058
|
+
rcSel=ch.id;rcPaintList();
|
|
14059
|
+
const v=window.Steel3DView;
|
|
14060
|
+
if(!v||!v.selectReferenceObject){toast('The 3D view isn’t ready yet — try again in a moment');return;}
|
|
14061
|
+
if(ch.status==='removed'){
|
|
14062
|
+
// A REMOVED OBJECT IS NOT IN THE NEW VERSION, so there is nothing here to select — and selecting
|
|
14063
|
+
// something else instead is how a panel comes to describe an object the user did not pick.
|
|
14064
|
+
// `rcGhostFor` draws its shape from the version it vanished from and flies to that.
|
|
14065
|
+
//
|
|
14066
|
+
// THE PREVIOUS DRILL IS DROPPED, and that is the half this used to miss. Clicking a changed row
|
|
14067
|
+
// and then a removed one left the earlier object still lit in 3D while the list highlighted the
|
|
14068
|
+
// removed one — the canvas and the panel each confidently describing a DIFFERENT object. Nothing
|
|
14069
|
+
// takes its place here, because nothing can; saying "no object is selected" is the honest state.
|
|
14070
|
+
// (Found by the independent QA pass, which read `selectedReferenceObject()` and got the beam.)
|
|
14071
|
+
if(v.selectReference)v.selectReference(rcData.refId);
|
|
14072
|
+
refSelectedObjIdx=null;panel();
|
|
14073
|
+
rcGhostFor(ch);return;
|
|
14074
|
+
}
|
|
14075
|
+
const idx=rcIndexOf(rcData.refId,ch.id);
|
|
14076
|
+
if(idx<0){
|
|
14077
|
+
console.error('[reference] change row',ch.id,'has no object in the new geometry');
|
|
14078
|
+
toast('That object isn’t in the 3D scene — use ⋯ ▸ Reload its geometry');return;
|
|
14079
|
+
}
|
|
14080
|
+
let ok=false;
|
|
14081
|
+
try{ok=v.selectReferenceObject(rcData.refId,idx);}
|
|
14082
|
+
catch(e){console.error('[reference] selecting',ch.id,'threw',e);toast('Could not select that object');return;}
|
|
14083
|
+
if(!ok){toast('That object isn’t in the 3D scene — use ⋯ ▸ Reload its geometry');return;}
|
|
14084
|
+
if(v.frameReferenceObject)v.frameReferenceObject(rcData.refId,idx);
|
|
14085
|
+
// The editor's own selection state follows, so the Inspect panel and the object tree agree with the
|
|
14086
|
+
// scene rather than describing whatever was picked before.
|
|
14087
|
+
refSelectedId=rcData.refId;refSelectedObjIdx=idx;panel();
|
|
14088
|
+
}
|
|
14089
|
+
|
|
14090
|
+
// ── GHOSTS: where the removed objects used to be (design §6.4) ─────────────────────────────────────
|
|
14091
|
+
//
|
|
14092
|
+
// LAZY, AND THAT IS THE DESIGN rather than an optimisation. A revision with 3,000 deletions must not
|
|
14093
|
+
// tessellate 3,000 objects nobody scrolled to, so a row asks for its own shape when it comes into view
|
|
14094
|
+
// and never before. The server reads them out of the version they vanished FROM — the only file that
|
|
14095
|
+
// can answer where they were — by GlobalId, which every removed object is guaranteed to have.
|
|
14096
|
+
const RC_GHOST_BATCH=60; // well under the route's cap of 200; one screenful of rows is far fewer
|
|
14097
|
+
let rcGhostAsked=new Set(); // ids already requested — a row scrolled past twice is not two requests
|
|
14098
|
+
let rcGhostQueue=[],rcGhostTimer=null,rcGhostFailed=false;
|
|
14099
|
+
/** Said ONCE per panel. Distinct from `rcGhostFailed`, which is the harder question "stop asking?" —
|
|
14100
|
+
* a retriable failure still owes the user a sentence, and still must not repeat it per batch. */
|
|
14101
|
+
let rcGhostToldOnce=false;
|
|
14102
|
+
let rcGhostObserver=null;
|
|
14103
|
+
/** A ghost a click asked to fly to, held until it exists. A `setTimeout` guess would be a race. */
|
|
14104
|
+
let rcGhostFrameWanted=null;
|
|
14105
|
+
/**
|
|
14106
|
+
* THIS SET OF GHOSTS' IDENTITY — the same lesson the import modal paid for, one layer down.
|
|
14107
|
+
*
|
|
14108
|
+
* A ghost read is a whole IFC parse and can take a minute; the user can close the panel or load
|
|
14109
|
+
* another version long before it answers. Without an identity the late response draws its shapes
|
|
14110
|
+
* anyway — into a NEW group, because `rcGhostReset` cleared the old one — leaving unexplained red
|
|
14111
|
+
* geometry inside somebody else's building with no list on screen saying what it is. Cancelling is
|
|
14112
|
+
* best-effort (a response already on the wire lands regardless), so the token is what actually
|
|
14113
|
+
* decides, exactly as `riRun` does for the import. (Codex review.)
|
|
14114
|
+
*/
|
|
14115
|
+
let rcGhostRun=0;
|
|
14116
|
+
/**
|
|
14117
|
+
* EVERY in-flight ghost read, not just the newest.
|
|
14118
|
+
*
|
|
14119
|
+
* A single `rcGhostAbort` slot looked tidy and was a bug with teeth: batches legitimately overlap —
|
|
14120
|
+
* `rcGhostFor` jumps the timer while a scroll-driven batch is still running — so aborting "the
|
|
14121
|
+
* previous one" before each flush killed a request that was doing exactly what it should. Its ids had
|
|
14122
|
+
* already been spliced off the queue, and an AbortError returns before the give-up path, so those rows
|
|
14123
|
+
* were consumed, never drawn, and never re-requestable: scrolling produced no new ghosts at all. Found
|
|
14124
|
+
* by the independent QA pass, and it is the same poisoning this file fixed one round earlier, walked
|
|
14125
|
+
* back in by the fix for an orphaned controller.
|
|
14126
|
+
*
|
|
14127
|
+
* A SET, so cancelling belongs to `rcGhostReset` alone — which is the only place that genuinely means
|
|
14128
|
+
* "none of these answers are wanted any more".
|
|
14129
|
+
*/
|
|
14130
|
+
const rcGhostFlights=new Set();
|
|
14131
|
+
|
|
14132
|
+
/**
|
|
14133
|
+
* The version the removed objects belong to — the one this upload was COMPARED AGAINST.
|
|
14134
|
+
*
|
|
14135
|
+
* TAKEN FROM WHAT WE SENT, not inferred from array position. `expectedVersionId` is by definition the
|
|
14136
|
+
* version the route compared against: it is the precondition the route re-checks inside its own lock
|
|
14137
|
+
* before appending, so a comparison that succeeded compared against exactly that id. Reading
|
|
14138
|
+
* `versions[length-2]` instead is an inference about ordering, and it reads the wrong file — drawing
|
|
14139
|
+
* ghosts from the wrong version as fact — the moment anything reorders the chain. (Review.)
|
|
14140
|
+
*
|
|
14141
|
+
* THE FALLBACK IS FOR THE CHAINLESS CASE, and only that: a reference with no history sends
|
|
14142
|
+
* `expectedVersionId: null`, and the route synthesises a v1 with a server-generated id via
|
|
14143
|
+
* `adoptChain`. There, the second-from-last row IS that synthesised v1, and the position is the only
|
|
14144
|
+
* handle we have on it.
|
|
14145
|
+
*/
|
|
14146
|
+
function rcPreviousVersionId(){
|
|
14147
|
+
if(rcData&&rcData.comparedAgainst)return rcData.comparedAgainst;
|
|
14148
|
+
const v=rcData&&rcData.versions;
|
|
14149
|
+
return Array.isArray(v)&&v.length>=2?(v[v.length-2].id||null):null;
|
|
14150
|
+
}
|
|
14151
|
+
|
|
14152
|
+
/**
|
|
14153
|
+
* Ask for a batch, once the queue has settled.
|
|
14154
|
+
*
|
|
14155
|
+
* BATCHED ON A TIMER rather than per row: scrolling a list past forty removed rows would otherwise be
|
|
14156
|
+
* forty reads of the same IFC, each queueing behind the last on the one serialized reader chain.
|
|
14157
|
+
*/
|
|
14158
|
+
/**
|
|
14159
|
+
* THE WHOLE-REQUEST REFUSALS, which are the only ones worth saying once and then giving up on.
|
|
14160
|
+
*
|
|
14161
|
+
* Everything else — a 500 on one batch, a dropped connection — is about THESE ROWS, so latching the
|
|
14162
|
+
* panel dead on it would trade one bad batch for every remaining ghost. (Review: `!res.ok` alone
|
|
14163
|
+
* could not tell the two apart, and a single 500 disabled the layer for the panel's life.)
|
|
14164
|
+
*/
|
|
14165
|
+
// `reference-versions-ambiguous` joins them for the same reason: a chain with a duplicate id cannot be
|
|
14166
|
+
// fixed by asking again in a smaller batch, so retrying would re-request every batch for the panel's
|
|
14167
|
+
// life. (#734 Phase 6 — the gate the ghost route shipped without.)
|
|
14168
|
+
const RC_GHOST_FATAL=new Set(['reference-ghost-file-missing','reference-ghost-version-unknown','reference-versions-ambiguous']);
|
|
14169
|
+
|
|
14170
|
+
/**
|
|
14171
|
+
* Say it, once, and put the ids back if they can still be asked for.
|
|
14172
|
+
*
|
|
14173
|
+
* ABSENT GHOSTS MUST NOT READ AS "NOTHING WAS REMOVED" — that is this layer's whole promise, and it
|
|
14174
|
+
* was being kept on exactly ONE of the paths that can produce an absent ghost. The ids are spliced
|
|
14175
|
+
* off the queue BEFORE anything can fail, and `rcGhostAsked` refuses to re-queue them, so every
|
|
14176
|
+
* silent path was also permanent: scrolling back did nothing, forever. (Review.)
|
|
14177
|
+
*/
|
|
14178
|
+
function rcGhostGaveUp(ids,fatal,message){
|
|
14179
|
+
if(!fatal)for(const id of ids)rcGhostAsked.delete(id); // retriable: a later scroll may ask again
|
|
14180
|
+
else rcGhostFailed=true;
|
|
14181
|
+
if(!rcGhostToldOnce){rcGhostToldOnce=true;toast(message);}
|
|
14182
|
+
// A CLICK IS A DIRECT REQUEST AND GETS A DIRECT ANSWER. Left set, it would sit there while the user
|
|
14183
|
+
// watched a camera that never moved.
|
|
14184
|
+
rcGhostFrameWanted=null;
|
|
14185
|
+
}
|
|
14186
|
+
|
|
14187
|
+
function rcGhostFlush(){
|
|
14188
|
+
rcGhostTimer=null;
|
|
14189
|
+
const ids=rcGhostQueue.splice(0,RC_GHOST_BATCH);
|
|
14190
|
+
if(!ids.length)return;
|
|
14191
|
+
const versionId=rcPreviousVersionId(),refId=rcData&&rcData.refId;
|
|
14192
|
+
// SPLICED ALREADY, so they go back — without this the batch is gone for good with no log and no
|
|
14193
|
+
// message, which is the same silent-drop shape as the failure paths below.
|
|
14194
|
+
if(!versionId||!refId){for(const id of ids)rcGhostAsked.delete(id);rcGhostQueue.unshift(...ids);return;}
|
|
14195
|
+
const mine=rcGhostRun;
|
|
14196
|
+
// TRACKED, NOT REPLACED. Overlapping batches are normal — a click jumps the timer while a scrolled
|
|
14197
|
+
// batch is still running — so each keeps its own controller and only `rcGhostReset` cancels them.
|
|
14198
|
+
const flight=new AbortController();
|
|
14199
|
+
rcGhostFlights.add(flight);
|
|
14200
|
+
fetch(refApi('/'+encodeURIComponent(refId)+'/ghosts'),{method:'POST',signal:flight.signal,
|
|
14201
|
+
headers:{'content-type':'application/json'},
|
|
14202
|
+
body:JSON.stringify({versionId,ids})}).then(async res=>{
|
|
14203
|
+
const d=await res.json().catch(()=>({}));
|
|
14204
|
+
// THE ANSWER IS ONLY OURS IF THIS IS STILL THE SAME SET OF GHOSTS. Checked before the refusal
|
|
14205
|
+
// branch as well as the success one: a toast about an abandoned read is as wrong as its geometry.
|
|
14206
|
+
if(mine!==rcGhostRun)return;
|
|
14207
|
+
if(!res.ok||!d.ok){
|
|
14208
|
+
rcGhostGaveUp(ids,RC_GHOST_FATAL.has(d&&d.code),
|
|
14209
|
+
(d&&d.error)||'The removed objects could not be drawn where they used to be — the list below still stands.');
|
|
14210
|
+
return;
|
|
14211
|
+
}
|
|
14212
|
+
const v=window.Steel3DView;
|
|
14213
|
+
// THE REFERENCE ITSELF MUST STILL BE THERE. A ghost read is a whole IFC parse; remove the
|
|
14214
|
+
// reference while one is in flight and `refById` returns null — and `xrefMatrix(null)` is the
|
|
14215
|
+
// IDENTITY matrix, so the ghosts would land at the world origin, in red, over the user's steel,
|
|
14216
|
+
// asserting that the deleted objects were somewhere nobody computed. (An ABSENT `placement` is a
|
|
14217
|
+
// different thing and is perfectly ordinary — identity is correct for a reference at its file
|
|
14218
|
+
// coordinates — so this guards the reference, not its placement.)
|
|
14219
|
+
const r=refById(refId);
|
|
14220
|
+
const asked=ids.length;
|
|
14221
|
+
let drew=0;
|
|
14222
|
+
if(!r){rcGhostGaveUp(ids,true,'That reference was removed, so there is nowhere to draw what it used to contain.');return;}
|
|
14223
|
+
if(v&&v.setReferenceGhosts&&Array.isArray(d.objects)&&d.objects.length){
|
|
14224
|
+
const out=v.setReferenceGhosts(refId,d.objects,r.placement||null)||{};
|
|
14225
|
+
drew=out.drawn||0;
|
|
14226
|
+
// …and fly to the one a click asked for, now that it exists. Held rather than guessed at with a
|
|
14227
|
+
// timer: the read is a whole IFC parse, and a fixed delay is a race that fails on the big files
|
|
14228
|
+
// this feature is for.
|
|
14229
|
+
if(rcGhostFrameWanted&&v.frameReferenceGhost&&v.frameReferenceGhost(rcGhostFrameWanted))rcGhostFrameWanted=null;
|
|
14230
|
+
}
|
|
14231
|
+
// WHAT WAS ASKED FOR AND WHAT ARRIVED, RECONCILED. Four different things can thin a batch — the
|
|
14232
|
+
// previous file could not resolve the id (`missing`), AWARE read it and had nothing drawable
|
|
14233
|
+
// (`dropped`, which the route sends under a comment saying exactly why it must not be swallowed),
|
|
14234
|
+
// the mesh carried no positions, or it carried no GlobalId and so could never be framed. All four
|
|
14235
|
+
// used to render as "fewer red shapes", which is indistinguishable from a smaller deletion.
|
|
14236
|
+
if(drew<asked){
|
|
14237
|
+
console.warn('[reference] drew',drew,'of',asked,'ghosts —',
|
|
14238
|
+
(Array.isArray(d.missing)?d.missing.length:0),'not in the previous file,',(d.dropped||0),'with nothing to draw');
|
|
14239
|
+
}
|
|
14240
|
+
// A CLICKED ROW THAT RESOLVED NOTHING STILL OWES AN ANSWER. Every other dead end in `rcActivate`
|
|
14241
|
+
// says something; this one used to leave the user looking at a camera that had not moved.
|
|
14242
|
+
if(rcGhostFrameWanted&&ids.indexOf(rcGhostFrameWanted)>=0){
|
|
14243
|
+
rcGhostFrameWanted=null;
|
|
14244
|
+
toast('The earlier version has no shape on file for that object, so there is nothing to show where it was.');
|
|
14245
|
+
}
|
|
14246
|
+
if(rcGhostQueue.length)rcGhostSchedule();
|
|
14247
|
+
}).finally(()=>{rcGhostFlights.delete(flight);}).catch(e=>{
|
|
14248
|
+
// An abort is this panel closing or moving on, not a failure to report.
|
|
14249
|
+
if(mine!==rcGhostRun||(e&&e.name==='AbortError'))return;
|
|
14250
|
+
// A THROWN FETCH IS THE LIKELIEST FAILURE OF ALL — the server restarted, the connection dropped —
|
|
14251
|
+
// and it used to be the one path that said nothing at all: no toast, no latch, just a console
|
|
14252
|
+
// line and a canvas with no red on it. It is also where a TypeError from the draw path lands, so
|
|
14253
|
+
// a bug in `setReferenceGhosts` was being reported to the user as "no objects were removed".
|
|
14254
|
+
console.error('[reference] ghost read failed',e);
|
|
14255
|
+
rcGhostGaveUp(ids,false,'Could not read the removed objects from the earlier version — the list below still stands.');
|
|
14256
|
+
});
|
|
14257
|
+
}
|
|
14258
|
+
function rcGhostSchedule(){if(!rcGhostTimer)rcGhostTimer=setTimeout(rcGhostFlush,120);}
|
|
14259
|
+
|
|
14260
|
+
/** Everything the ghost layer holds, dropped: the meshes, what was asked for, and what failed. */
|
|
14261
|
+
function rcGhostReset(){
|
|
14262
|
+
// THE TOKEN MOVES FIRST, before anything it protects is torn down: a response that lands during
|
|
14263
|
+
// this function must already be reading the new value.
|
|
14264
|
+
rcGhostRun++;
|
|
14265
|
+
for(const f of rcGhostFlights){try{f.abort();}catch(_){/* already settled */}}
|
|
14266
|
+
rcGhostFlights.clear();
|
|
14267
|
+
if(rcGhostTimer){clearTimeout(rcGhostTimer);rcGhostTimer=null;}
|
|
14268
|
+
if(rcGhostObserver){rcGhostObserver.disconnect();rcGhostObserver=null;}
|
|
14269
|
+
rcGhostAsked=new Set();rcGhostQueue=[];rcGhostFailed=false;rcGhostToldOnce=false;rcGhostFrameWanted=null;
|
|
14270
|
+
const v=window.Steel3DView;if(v&&v.clearReferenceGhosts)v.clearReferenceGhosts();
|
|
14271
|
+
}
|
|
14272
|
+
|
|
14273
|
+
/** Queue one removed row's ghost. Idempotent per id, which is what makes a scroll cheap. */
|
|
14274
|
+
function rcGhostWant(gid){
|
|
14275
|
+
if(!gid||rcGhostAsked.has(gid)||rcGhostFailed)return;
|
|
14276
|
+
if(!rcPreviousVersionId())return; // a first version has nothing before it to read from
|
|
14277
|
+
rcGhostAsked.add(gid);rcGhostQueue.push(gid);rcGhostSchedule();
|
|
14278
|
+
}
|
|
14279
|
+
|
|
14280
|
+
/**
|
|
14281
|
+
* WHAT "BROUGHT INTO VIEW" ACTUALLY MEANS, measured by the browser rather than guessed at.
|
|
14282
|
+
*
|
|
14283
|
+
* An IntersectionObserver against the panel's own scroll container, re-armed on every repaint because
|
|
14284
|
+
* `rcPaintList` rebuilds every row. Rows that are already on screen when the list first draws fire
|
|
14285
|
+
* immediately, which is right: they are in view.
|
|
14286
|
+
*/
|
|
14287
|
+
function rcObserveGhosts(host){
|
|
14288
|
+
if(rcGhostObserver){rcGhostObserver.disconnect();rcGhostObserver=null;}
|
|
14289
|
+
if(!rcPreviousVersionId()||typeof IntersectionObserver!=='function')return;
|
|
14290
|
+
const rows=host.querySelectorAll('.rcrow[data-status="removed"]');
|
|
14291
|
+
if(!rows.length)return;
|
|
14292
|
+
rcGhostObserver=new IntersectionObserver((entries)=>{
|
|
14293
|
+
for(const e of entries)if(e.isIntersecting){rcGhostWant(e.target.dataset.gid);rcGhostObserver.unobserve(e.target);}
|
|
14294
|
+
},{root:rv$('rvBody'),rootMargin:'120px'});
|
|
14295
|
+
for(const row of rows)rcGhostObserver.observe(row);
|
|
14296
|
+
}
|
|
14297
|
+
|
|
14298
|
+
/** A click on a removed row: there is nothing to select, so fetch its ghost and fly to it. */
|
|
14299
|
+
function rcGhostFor(ch){
|
|
14300
|
+
const v=window.Steel3DView;
|
|
14301
|
+
if(!rcPreviousVersionId()){
|
|
14302
|
+
toast('“'+(refObjNamed(ch.name)?String(ch.name).trim():'That object')+'” was removed — this reference has no earlier version on file to draw it from.');
|
|
14303
|
+
return;
|
|
14304
|
+
}
|
|
14305
|
+
if(v&&v.frameReferenceGhost&&v.frameReferenceGhost(ch.id))return;
|
|
14306
|
+
if(rcGhostFailed){
|
|
14307
|
+
toast('“'+(refObjNamed(ch.name)?String(ch.name).trim():'That object')+'” was removed, but its shape could not be read from the earlier version.');
|
|
14308
|
+
return;
|
|
14309
|
+
}
|
|
14310
|
+
// Not drawn yet. Ask for it AT THE FRONT of the queue and jump the batch timer — this one is a
|
|
14311
|
+
// direct request rather than a row drifting past, and it is framed when it lands (never on a timer).
|
|
14312
|
+
rcGhostFrameWanted=ch.id;
|
|
14313
|
+
if(!rcGhostAsked.has(ch.id)){rcGhostAsked.add(ch.id);rcGhostQueue.unshift(ch.id);}
|
|
14314
|
+
if(rcGhostTimer){clearTimeout(rcGhostTimer);rcGhostTimer=null;}
|
|
14315
|
+
rcGhostFlush();
|
|
14316
|
+
}
|
|
14317
|
+
|
|
14318
|
+
/**
|
|
14319
|
+
* WHAT COULD NOT BE COMPARED, named rather than only counted.
|
|
14320
|
+
*
|
|
14321
|
+
* An object whose GlobalId is blank, or repeated inside its own file, cannot be matched to anything: a
|
|
14322
|
+
* file where every id is `''` makes "the id matches" trivially true. Saying WHICH ones is what stops a
|
|
14323
|
+
* clean-looking list being read as a complete one.
|
|
14324
|
+
*/
|
|
14325
|
+
function rcPaintUncomparable(){
|
|
14326
|
+
const host=rv$('rcUncomparable');host.replaceChildren();
|
|
14327
|
+
const id=rcData&&rcData.identity;
|
|
14328
|
+
const total=rcData&&rcData.summary?rcData.summary.uncomparable:0;
|
|
14329
|
+
if(!total||!id){host.style.display='none';return;}
|
|
14330
|
+
host.style.display='';
|
|
14331
|
+
host.appendChild(Object.assign(document.createElement('h4'),{textContent:'What could not be compared'}));
|
|
14332
|
+
host.appendChild(Object.assign(document.createElement('div'),{className:'rcuwhy',
|
|
14333
|
+
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”.'}));
|
|
14334
|
+
const rowOf=(label,value)=>{
|
|
14335
|
+
const d=document.createElement('div');d.className='rcurow';
|
|
14336
|
+
d.append(Object.assign(document.createElement('span'),{textContent:label}),
|
|
14337
|
+
Object.assign(document.createElement('span'),{className:'rcuv',textContent:Number(value||0).toLocaleString()}));
|
|
14338
|
+
host.appendChild(d);
|
|
14339
|
+
};
|
|
14340
|
+
for(const [label,sideKey] of [['In the version you had','base'],['In the new version','revised']]){
|
|
14341
|
+
const s=id[sideKey];if(!s||!s.uncomparable)continue;
|
|
14342
|
+
rowOf(label,s.uncomparable.count);
|
|
14343
|
+
if(s.uncomparable.blank)rowOf(' · no id at all',s.uncomparable.blank);
|
|
14344
|
+
if(s.uncomparable.duplicated)rowOf(' · an id used more than once',s.uncomparable.duplicated);
|
|
14345
|
+
}
|
|
14346
|
+
}
|
|
14347
|
+
|
|
14348
|
+
/** The receipt: WHICH questions were asked. Quiet, because it qualifies the list rather than being it. */
|
|
14349
|
+
function rcPaintFoot(){
|
|
14350
|
+
const note=rv$('rvFootNote');
|
|
14351
|
+
const c=rcData&&rcData.criteria;
|
|
14352
|
+
// THE `Version history` BUTTON IS NOT BUILT HERE. It was, lazily, and creating it re-entered
|
|
14353
|
+
// `rvStage(rvStageNow)` — which at this moment is still `'prog'`, because `rcShow` paints the whole
|
|
14354
|
+
// panel BEFORE it switches the stage. `rvStage` clears `#rvFootNote` on every non-result stage, so
|
|
14355
|
+
// the sentence written one line above was wiped microseconds later, and `rvStage('result')` does not
|
|
14356
|
+
// put it back. The result: the FIRST comparison of a page session silently lost its "Compared by:"
|
|
14357
|
+
// receipt and every later one kept it, because by then the button existed. A button is not per-paint
|
|
14358
|
+
// state; it is built once at wire-up. (Silent-failure review.)
|
|
14359
|
+
note.textContent=c&&c.length?'Compared by: '+c.join(', ')+'.':'';
|
|
14360
|
+
}
|
|
14361
|
+
|
|
14362
|
+
rv$('rvClose').onclick=rvClose;
|
|
14363
|
+
rv$('rvCancel').onclick=rvClose;
|
|
14364
|
+
rv$('rvDone').onclick=rvClose;
|
|
14365
|
+
// A WAY BACK TO THE HISTORY, so the change panel is not a dead end — and, on the upload path, the
|
|
14366
|
+
// first place the newly-appended version is visible as history at all. Quiet: `Done` is the action.
|
|
14367
|
+
// BUILT HERE, ONCE, rather than lazily inside `rcPaintFoot` — see that function's note for what the
|
|
14368
|
+
// lazy version cost. `rvStage` owns its visibility, alongside Cancel and Done.
|
|
14369
|
+
{
|
|
14370
|
+
const hist=document.createElement('button');hist.type='button';hist.className='ghost rvhist';
|
|
14371
|
+
hist.textContent='Version history';
|
|
14372
|
+
hist.style.display='none';
|
|
14373
|
+
hist.addEventListener('click',()=>{
|
|
14374
|
+
const live=rvRef&&refById(rvRef.id);
|
|
14375
|
+
if(!live){toast('That reference is no longer in this project.');return;}
|
|
14376
|
+
rvhRef=live;rvhNote('');rvhPaint();rvStage('history');rv$('rvBody').scrollTop=0;
|
|
14377
|
+
});
|
|
14378
|
+
rv$('rvFoot').insertBefore(hist,rv$('rvDone'));
|
|
14379
|
+
}
|
|
14380
|
+
// THE BACKDROP IS NOT AN EXIT MID-RUN — the same rule the import modal states: hiding one of two
|
|
14381
|
+
// identical exits and leaving the invisible one is the version of that rule that does not hold.
|
|
14382
|
+
rv$('rvBackdrop').onclick=()=>{if(!(rvBusy&&rvStageNow==='prog'))rvClose();};
|
|
14383
|
+
rv$('rvDrop').onclick=()=>rv$('rvFile').click();
|
|
14384
|
+
rv$('rvDrop').onkeydown=e=>{if(e.key==='Enter'||e.key===' '){e.preventDefault();rv$('rvFile').click();}};
|
|
14385
|
+
rv$('rvFile').onchange=e=>{const f=e.target.files&&e.target.files[0];e.target.value='';rvReadFile(f);};
|
|
14386
|
+
for(const ev of ['dragenter','dragover'])rv$('rvDrop').addEventListener(ev,e=>{e.preventDefault();rv$('rvDrop').classList.add('drag');});
|
|
14387
|
+
for(const ev of ['dragleave','drop'])rv$('rvDrop').addEventListener(ev,e=>{e.preventDefault();rv$('rvDrop').classList.remove('drag');});
|
|
14388
|
+
rv$('rvDrop').addEventListener('drop',e=>{const f=e.dataTransfer&&e.dataTransfer.files&&e.dataTransfer.files[0];rvReadFile(f);});
|
|
14389
|
+
}
|
|
14390
|
+
|
|
12238
14391
|
// ── Apply a favourite in-editor: arm the placement crosshair (sticky → repeat), then click a target ──────────
|
|
12239
14392
|
function armFavouriteInsert(f){if(!f)return;
|
|
12240
14393
|
if(!view3d){toast('Switch to the 3D view to place a connection');return;}
|
|
@@ -12736,33 +14889,291 @@ function wire3DBar(){if(bar3dWired||!window.Steel3DView)return;bar3dWired=true;
|
|
|
12736
14889
|
d3.setWorkPlanePrincipal(b.dataset.wpp,offIn*25.4);});
|
|
12737
14890
|
{const show=document.getElementById('m3dWpShow');show.checked=d3.workPlaneInfo().visible;show.onchange=e=>{d3.toggleWorkPlaneVisible(e.target.checked);};}
|
|
12738
14891
|
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
|
|
12739
|
-
function applyViewState(on){ // flip the toggle
|
|
12740
|
-
|
|
14892
|
+
function applyViewState(on){ // TRANSITION: flip the toggle, swap the panes, end the operation
|
|
14893
|
+
viewMode=SplitView.sanitizeMode(on===true?'3d':on===false?'2d':on);
|
|
14894
|
+
activePane=SplitView.resolveActivePane(viewMode,activePane);
|
|
14895
|
+
// Ending the current operation belongs HERE and not in reflectViewChrome: a mode change really does end
|
|
14896
|
+
// what you were doing, while a click across the divider does not.
|
|
12741
14897
|
snapOnly=null;const V=window.Steel3DView;if(V&&V.setSnapOnly)V.setSnapOnly(null);closeSnapMenu();updSnapStat(); // switching views ends the operation → any snap override reverts
|
|
12742
|
-
const
|
|
12743
|
-
|
|
12744
|
-
|
|
12745
|
-
document.
|
|
12746
|
-
|
|
12747
|
-
|
|
14898
|
+
const segs={'2d':document.getElementById('vt2d'),'3d':document.getElementById('vt3d'),split:document.getElementById('vtSplit')};
|
|
14899
|
+
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));}
|
|
14900
|
+
const panes=SplitView.panesShown(viewMode);
|
|
14901
|
+
document.body.classList.toggle('split-view',viewMode==='split');
|
|
14902
|
+
// BOTH HALVES MATTER. The pane wrapper drives layout — it is what a split resizes — while #stage3d's
|
|
14903
|
+
// own `display` is still the engine's authority: seven sites in steel-3d-view.js read
|
|
14904
|
+
// canvasEl.style.display to decide whether to paint labels, and show()/hide() set it.
|
|
14905
|
+
document.getElementById('pane2d').style.display=panes.two?'flex':'none';
|
|
14906
|
+
document.getElementById('pane3d').style.display=panes.three?'block':'none';
|
|
14907
|
+
document.getElementById('stage').style.display=panes.two?'':'none';
|
|
14908
|
+
document.getElementById('stage3d').style.display=panes.three?'block':'none';
|
|
14909
|
+
// closePlans() before the combo is hidden — a popover left open across the switch is hidden with its
|
|
14910
|
+
// wrapper, but would strand `aria-expanded=true` and the .open caret behind it.
|
|
14911
|
+
if(!panes.two)closePlans(false);
|
|
14912
|
+
reflectViewChrome(); // everything idempotent, shared with setActivePane
|
|
14913
|
+
// Clamp the ratio against THIS stage on the way in. Entering split is the moment a ratio saved at some
|
|
14914
|
+
// other width first has to hold, and nothing else on this path was checking it. (Code review.)
|
|
14915
|
+
//
|
|
14916
|
+
// AFTER reflectViewChrome(), not before: that is what sets body.pane3d-shown, and `#bottomDock` is 92px
|
|
14917
|
+
// narrower under it (right:104px vs 12px — the world-axis-triad clearance). applySplitRatio measures the
|
|
14918
|
+
// dock to decide whether the per-pane layout fits, so running first measured a dock 92px wider than the
|
|
14919
|
+
// one about to be painted and let `.dock-per-pane` on in a band where it does not fit — on the 2d→split
|
|
14920
|
+
// click and the boot restore, the two main entry paths. Nothing re-measures afterwards (the
|
|
14921
|
+
// ResizeObserver watches #stagewrap, whose size does not change when the dock's inset does), so it
|
|
14922
|
+
// persisted until the next resize or drag. reflectViewChrome neither reads nor writes splitRatio, and
|
|
14923
|
+
// both still run before paint. (Code review.)
|
|
14924
|
+
// …and on the way OUT, drop the per-pane class here, because applySplitRatio — which owns that cleanup
|
|
14925
|
+
// for every other caller — is not reached on this path at all. Leaving it behind is inert today (all
|
|
14926
|
+
// three rules that read it are body.split-view-scoped), but a class that outlives the condition it names
|
|
14927
|
+
// is a trap for the next unscoped rule, and single 2D/3D would otherwise carry it for a whole session.
|
|
14928
|
+
// (Browser pass: single 2D still had .dock-per-pane after a split→2D toggle.)
|
|
14929
|
+
if(viewMode==='split')applySplitRatio(splitRatio,false,true); // settled: a view switch is one-shot
|
|
14930
|
+
else document.getElementById('bottomDock')?.classList.remove('dock-per-pane');
|
|
14931
|
+
reflectSplitAvailability(); // PURE reflection — it must never call setView.
|
|
14932
|
+
}
|
|
14933
|
+
// The IDEMPOTENT half of a view change: derive view3d/view3dShown and reflect the chrome. Split out of
|
|
14934
|
+
// applyViewState because that function is a TRANSITION (it clears the snap override, closes the snap menu
|
|
14935
|
+
// and the plan popover, and re-runs the pane show/hide), and a click across the split divider is not a
|
|
14936
|
+
// view switch — running the transition on every cross-pane pointerdown would shut a menu the user had
|
|
14937
|
+
// just opened and drop a snap override mid-operation.
|
|
14938
|
+
function reflectViewChrome(){
|
|
14939
|
+
view3d=activePane==='3d';
|
|
14940
|
+
const panes=SplitView.panesShown(viewMode),chrome=SplitView.chromeVisibility({mode:viewMode,activePane});
|
|
14941
|
+
view3dShown=panes.three;view2dShown=panes.two;
|
|
14942
|
+
document.body.classList.toggle('pane3d-shown',view3dShown);
|
|
14943
|
+
document.getElementById('zoombar').style.display=chrome.zoombar?'':'none'; // zoom slider addresses the plan canvas
|
|
12748
14944
|
// Plan switcher is 2D-only (3D shows the whole model). Hidden by `display`, not the `hidden` attribute:
|
|
12749
14945
|
// .plan-combo carries an author `display:inline-flex`, which beats the UA's [hidden] rule by ORIGIN, so
|
|
12750
|
-
// `hidden = true` would quietly do nothing here.
|
|
12751
|
-
|
|
12752
|
-
|
|
12753
|
-
document.getElementById('
|
|
12754
|
-
document.getElementById('
|
|
12755
|
-
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
document.getElementById('
|
|
12760
|
-
|
|
14946
|
+
// `hidden = true` would quietly do nothing here.
|
|
14947
|
+
document.getElementById('planCombo').style.display=chrome.planCombo?'':'none';
|
|
14948
|
+
document.getElementById('m3dBar').style.display=chrome.m3dChrome?'flex':'none';
|
|
14949
|
+
document.getElementById('m3dCube').style.display=chrome.m3dChrome?'block':'none';
|
|
14950
|
+
document.getElementById('m3dAxes').style.display=chrome.m3dChrome?'block':'none';
|
|
14951
|
+
// The paired Dimension controls: the ACTIVE pane's is shown, the other HIDDEN rather than disabled —
|
|
14952
|
+
// two Dimension buttons side by side with one inert is exactly the dead control the standing UX rule
|
|
14953
|
+
// exists to prevent. They are adjacent siblings carrying the same label, so the visible one lands in the
|
|
14954
|
+
// same header slot and the swap reads as "Dimension now targets this pane".
|
|
14955
|
+
const dimB=document.getElementById('dimB'),dim3d=document.getElementById('dim3dWrap');
|
|
14956
|
+
// Rescue focus BEFORE hiding: display:none on the focused element silently drops focus to <body>, which
|
|
14957
|
+
// strands a keyboard user mid-header with no visible focus ring. (UX review.)
|
|
14958
|
+
const ae=document.activeElement;
|
|
14959
|
+
if(ae&&!chrome.dim2d&&dimB&&dimB.contains(ae)&&chrome.dim3d&&dim3d){const t=dim3d.querySelector('button');if(t)t.focus();}
|
|
14960
|
+
else if(ae&&!chrome.dim3d&&dim3d&&dim3d.contains(ae)&&chrome.dim2d&&dimB)dimB.focus();
|
|
14961
|
+
dimB.style.display=chrome.dim2d?'':'none'; // 2D Dimension button — the ACTIVE pane's
|
|
14962
|
+
dim3d.style.display=chrome.dim3d?'inline-flex':'none'; // 3D Dimension cluster (moved to header) — likewise
|
|
14963
|
+
document.body.classList.toggle('v3d',chrome.v3d); // 3D-only chrome (e.g. ⋯ → Detailing → Insert detail) keys off this
|
|
14964
|
+
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
|
|
14965
|
+
if(window.Steel3DView&&window.Steel3DView.setInputActive)window.Steel3DView.setInputActive(view3d); // key ownership follows the ACTIVE pane
|
|
12761
14966
|
reflectLegendPanel(); // entering/leaving 3D honours the persisted collapsed state and keeps its launcher in sync
|
|
14967
|
+
reflectActivePane();
|
|
14968
|
+
}
|
|
14969
|
+
// A pointerdown in a pane makes it active AND still performs its action — a click that only focuses is a
|
|
14970
|
+
// click the user has to repeat. In a single mode this is a no-op: resolveActivePane forces the pane.
|
|
14971
|
+
function setActivePane(which){
|
|
14972
|
+
const next=SplitView.resolveActivePane(viewMode,which);
|
|
14973
|
+
if(next===activePane)return;
|
|
14974
|
+
onActivePaneChange(); // B6: disarm the 2D-only takeover tools BEFORE the pane changes under them
|
|
14975
|
+
activePane=next;
|
|
14976
|
+
reflectViewChrome(); // the idempotent half only — no snap reset, no menu closing
|
|
14977
|
+
// …then RE-MEASURE the dock fit, because #ptrBars is not the same width in the two active panes: the
|
|
14978
|
+
// Reference button is hidden while the plan is active, so the bar measures 432.6px there and 440.6px with
|
|
14979
|
+
// the 3D pane active (1440×900, demo model). `room` is dock − offset − THAT width, so an 8px step lands
|
|
14980
|
+
// straight in the gate's own band: a layout settled at room 81.9 with the plan active becomes room 73.9 on
|
|
14981
|
+
// the switch, and at a slightly narrower divider it drops under DOCK_MIN_LEFT_PX entirely — the dock left
|
|
14982
|
+
// enabled below the width it requires, which is what the gate exists to prevent. Nothing else re-ran it:
|
|
14983
|
+
// the ResizeObserver watches #stagewrap, whose size a pane switch does not change. AFTER
|
|
14984
|
+
// reflectViewChrome(), which is what sets body.v3d and therefore the bar's content — the same ordering
|
|
14985
|
+
// trap as the pane3d-shown one in applyViewState. Settled, because a pane switch is one-shot, not a
|
|
14986
|
+
// stream. (Codex review, J5.)
|
|
14987
|
+
if(viewMode==='split')applySplitRatio(splitRatio,false,true);
|
|
14988
|
+
panel(); // the inspector's hints are view-scoped (Add-member, Move/Copy)
|
|
14989
|
+
}
|
|
14990
|
+
function reflectActivePane(){
|
|
14991
|
+
const split=viewMode==='split';
|
|
14992
|
+
for(const [id,mine] of [['pane2d','2d'],['pane3d','3d']]){
|
|
14993
|
+
const el=document.getElementById(id);if(!el)continue;
|
|
14994
|
+
const on=split&&activePane===mine;
|
|
14995
|
+
el.classList.toggle('pane-active',on);
|
|
14996
|
+
// The 2px brand ring is the only cue a sighted user gets; aria-current is its counterpart for
|
|
14997
|
+
// assistive tech, which otherwise had no way to perceive which pane owns the tools. (Code review.)
|
|
14998
|
+
if(on)el.setAttribute('aria-current','true');else el.removeAttribute('aria-current');
|
|
14999
|
+
}
|
|
15000
|
+
}
|
|
15001
|
+
// B6, re-scoped for the split exactly as the backlog anticipated: "in a split where 2D+3D coexist there's
|
|
15002
|
+
// no switch to interrupt" — so what needs interrupting is a change of ACTIVE PANE, the same event under a
|
|
15003
|
+
// new name. The tools below take over #panel and draw pick hotspots into the 2D SVG; left armed while the
|
|
15004
|
+
// other pane holds the tools they silently resume later.
|
|
15005
|
+
//
|
|
15006
|
+
// Deliberately NOT shared with setView's own disarm block, though the plan proposed it. That block is
|
|
15007
|
+
// ASYMMETRIC — it gates the dim/dim-style/qdPick disarm on entering 3D, clears sel3dDimIds, and renders
|
|
15008
|
+
// BEFORE the Move/Copy cleanup — and collapsing the two would change 2D↔3D behaviour that the phase-2
|
|
15009
|
+
// characterization baseline does not cover. Two call sites with genuinely different orderings are worth
|
|
15010
|
+
// more than one shared function that is wrong for one of them.
|
|
15011
|
+
//
|
|
15012
|
+
// Deliberately NOT disarmed here, all cross-pane by design: Move/Copy (cmTool), Add-member (mode==='add')
|
|
15013
|
+
// and Extend/Trim/Split (geoMode — the 3D view arms it via E/S and drives it through
|
|
15014
|
+
// view3dApi.onTrimExtend/onSplit, so cancelling it would kill an active 3D trim).
|
|
15015
|
+
function onActivePaneChange(){
|
|
15016
|
+
drawDraft=null;drawPrevClear();
|
|
15017
|
+
let disarmed2d=gridMode||csaxisMode||picking;
|
|
15018
|
+
if(gridMode)setGridMode(false);
|
|
15019
|
+
if(csaxisMode){csaxisMode=false;setCsMode();}
|
|
15020
|
+
if(picking){picking=false;pickKind='profile';pickEnd=null;}
|
|
15021
|
+
if(activePane==='2d'){ // about to LEAVE 2D: these share keys with the 3D dim tool
|
|
15022
|
+
if(dimMode||dimChain||dimSplitMode){disarmed2d=true;dimMode=dimChain=dimSplitMode=false;selDimIds.clear();setDimMode();document.body.classList.remove('dimsplit');}
|
|
15023
|
+
if(dimStyleMode){disarmed2d=true;dimStyleMode=false;}
|
|
15024
|
+
if(qdPick){disarmed2d=true;qdPick=null;setQdPickCls();}
|
|
15025
|
+
}
|
|
15026
|
+
// DEFERRED past the current dispatch, unlike setView's otherwise-identical block. This runs from a
|
|
15027
|
+
// CAPTURE-phase pointerdown, so an inline render() would replace #svg's innerHTML while that very
|
|
15028
|
+
// pointerdown is still propagating: the clicked <line> is detached before #svg's own bubble-phase
|
|
15029
|
+
// handler reads e.target, every hit-test misses, and the click is swallowed. Deferring keeps the
|
|
15030
|
+
// repaint and lets the click through — setActivePane promises a click that also performs its action.
|
|
15031
|
+
// (Code review.)
|
|
15032
|
+
// setTimeout, NOT queueMicrotask: a microtask checkpoint runs between listeners of the SAME dispatch
|
|
15033
|
+
// (the JS stack empties after each one), so a microtask would still repaint before #svg's bubble handler.
|
|
15034
|
+
if(disarmed2d)setTimeout(()=>render(),0);
|
|
15035
|
+
if(cmTool){cmDraft=null;cmPrevClear();cmHudClose();}
|
|
15036
|
+
return disarmed2d;
|
|
15037
|
+
}
|
|
15038
|
+
// Reflect ONLY. Enabling/disabling the segment and showing the reason are idempotent, so this is safe to
|
|
15039
|
+
// call from applyViewState. Changing the mode from here is NOT, and two ways that bit:
|
|
15040
|
+
// · Leaving split deliberately: setView('2d') applies 2D, this ran, saw requestedMode still 'split'
|
|
15041
|
+
// (it is only updated at the END of setView) and immediately re-entered setView('split'). The outer
|
|
15042
|
+
// call then hid the renderer the nested one had just shown.
|
|
15043
|
+
// · A failed 3D open: the catch calls applyViewState('2d'), this retried the saved split against the
|
|
15044
|
+
// renderer that had just failed — synchronous recursion when there is no renderer at all.
|
|
15045
|
+
// So mode changes live in onStageResize below, which fires on a real EDGE and never from a transition.
|
|
15046
|
+
// Clamp the divider ratio against the CURRENT stage and write it to the DOM. Deliberately top-level and
|
|
15047
|
+
// not closed over inside the divider IIFE: while it lived there, the only things that could clamp were
|
|
15048
|
+
// drag / arrows / dblclick / window-resize, and the two paths that ENTER split — the boot restore and
|
|
15049
|
+
// applyViewState — wrote a raw ratio straight past MIN_PANE_PX. A 0.85 saved on a wide window then
|
|
15050
|
+
// reopened on a ~600px stage gave the 3D pane 89px, and #m3dLegend (min-width:210px at left:12px) hung
|
|
15051
|
+
// out through the pane edge — precisely the defect MIN_PANE_PX exists to prevent. It also owns
|
|
15052
|
+
// aria-valuenow, which was otherwise stale at 50 until the first drag. (Code review.)
|
|
15053
|
+
// `settled` = this is a ONE-SHOT layout, not a sample from a pointer/resize stream. It only affects the
|
|
15054
|
+
// fit gate's turn-on threshold — see the Schmitt-trigger note below.
|
|
15055
|
+
function applySplitRatio(r,save,settled){
|
|
15056
|
+
const wrap=document.getElementById('stagewrap');if(!wrap||!SplitView)return;
|
|
15057
|
+
const wrapW=wrap.getBoundingClientRect().width;
|
|
15058
|
+
// EVERY LAYOUT READ HAPPENS HERE, before the first style write, and that ordering is the whole point of
|
|
15059
|
+
// D1 rather than an incidental tidy. All four are ratio-INDEPENDENT — the stage's width, the dock's box,
|
|
15060
|
+
// where the dock starts, and how wide Select/Snap is — so reading them up front costs one layout that the
|
|
15061
|
+
// browser has already done, while a read placed AFTER a write costs a forced synchronous one. The earlier
|
|
15062
|
+
// shape read #ptrBars after writing --dock-pane3d-left, and a custom property invalidates the whole
|
|
15063
|
+
// inherited subtree (in the docked v3d case it also changes padding-left), so that read WAS forced — one
|
|
15064
|
+
// per pointer sample, which is the very quantity D1 was raised about. (Second review, finding 2.)
|
|
15065
|
+
const dock=document.getElementById('bottomDock');
|
|
15066
|
+
const ptr=document.getElementById('ptrBars');
|
|
15067
|
+
const dockW=dock?dock.getBoundingClientRect().width:0;
|
|
15068
|
+
const dockLeft=dock?dock.offsetLeft:0;
|
|
15069
|
+
const ptrW=ptr?ptr.getBoundingClientRect().width:0;
|
|
15070
|
+
const res=SplitView.clampRatio(r,wrapW);
|
|
15071
|
+
splitRatio=res.ratio;
|
|
15072
|
+
wrap.style.setProperty('--split-ratio',String(splitRatio));
|
|
15073
|
+
const bar=document.getElementById('splitBar');
|
|
15074
|
+
if(bar)bar.setAttribute('aria-valuenow',String(Math.round(splitRatio*100)));
|
|
15075
|
+
// Where the 3D pane starts, expressed as an offset INSIDE #bottomDock, so the dock's left group can sit
|
|
15076
|
+
// on the pane it belongs to instead of in the stage's corner (see the body.split-view dock rules). It is
|
|
15077
|
+
// an offset from the DOCK, not from the stage, because a percentage inside #bottomDock would resolve
|
|
15078
|
+
// against the dock's own width — inset 12px left and 104px right — so plain CSS cannot express it.
|
|
15079
|
+
if(dock&&viewMode==='split'){
|
|
15080
|
+
// DERIVED, not measured. Reading pane3d.offsetLeft here would be a layout read after the --split-ratio
|
|
15081
|
+
// write above, forcing a synchronous layout inside every pointer sample of a drag (measured: +78 layouts,
|
|
15082
|
+
// +80 style recalcs over an 80-step drag). SplitView.paneThreeLeftPx runs the same arithmetic the CSS
|
|
15083
|
+
// does, beside the clampRatio that shares its `usable`, so the two cannot drift. Everything else this
|
|
15084
|
+
// needs was measured above the write. (Codex review, D1; second review, finding 2.)
|
|
15085
|
+
const off=SplitView.paneThreeLeftPx(wrapW,splitRatio)-dockLeft;
|
|
15086
|
+
wrap.style.setProperty('--dock-pane3d-left',off+'px');
|
|
15087
|
+
// …but only let the 3D-active rule USE it while the group still fits on that pane. #ptrBars is flex:none,
|
|
15088
|
+
// so #bottomDockLeft collapses to 0 first and then Select/Snap simply overflows: at the 3D pane's 280px
|
|
15089
|
+
// minimum this pushed it 205px off the right of the stage. Below the threshold we fall back to the
|
|
15090
|
+
// stage-wide dock — the pre-split behaviour — which is honest degradation rather than a broken layout.
|
|
15091
|
+
// Measured from the live #ptrBars because its width follows its own content, not a constant we could pin.
|
|
15092
|
+
// DOCK_GUTTER_PX comes off the budget too: the group is inset by it (see the rules), so counting the full
|
|
15093
|
+
// offset would let the gate promise 12px it has already spent.
|
|
15094
|
+
const room=dockW-off-DOCK_GUTTER_PX-ptrW;
|
|
15095
|
+
// SCHMITT TRIGGER, not a bare comparison. The switch moves the launcher ~730px, and a bare threshold sits
|
|
15096
|
+
// exactly on the drag path: one pixel of hand jitter at the boundary flipped it on every consecutive
|
|
15097
|
+
// pointer sample, teleporting the bottom chrome back and forth. So it takes DOCK_MIN_LEFT_PX + slack to
|
|
15098
|
+
// turn ON and a fall below DOCK_MIN_LEFT_PX to turn OFF — the boundary you must cross to undo a switch is
|
|
15099
|
+
// never the one that caused it, which is what kills the oscillation. (Codex review, D2.)
|
|
15100
|
+
//
|
|
15101
|
+
// …but ONLY on a STREAM. `settled` says this call is a one-shot — the boot clamp, a view switch, the
|
|
15102
|
+
// pointerup that ends a drag, a dblclick, an arrow-key nudge — where there is no hand on the divider and
|
|
15103
|
+
// therefore nothing to oscillate. Charging the turn-on slack there does not prevent a flicker, it just
|
|
15104
|
+
// withholds an arrangement that fits: measured at 1600×900 with the Inspector panel open, a 50/50 split
|
|
15105
|
+
// leaves 78.9px of room — past DOCK_MIN_LEFT_PX, short of the slack — so the chrome sat in the old corner
|
|
15106
|
+
// on every boot at that size, which is the very bug this change exists to fix. The streams (drag samples,
|
|
15107
|
+
// the ResizeObserver, window resize) keep the full trigger. Note the asymmetry is one-way and safe: a
|
|
15108
|
+
// settled call can only ever turn the layout ON in that band, and once on, the stream's own stay-on
|
|
15109
|
+
// threshold is DOCK_MIN_LEFT_PX, so it cannot hand the next drag a state that immediately flips back.
|
|
15110
|
+
const on=dock.classList.contains('dock-per-pane');
|
|
15111
|
+
const need=(on||settled)?DOCK_MIN_LEFT_PX:DOCK_MIN_LEFT_PX+DOCK_HYSTERESIS_PX;
|
|
15112
|
+
dock.classList.toggle('dock-per-pane',room>=need);
|
|
15113
|
+
}else if(dock){
|
|
15114
|
+
// Drop the class whenever this runs outside a split — in practice the BOOT clamp, since applyViewState,
|
|
15115
|
+
// setActivePane, the ResizeObserver and the divider's window-resize listener all carry their own
|
|
15116
|
+
// `viewMode==='split'` guard. (The divider's other callers — pointerup, cancel, dblclick, the arrows —
|
|
15117
|
+
// do NOT carry one; they are simply unreachable outside split, because #splitBar is display:none there.
|
|
15118
|
+
// Stating that rather than implying a guard the code does not have. Second review, finding 9.) The view
|
|
15119
|
+
// TOGGLE leaving split is handled at the guard in applyViewState, which never reaches this function.
|
|
15120
|
+
// Every rule that reads the class is body.split-view-scoped, so leaving it behind is inert today — but a
|
|
15121
|
+
// class that outlives the condition it names is a trap for the next unscoped rule. Only the CLASS is
|
|
15122
|
+
// dropped: --dock-pane3d-left is left on #stagewrap, which is genuinely harmless because every re-entry
|
|
15123
|
+
// to split recomputes it before paint, so there is no stale-value flash to prevent. (Code review.)
|
|
15124
|
+
dock.classList.remove('dock-per-pane');
|
|
15125
|
+
}
|
|
15126
|
+
if(save)try{localStorage.setItem(SPLIT_RATIO_KEY,String(splitRatio));}catch(_){}
|
|
15127
|
+
}
|
|
15128
|
+
function reflectSplitAvailability(){
|
|
15129
|
+
const btn=document.getElementById('vtSplit'),why=document.getElementById('vtSplitWhy'),wrap=document.getElementById('stagewrap');
|
|
15130
|
+
if(!btn||!why||!wrap)return true;
|
|
15131
|
+
const room=SplitView.canSplit(wrap.getBoundingClientRect().width);
|
|
15132
|
+
btn.disabled=!room.ok;
|
|
15133
|
+
if(room.ok){why.hidden=true;why.textContent='';btn.removeAttribute('aria-describedby');}
|
|
15134
|
+
else{why.hidden=false;why.textContent=room.reason;btn.setAttribute('aria-describedby','vtSplitWhy');}
|
|
15135
|
+
return room.ok;
|
|
15136
|
+
}
|
|
15137
|
+
// The ONLY place a resize may change the mode, and only on a transition of availability — not on every
|
|
15138
|
+
// resize frame, and never during a mode change. `remember:false` on both: the window moved, the user did
|
|
15139
|
+
// not change their mind, so `requestedMode` survives and Split comes back when the room does.
|
|
15140
|
+
function onStageResize(){
|
|
15141
|
+
if(!SplitView)return; // a resize before boot's imports land has nothing to reflect
|
|
15142
|
+
const ok=reflectSplitAvailability(),was=splitAvailable;
|
|
15143
|
+
splitAvailable=ok;
|
|
15144
|
+
if(was===ok)return;
|
|
15145
|
+
if(!ok&&viewMode==='split')setView('2d',{remember:false});
|
|
15146
|
+
else if(ok&&viewMode!=='split'&&requestedMode==='split')setView('split',{remember:false});
|
|
15147
|
+
}
|
|
15148
|
+
window.addEventListener('resize',onStageResize);
|
|
15149
|
+
// …and on the STAGE itself, because the window is not the only thing that resizes it. Dragging the
|
|
15150
|
+
// inspector's rail or collapsing it changes #stagewrap's width and fires NO window resize event, so with
|
|
15151
|
+
// only the listener above the refusal was unactionable by the very route it prescribes: "widen the window
|
|
15152
|
+
// or collapse the Inspector" — collapse it, and nothing re-ran, so Split stayed disabled with the same
|
|
15153
|
+
// sentence. The mirror case was worse: widening the inspector could squeeze a live split below its own
|
|
15154
|
+
// minimum with no downgrade at all. Observing the element answers both. (Code review.)
|
|
15155
|
+
if(typeof ResizeObserver!=='undefined'){
|
|
15156
|
+
const wrap=document.getElementById('stagewrap');
|
|
15157
|
+
if(wrap)new ResizeObserver(()=>{onStageResize();if(viewMode==='split')applySplitRatio(splitRatio,false);}).observe(wrap);
|
|
12762
15158
|
}
|
|
12763
15159
|
let viewSeq=0; // monotonic per view switch — see the staleness check after the awaited rebuild below
|
|
12764
|
-
|
|
15160
|
+
// setView takes a MODE ('2d'|'3d'|'split'); the legacy booleans still work so existing callers do.
|
|
15161
|
+
// `mode` is what the user REQUESTED, `want` is what actually FITS — resolveMode downgrades a split the
|
|
15162
|
+
// stage cannot hold. `effects` is captured BEFORE any mutation and is the ONLY thing allowed to decide
|
|
15163
|
+
// show/hide/rebuild/fit: inferring those again from the DOM would be a second implementation of the rule
|
|
15164
|
+
// the pure module exists to own.
|
|
15165
|
+
async function setView(on,{remember=true}={}){
|
|
12765
15166
|
const seq=++viewSeq;
|
|
15167
|
+
const mode=SplitView.sanitizeMode(on===true?'3d':on===false?'2d':on); // REQUESTED
|
|
15168
|
+
const stageEl=document.getElementById('stagewrap');
|
|
15169
|
+
const resolved=SplitView.resolveMode(mode,stageEl?stageEl.getBoundingClientRect().width:0);
|
|
15170
|
+
// Toast the refusal only when the user ASKED for this switch. On the boot restore and the automatic
|
|
15171
|
+
// resize fallback (`remember:false`) the same sentence is already sitting permanently in #vtSplitWhy
|
|
15172
|
+
// beside the disabled segment, so toasting is the sentence twice for something nobody just did.
|
|
15173
|
+
if(resolved.reason&&remember)toast(resolved.reason);
|
|
15174
|
+
const want=resolved.mode; // EFFECTIVE
|
|
15175
|
+
const effects=SplitView.nextMode(viewMode,want);
|
|
15176
|
+
let failed=false; // a 3D open that threw: keep the shared tail, skip the persist
|
|
12766
15177
|
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)
|
|
12767
15178
|
// B6: cancel the 2D-only panel-takeover / armed-pick tools on any view switch. They have no 3D counterpart, so if
|
|
12768
15179
|
// left armed they take over the panel while you're in 3D or silently resume on return to 2D (the "active command
|
|
@@ -12773,7 +15184,7 @@ async function setView(on){
|
|
|
12773
15184
|
if(gridMode)setGridMode(false); // tears down the grid panel + clears gridPick/gridLinePick + snapClear
|
|
12774
15185
|
if(csaxisMode){csaxisMode=false;setCsMode();} // drops the in-progress origin (csDraft) + the set-axes panel
|
|
12775
15186
|
if(picking){picking=false;pickKind='profile';pickEnd=null;} // an armed inspector ⌖ pick
|
|
12776
|
-
if(
|
|
15187
|
+
if(effects.show3d){
|
|
12777
15188
|
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
|
|
12778
15189
|
if(dimStyleMode){disarmed2d=true;dimStyleMode=false;} // …and closes the 2D Dimension style pane (it styles the 2D overlay only)
|
|
12779
15190
|
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)
|
|
@@ -12786,13 +15197,13 @@ async function setView(on){
|
|
|
12786
15197
|
// the segment optimistically (see armEarlyViewToggle) — so returning here would strand the control
|
|
12787
15198
|
// claiming 3D over a 2D canvas, permanently, with nothing to correct it. The catch below already
|
|
12788
15199
|
// reverts for the same reason once the renderer exists; this branch is the path where it never did.
|
|
12789
|
-
if(!window.Steel3DView){applyViewState(
|
|
15200
|
+
if(!window.Steel3DView){applyViewState('2d');toast('3D view unavailable (renderer failed to load)');return;} // stay in 2D
|
|
12790
15201
|
try{
|
|
12791
15202
|
if(!view3dReady){window.Steel3DView.init(document.getElementById('stage3d'),view3dApi);view3dReady=true;}
|
|
12792
|
-
applyViewState(
|
|
15203
|
+
applyViewState(want);
|
|
12793
15204
|
window.Steel3DView.show();
|
|
12794
15205
|
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)
|
|
12795
|
-
await window.Steel3DView.rebuild(
|
|
15206
|
+
await window.Steel3DView.rebuild(effects.fit3d); // fit the camera only when the 3D pane BECOMES visible
|
|
12796
15207
|
// Nobody awaits setView — both toggle handlers and the queued-click path fire and forget — so a
|
|
12797
15208
|
// switch BACK to 2D can complete while this one is suspended on the rebuild above. Resuming would
|
|
12798
15209
|
// then reopen 3D chrome over a 2D canvas: showLegendPanel() carries no view3d guard of its own.
|
|
@@ -12818,16 +15229,35 @@ async function setView(on){
|
|
|
12818
15229
|
// newer, healthy view back to 2D and toast about a view they had left. Same reason as the guard on
|
|
12819
15230
|
// the success path above — a staleness check on only one of the two exits is not a check.
|
|
12820
15231
|
if(seq!==viewSeq)return;
|
|
12821
|
-
applyViewState(
|
|
15232
|
+
applyViewState('2d');if(window.Steel3DView)window.Steel3DView.hide();
|
|
12822
15233
|
toast('Could not open 3D view: '+((e&&e.message)||e));
|
|
15234
|
+
// FALL THROUGH, do not return. The failure path must not persist the mode that failed — that is what
|
|
15235
|
+
// `failed` below is for — but it still needs the shared tail. An earlier revision returned here and
|
|
15236
|
+
// skipped panel(), refreshPropLabels3d() and updCS(): the success path calls updCS()/csSyncF3d()
|
|
15237
|
+
// BEFORE the awaited rebuild, so a rebuild that then threw left the Axes chip showing the 3D local
|
|
15238
|
+
// frame over a 2D canvas. (Codex review, H4.)
|
|
15239
|
+
failed=true;
|
|
12823
15240
|
}
|
|
12824
|
-
}else{if(cmTool&&window.Steel3DView&&window.Steel3DView.cmClear3d)window.Steel3DView.cmClear3d(); // 3D→2D: drop the mm-space pick the same way (tool stays armed)
|
|
12825
|
-
applyViewState(
|
|
15241
|
+
}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)
|
|
15242
|
+
applyViewState(want);
|
|
15243
|
+
// hide() is real TEARDOWN (dim tool, clip pick, insert mode, work-plane pick, frame manipulator, any
|
|
15244
|
+
// Tekla drag-out, the label hosts, the rAF loop), so it fires only when the 3D pane actually leaves.
|
|
15245
|
+
if(effects.hide3d&&window.Steel3DView)window.Steel3DView.hide();
|
|
12826
15246
|
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.
|
|
15247
|
+
// show2d drives a render() and NOTHING else — deliberately no fit. nextMode carries no `fit2d` (see its
|
|
15248
|
+
// doc comment): 3d→2d reveals the plan exactly as 3d→split does, so a fit here would throw away the zoom
|
|
15249
|
+
// that survives that round trip today. The 2D pane keeps its viewBox; a narrower pane just shows less.
|
|
15250
|
+
if(effects.show2d)render();
|
|
12827
15251
|
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
|
|
12828
15252
|
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)
|
|
12829
15253
|
refreshPropLabels3d();updatePropHint(); // push the label set to whichever view is now live (3D shows them; 2D hides the 3D host) + refresh the corner note
|
|
12830
15254
|
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)
|
|
15255
|
+
// `mode` is what the USER asked for. `want` is what FITS right now — resolveMode downgrades an
|
|
15256
|
+
// impossible split to '2d'. Persisting `want` is the bug: narrow the window once and the Split
|
|
15257
|
+
// preference is gone for good, with nothing on screen to say why. So the key records `mode`.
|
|
15258
|
+
// `failed` gates this, not an early return: a mode that could not open must not be persisted, or every
|
|
15259
|
+
// later reload would retry the same failing view. Re-asking is cheap; a saved broken mode is not.
|
|
15260
|
+
if(remember&&!failed){requestedMode=mode;try{localStorage.setItem(SPLIT_MODE_KEY,requestedMode);}catch(_){}}
|
|
12831
15261
|
}
|
|
12832
15262
|
// ONE entry point per direction, shared by the real buttons and by a click captured during load.
|
|
12833
15263
|
// They MUST agree about a renderer that has not arrived yet: steel-3d-view.js is a separate module
|
|
@@ -12840,13 +15270,28 @@ async function setView(on){
|
|
|
12840
15270
|
// background tab, which would stretch a counted 5 s into roughly a hundred.
|
|
12841
15271
|
let viewWantSeq=0; // any newer request supersedes an outstanding wait
|
|
12842
15272
|
function setViewBusy(on){const g=document.getElementById('viewToggle');if(g){if(on)g.setAttribute('aria-busy','true');else g.removeAttribute('aria-busy');}}
|
|
12843
|
-
|
|
15273
|
+
// Both handlers key on the MODE, not on the active pane. Keying on view3d made each a no-op in a split:
|
|
15274
|
+
// with the 2D pane active the 2D segment did nothing, with the 3D pane active the 3D segment did nothing,
|
|
15275
|
+
// and split became a trap you could not leave by the control that got you into it.
|
|
15276
|
+
function requestView2d(){viewWantSeq++;setViewBusy(false);if(viewMode!=='2d')setView('2d');}
|
|
12844
15277
|
function requestView3d(){
|
|
12845
15278
|
const want=++viewWantSeq,deadline=Date.now()+5000;
|
|
12846
15279
|
const tick=()=>{
|
|
12847
15280
|
if(want!==viewWantSeq)return; // superseded — a later click won
|
|
12848
|
-
if(
|
|
12849
|
-
if(window.Steel3DView||Date.now()>=deadline){setViewBusy(false);setView(
|
|
15281
|
+
if(viewMode==='3d'){setViewBusy(false);return;}
|
|
15282
|
+
if(window.Steel3DView||Date.now()>=deadline){setViewBusy(false);setView('3d');return;} // past the bound, setView gives its honest refusal
|
|
15283
|
+
setTimeout(tick,50);
|
|
15284
|
+
};
|
|
15285
|
+
tick();
|
|
15286
|
+
}
|
|
15287
|
+
// Split needs the renderer exactly as 3D does, so it waits on the same deadline rather than refusing
|
|
15288
|
+
// instantly — see requestView3d's comment above for why an instant refusal is the worse failure.
|
|
15289
|
+
function requestViewSplit(){
|
|
15290
|
+
const want=++viewWantSeq,deadline=Date.now()+5000;
|
|
15291
|
+
const tick=()=>{
|
|
15292
|
+
if(want!==viewWantSeq)return;
|
|
15293
|
+
if(viewMode==='split'){setViewBusy(false);return;}
|
|
15294
|
+
if(window.Steel3DView||Date.now()>=deadline){setViewBusy(false);setView('split');return;}
|
|
12850
15295
|
setTimeout(tick,50);
|
|
12851
15296
|
};
|
|
12852
15297
|
tick();
|
|
@@ -12856,6 +15301,18 @@ function requestView3d(){
|
|
|
12856
15301
|
// switch — silently doing the opposite of the last thing the user asked for.
|
|
12857
15302
|
document.getElementById('vt2d').onclick=()=>{pendingView=null;requestView2d();};
|
|
12858
15303
|
document.getElementById('vt3d').onclick=()=>{pendingView=null;requestView3d();};
|
|
15304
|
+
{const s=document.getElementById('vtSplit');if(s)s.onclick=()=>{pendingView=null;requestViewSplit();};}
|
|
15305
|
+
// CAPTURE phase, so the pane is active BEFORE the canvas's own handler runs: the 3D engine's onDown is
|
|
15306
|
+
// itself a capture-phase listener on #stage3d, and it must see inputActive already true.
|
|
15307
|
+
document.getElementById('pane2d').addEventListener('pointerdown',()=>setActivePane('2d'),true);
|
|
15308
|
+
document.getElementById('pane3d').addEventListener('pointerdown',()=>setActivePane('3d'),true);
|
|
15309
|
+
// …and on FOCUS, which is what makes split reachable without a mouse. With pointerdown as the only
|
|
15310
|
+
// trigger, a keyboard user entering split via #vtSplit was pinned to the 2D pane for good: everything
|
|
15311
|
+
// gated on the active pane (#dim3dWrap, every body.v3d menu row) became permanently unreachable, and
|
|
15312
|
+
// #stage3d — which carries tabindex=0 — was a dead end, focusable but with its keyboard switched off
|
|
15313
|
+
// by setInputActive(false). Tabbing into a pane now hands it the tools. (Code review.)
|
|
15314
|
+
document.getElementById('pane2d').addEventListener('focusin',()=>setActivePane('2d'));
|
|
15315
|
+
document.getElementById('pane3d').addEventListener('focusin',()=>setActivePane('3d'));
|
|
12859
15316
|
// Hand over from the pre-load capture (see armEarlyViewToggle). Retire it FIRST, so the two cannot
|
|
12860
15317
|
// both act on the same click, and drop aria-busy now that the group's state is authoritative again.
|
|
12861
15318
|
// A pending 2D needs no action: it is the default the toggle already shows. A pending 3D is applied on
|
|
@@ -12875,8 +15332,48 @@ viewHandlersLive=true;
|
|
|
12875
15332
|
// no 2D plan — so a user who just migrated their project would land on a blank canvas and conclude the
|
|
12876
15333
|
// migration ate their model. 3D IS the model view for it, and it shows all of it. A queued real click
|
|
12877
15334
|
// still wins: this only supplies the default when the user expressed no preference during load.
|
|
12878
|
-
|
|
12879
|
-
|
|
15335
|
+
// Restore the persisted mode + divider ratio. Runs HERE because it needs #vtSplit to be in the document
|
|
15336
|
+
// and SplitView to have loaded — both true by main().
|
|
15337
|
+
{let saved='2d';try{saved=localStorage.getItem(SPLIT_MODE_KEY)||'2d';}catch(_){}
|
|
15338
|
+
// requestedMode is seeded from the SAVED value, not from whatever setView manages to render. Opening on
|
|
15339
|
+
// a narrow window resolves to '2d' for now and the key SURVIVES — but note the mechanism, because it is
|
|
15340
|
+
// not remember:false (this path routes through pendingView into requestViewSplit, where `remember`
|
|
15341
|
+
// defaults true). It survives because setView persists `mode`, the REQUEST, rather than `want`, the
|
|
15342
|
+
// downgrade. Simplify that line to persist `want` and this invariant dies silently: narrow the window
|
|
15343
|
+
// once and the Split preference is gone for good. Widening later restores it via onStageResize's edge.
|
|
15344
|
+
requestedMode=SplitView.sanitizeMode(saved);
|
|
15345
|
+
try{splitRatio=SplitView.sanitizeRatio(parseFloat(localStorage.getItem(SPLIT_RATIO_KEY)));}catch(_){splitRatio=0.5;}
|
|
15346
|
+
applySplitRatio(splitRatio,false,true); // clamp against THIS stage, and seed aria-valuenow with it (settled: boot)
|
|
15347
|
+
// SEED THE EDGE DETECTOR, unconditionally and AFTER #vtSplit exists — two bugs live here:
|
|
15348
|
+
// · splitAvailable starts true, and reflectSplitAvailability ALSO returns true when the button is
|
|
15349
|
+
// absent. Booting narrow then widening would be true→true: no edge, no restore, and the saved
|
|
15350
|
+
// Split silently never comes back.
|
|
15351
|
+
// · A plain 2D boot never calls setView at all, so without this the Split button would sit enabled
|
|
15352
|
+
// with no reason text on a window too narrow to honour it, until the first resize.
|
|
15353
|
+
splitAvailable=reflectSplitAvailability();
|
|
15354
|
+
// A real click queued during load still wins — the restore only applies when the user expressed no
|
|
15355
|
+
// preference, exactly as the MODEL_RO default above does. It goes through setView DIRECTLY rather than
|
|
15356
|
+
// through pendingView so it can pass remember:false: a restore is not a fresh decision, so it must
|
|
15357
|
+
// neither rewrite the key nor toast a refusal the user did not just ask for (#vtSplitWhy already says
|
|
15358
|
+
// it, permanently, beside the disabled segment). Deferred a tick for the same reason the pending-click
|
|
15359
|
+
// hand-over below is: main() is still wiring the state setView acts on.
|
|
15360
|
+
if(pendingView===null&&requestedMode!=='2d'){
|
|
15361
|
+
const want=requestedMode;
|
|
15362
|
+
setTimeout(()=>{if(pendingView!==null)return;setView(want,{remember:false});},0);
|
|
15363
|
+
}
|
|
15364
|
+
// DEFAULT TO 3D for a read-only model (unit 5, P7d §8.5). The toggle defaults to 2D and a v2 model has
|
|
15365
|
+
// no 2D plan, so a user who just migrated their project would land on a blank canvas and conclude the
|
|
15366
|
+
// migration ate their model. 3D IS the model view for it.
|
|
15367
|
+
//
|
|
15368
|
+
// This runs AFTER the restore and is gated on requestedMode==='2d', which is the whole correction: it
|
|
15369
|
+
// supplies a default only where the user expressed NO preference. Sitting above the restore (where it
|
|
15370
|
+
// used to), it claimed pendingView first, so a read-only model with a saved Split reopened in 3D and
|
|
15371
|
+
// then had no availability edge to bring Split back — the saved preference was unreachable for good.
|
|
15372
|
+
// A queued real click still wins over both. (Codex review, H6.)
|
|
15373
|
+
else if(MODEL_RO&&pendingView===null&&requestedMode==='2d')pendingView='3d';}
|
|
15374
|
+
// Dispatch on the MODE STRING now that there are three of them. '2d' still needs no switch — it is the
|
|
15375
|
+
// default already on screen — so it falls to the else and simply ends the busy state.
|
|
15376
|
+
if(pendingView==='3d'||pendingView==='split'){const want=pendingView;setTimeout(()=>{if(pendingView!==want)return;pendingView=null;if(want==='split')requestViewSplit();else requestView3d();},0);}
|
|
12880
15377
|
else{pendingView=null;setViewBusy(false);}
|
|
12881
15378
|
// 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.
|
|
12882
15379
|
window.addEventListener('wheel',e=>{if(e.ctrlKey)e.preventDefault();},{passive:false});
|