@floless/app 0.123.0 → 0.123.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 +2360 -2085
- package/dist/schemas/steel.takeoff.v1.schema.json +1 -0
- package/dist/web/app.css +74 -17
- package/dist/web/app.js +2 -1
- package/dist/web/steel-3d-view.js +423 -26
- package/dist/web/steel-editor.html +572 -29
- package/dist/web/steel-filter-core.js +61 -0
- package/dist/web/steel-filter.html +17 -2
- package/dist/web/vector-3d.html +33 -1
- package/dist/web/vector-editor.html +33 -1
- package/dist/web/workspaces.js +52 -17
- package/package.json +1 -1
|
@@ -92,6 +92,48 @@
|
|
|
92
92
|
input[type=radio]:checked{border-color:var(--brand)}
|
|
93
93
|
input[type=radio]:checked::before{transform:scale(1)}
|
|
94
94
|
input[type=radio]:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
|
|
95
|
+
/* Checkboxes go the SAME route, and the comment above understated the problem when it called the
|
|
96
|
+
per-container `.gck input` / `.m3dmenu label input` rules an escape hatch that worked: every one of
|
|
97
|
+
them was `accent-color` plus a width, which fixes the STRETCH but not the colour — accent-color
|
|
98
|
+
tints only the CHECKED fill, so an UNCHECKED box stayed the UA widget, a solid white square on this
|
|
99
|
+
#070a0f page. Rebuilt here the way steel-filter.html:90 already builds its global checkbox (brand
|
|
100
|
+
fill, white tick, 3px radius) using the same ::before construction as the radio directly above.
|
|
101
|
+
The tick is a fixed 9px, NOT a percentage: the box is `display:inline-grid` with `place-content:
|
|
102
|
+
center`, so its track is sized by this very item and a percentage width resolves to 0 — measured at
|
|
103
|
+
6x, every checked box painted a solid brand square with no check in it. A guard cannot catch that
|
|
104
|
+
(it reads declarations, and `width:62%` is one), so the size is stated outright. */
|
|
105
|
+
input[type=checkbox]{appearance:none;-webkit-appearance:none;width:14px;height:14px;flex:none;padding:0;
|
|
106
|
+
border:1px solid #475569;border-radius:3px;background:#0f172a;cursor:pointer;display:inline-grid;place-content:center;
|
|
107
|
+
transition:border-color .12s,background-color .12s}
|
|
108
|
+
input[type=checkbox]::before{content:'';width:9px;height:9px;background:#fff;transform:scale(0);transition:transform .12s ease;
|
|
109
|
+
clip-path:polygon(14% 44%,0 65%,50% 100%,100% 16%,80% 0%,43% 62%)}
|
|
110
|
+
input[type=checkbox]:checked{background:var(--brand);border-color:var(--brand)}
|
|
111
|
+
input[type=checkbox]:checked::before{transform:scale(1)}
|
|
112
|
+
input[type=checkbox]:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
|
|
113
|
+
/* INDETERMINATE. `appearance:none` deletes the platform's mixed-state dash along with the box, and
|
|
114
|
+
only `:checked` reveals the tick — so a checkbox the editor has explicitly put in the mixed state
|
|
115
|
+
rendered identically to an unchecked one, quietly reporting "no" where the truth is "the selection
|
|
116
|
+
disagrees". This page really does drive it: dimBg (line ~5012) when selected dimensions differ on
|
|
117
|
+
label backgrounds, and the per-end `_ck` TOS-default boxes (~5297) when members mix default and
|
|
118
|
+
custom. Same fill as :checked, with the ::before clipped to a bar instead of a tick. Declared on
|
|
119
|
+
every surface, not just this one, so the next page to set .indeterminate inherits it rather than
|
|
120
|
+
re-learning this. (Raised by the Codex review on #592.) */
|
|
121
|
+
input[type=checkbox]:indeterminate{background:var(--brand);border-color:var(--brand)}
|
|
122
|
+
input[type=checkbox]:indeterminate::before{transform:scale(1);clip-path:none;height:2px;border-radius:1px}
|
|
123
|
+
/* FORCED COLORS (Windows High Contrast). The OS overrides every authored colour, so the custom box's
|
|
124
|
+
fill and its clipped ::before both collapse to system colours and the states stop being tellable
|
|
125
|
+
apart. Hand the platform its own widget back: in that mode the UA control is the accessible one,
|
|
126
|
+
and the white-on-dark leak this whole rule exists to fix cannot arise, because the OS — not this
|
|
127
|
+
stylesheet — is choosing the colours. `revert` rolls each declaration back to the UA origin, which
|
|
128
|
+
also drops the generic `select,input{width:100%}` above for these two controls.
|
|
129
|
+
NOTE for the guard: verify-native-controls deliberately cannot see inside a conditional @media, so
|
|
130
|
+
this block neither satisfies nor weakens it — the unconditional rules above are still what it
|
|
131
|
+
reads. (Raised by the Codex review on #592.) */
|
|
132
|
+
@media (forced-colors: active){
|
|
133
|
+
input[type=checkbox],input[type=radio]{appearance:revert;-webkit-appearance:revert;width:revert;height:revert;
|
|
134
|
+
border:revert;background:revert;display:revert;padding:revert}
|
|
135
|
+
input[type=checkbox]::before,input[type=radio]::before{content:none}
|
|
136
|
+
}
|
|
95
137
|
input[type=number]{-moz-appearance:textfield;appearance:textfield}
|
|
96
138
|
input[type=number]::-webkit-outer-spin-button,input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
|
|
97
139
|
.row{margin:8px 0} .danger{background:#7f1d1d;border-color:#991b1b} .danger:hover{background:#991b1b}
|
|
@@ -187,7 +229,7 @@
|
|
|
187
229
|
.tfchip:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
|
|
188
230
|
.tfchip.tfdim{border-style:dashed}
|
|
189
231
|
.defck{display:inline-flex;align-items:center;gap:4px;font-size:10px;text-transform:uppercase;letter-spacing:.05em;color:var(--mut);cursor:pointer}
|
|
190
|
-
.defck input{
|
|
232
|
+
.defck input{margin:0;cursor:pointer} /* size + theming now come from the global input[type=checkbox] rule; `width:auto` had to go — on an appearance:none box it collapses the control to nothing */
|
|
191
233
|
input:disabled{opacity:.55;cursor:default}
|
|
192
234
|
.badge{display:block;background:var(--brand);color:#fff;text-align:center;font-size:11px;letter-spacing:.08em;text-transform:uppercase;padding:5px;border-radius:6px;margin-bottom:10px}
|
|
193
235
|
.pick{color:var(--brand)!important}
|
|
@@ -505,6 +547,34 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
505
547
|
#panel .pintog.on .mck::after{transform:translateX(12px);background:var(--brand)}
|
|
506
548
|
#panel .pintog svg{margin-right:4px;color:#22d3ee;flex:none} /* the pin glyph carries the dim accent, matching the on-canvas markers */
|
|
507
549
|
#panel .pintog:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
|
|
550
|
+
/* ── The drilled-into reference object (S2 Stage A): somebody else's IFC element, read-only.
|
|
551
|
+
Property SETS are accordions because one object can carry several of them and a dozen-plus rows each
|
|
552
|
+
— measured on the Motebello sample: 2 sets and 15 values on its heaviest object, 31 sets and 271
|
|
553
|
+
values across its 19 (docs/superpowers/specs/2026-08-03-reference-objects-stage-a-qa.md). Dumping
|
|
554
|
+
that into a 240px rail on select is unreadable. The chevron / aria-expanded / aria-controls /
|
|
555
|
+
brand-tinted-open recipe is #moreMenu's (.msec-hdr), reused rather than reinvented — same glyph too.
|
|
556
|
+
NO inner scroller: the panel is already `overflow:auto` and inherits the global themed scrollbar, so
|
|
557
|
+
a bespoke fixed-height box here would be one more thing to theme and test for nothing. */
|
|
558
|
+
#panel .robjname{font-size:13px;color:var(--text);font-weight:600;overflow-wrap:anywhere;margin:0 0 2px}
|
|
559
|
+
#panel .psetgrp{border-top:1px solid var(--line)}
|
|
560
|
+
#panel .psethd{display:flex;align-items:center;gap:6px;width:100%;background:transparent;border:0;border-radius:0;box-shadow:none;color:var(--text);font:600 11px system-ui;padding:5px 2px;cursor:pointer;text-align:left}
|
|
561
|
+
#panel .psethd:hover{color:var(--text);background:#33415580}
|
|
562
|
+
#panel .psethd[aria-expanded=true]{color:var(--brand)}
|
|
563
|
+
#panel .psethd:focus-visible{outline:2px solid var(--brand);outline-offset:-2px}
|
|
564
|
+
#panel .psethd .chev{color:var(--mut);font-size:10px;width:10px;flex:none;transition:transform .15s}
|
|
565
|
+
#panel .psethd[aria-expanded=true] .chev{transform:rotate(90deg);color:var(--brand)}
|
|
566
|
+
#panel .psethd .psn{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
567
|
+
#panel .psethd .psc{flex:none;color:var(--mut);font-weight:400;font-variant-numeric:tabular-nums}
|
|
568
|
+
#panel .psetbody{display:none;padding:2px 0 8px 16px}
|
|
569
|
+
#panel .psetbody.open{display:block}
|
|
570
|
+
/* Label ABOVE value, not beside it: an IFC property name ("NominalRenderingHeight") and its value
|
|
571
|
+
("0055SFt0000001150") can BOTH be long, so the label-left/value-right recipe this panel uses
|
|
572
|
+
elsewhere either truncates or wraps into a ragged mess at this width. */
|
|
573
|
+
#panel .psrow{display:flex;flex-direction:column;gap:1px;margin:0 0 7px}
|
|
574
|
+
#panel .psrow .psk{font-size:10px;color:var(--mut);overflow-wrap:anywhere;line-height:1.35}
|
|
575
|
+
#panel .psrow .psv{font-size:12px;color:var(--text);overflow-wrap:anywhere;line-height:1.4}
|
|
576
|
+
#panel .psrow .psv.psnone{color:var(--mut)} /* the file recorded the property with NO value */
|
|
577
|
+
#panel .psrow .psv.psempty{color:var(--mut);font-style:italic} /* …with an EMPTY value, which is a different fact */
|
|
508
578
|
#dimEditPop .dimEditTog:hover{border-color:var(--brand);color:var(--text)}
|
|
509
579
|
#dimEditPop .dimEditTog.on{border-color:var(--brand);background:rgba(59,130,246,.18);color:var(--text)}
|
|
510
580
|
#dimEditPop .dimEditTog.pin.on{border-color:#22d3ee;background:rgba(34,211,238,.16);color:var(--text)}
|
|
@@ -540,7 +610,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
540
610
|
.gerr{color:#fca5a5;font-size:11px;margin-top:3px}
|
|
541
611
|
.gbtns{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px} .gbtns button{margin:0}
|
|
542
612
|
.gck{display:flex;align-items:center;gap:8px;color:var(--text);cursor:pointer;font-size:12px;padding:2px 0}
|
|
543
|
-
.gck input{
|
|
613
|
+
.gck input{cursor:pointer;margin:0;width:14px;height:14px;flex:none} /* beat the panel's generic full-width input rule */
|
|
544
614
|
/* F11 generated views modal — baseline modal/tabs/inputs, sized for batch selection without crowding the 240px Views pane. */
|
|
545
615
|
#viewGenModal{z-index:60} /* the 3D toolbar is z:59; this modal must fully cover it, while later-appended toasts at z:60 and the z:80 tooltip still win */
|
|
546
616
|
#viewGenModal .mpanel{width:min(640px,92vw)}
|
|
@@ -556,7 +626,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
556
626
|
#vgList .vggroup{padding:5px 7px 3px;color:var(--mut);font-size:10px;text-transform:uppercase;letter-spacing:.07em}
|
|
557
627
|
#vgList .vgrow{display:flex;align-items:center;gap:9px;padding:6px 8px;border-radius:5px;cursor:pointer}
|
|
558
628
|
#vgList .vgrow:hover{background:#33415580}
|
|
559
|
-
#vgList .vgrow input{
|
|
629
|
+
#vgList .vgrow input{width:14px;height:14px;margin:0;flex:none}
|
|
560
630
|
#vgList .vgaxis{width:18px;color:var(--mut);font-size:10px;font-weight:700}
|
|
561
631
|
#vgList .vgname{color:var(--text);font-size:12px}
|
|
562
632
|
#vgList .vgempty{padding:28px 16px;text-align:center;color:var(--mut);font-size:12px;line-height:1.5}
|
|
@@ -664,7 +734,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
664
734
|
.m3dmenu hr{border:0;border-top:1px solid var(--line);margin:4px 0}
|
|
665
735
|
.m3dmenu label{display:flex;align-items:center;gap:7px;padding:7px 12px;color:var(--text);font-size:12px;cursor:pointer;white-space:nowrap}
|
|
666
736
|
.m3dmenu label:hover{background:#334155}
|
|
667
|
-
.m3dmenu label input{margin:0;
|
|
737
|
+
.m3dmenu label input{margin:0;cursor:pointer} /* the global input[type=checkbox] rule now sets the box size, so this no longer inherits input{width:100%} and no longer needs `width:auto` — which on an appearance:none box would collapse it (View / Plane / Work toggles) */
|
|
668
738
|
.m3dmenu .wpprow{display:flex;gap:4px;align-items:center;padding:4px 12px}
|
|
669
739
|
.m3dmenu .wpprow button{width:auto;flex:none;padding:4px 8px;border:1px solid var(--line);border-radius:5px}
|
|
670
740
|
.m3dmenu .wpprow input{width:74px;height:24px;background:var(--bg);color:var(--text);border:1px solid var(--line);border-radius:5px;padding:0 6px;font:12px system-ui}
|
|
@@ -688,7 +758,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
688
758
|
#propPop .pprow:hover{background:#334155}
|
|
689
759
|
#propPop .pprow.dis{opacity:.5;cursor:default}
|
|
690
760
|
#propPop .pprow.dis:hover{background:transparent}
|
|
691
|
-
#propPop .pprow input{margin:0;
|
|
761
|
+
#propPop .pprow input{margin:0;cursor:pointer;flex:none} /* the global input[type=checkbox] rule sizes the box, so the old `width:auto` (which would now collapse it) is gone */
|
|
692
762
|
#propPop .pprow .pn{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
693
763
|
#propPop .pprow .pv{color:var(--mut);font-variant-numeric:tabular-nums;max-width:44%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:right}
|
|
694
764
|
#propPop .pprow .pv.varies{font-style:italic}
|
|
@@ -696,7 +766,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
696
766
|
#propPop .ppfoot{border-top:1px solid var(--line);padding:8px 10px;display:flex;flex-direction:column;gap:6px}
|
|
697
767
|
#propPop .ppfoot .seg2{margin-top:0}
|
|
698
768
|
#propPop .ppfoot label{display:flex;align-items:center;gap:7px;color:var(--text);cursor:pointer;font-size:11px}
|
|
699
|
-
#propPop .ppfoot label input{margin:0;
|
|
769
|
+
#propPop .ppfoot label input{margin:0;cursor:pointer;flex:none}
|
|
700
770
|
/* Connection read-only mode: no labeling, so hide the label footer + Clear-all; rows aren't clickable. */
|
|
701
771
|
#propPop.connmode .ppfoot{display:none}
|
|
702
772
|
#propPop.connmode #ppClear{display:none}
|
|
@@ -780,7 +850,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
780
850
|
than a new hue being invented. ── */
|
|
781
851
|
#refHeadRow{display:flex;align-items:stretch;gap:6px;margin-bottom:6px;flex:none}
|
|
782
852
|
#refAddBtn{flex:1;min-width:0;height:28px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
783
|
-
#m3dRefsBody .refempty
|
|
853
|
+
#m3dRefsBody .refempty{color:var(--mut);font-size:11px;line-height:1.5;padding:6px 4px}
|
|
784
854
|
#m3dRefsBody .refrow{display:flex;align-items:center;gap:6px;padding:3px 4px;border-radius:5px;cursor:pointer;user-select:none;white-space:nowrap}
|
|
785
855
|
#m3dRefsBody .refrow:hover{background:#33415580}
|
|
786
856
|
#m3dRefsBody .refrow.sel{box-shadow:inset 2px 0 0 var(--brand);background:rgba(59,130,246,.16);padding-left:2px}
|
|
@@ -1358,7 +1428,10 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1358
1428
|
<div id=riDropErr role=alert></div>
|
|
1359
1429
|
<input id=riFile type=file accept=".ifc,.ifczip" style="display:none">
|
|
1360
1430
|
</div>
|
|
1361
|
-
|
|
1431
|
+
<!-- The spinner is `connImportModal`'s own `.ci-prog`/`.ci-spin` (see the CSS above), reused rather
|
|
1432
|
+
than re-invented: this stage sat as static text for up to six seconds before its honest
|
|
1433
|
+
"still working" message appeared, which reads as hung next to the sibling modal that spins. -->
|
|
1434
|
+
<div id=riProgStage style="display:none"><div class=ci-prog><span class=ci-spin aria-hidden=true></span><span id=riProgTxt>Reading the file…</span></div></div>
|
|
1362
1435
|
<div id=riConfirmStage style="display:none">
|
|
1363
1436
|
<div id=riSays></div>
|
|
1364
1437
|
<div class=rirow><span class=pn>Schema</span><span class=pv id=riSchema>—</span></div>
|
|
@@ -4802,11 +4875,83 @@ function syncV2SelectionNotice(p){
|
|
|
4802
4875
|
else if(m&&canonical){mark('tosA',!Number.isFinite(canonical.from?.z?.known));mark('tosB',!Number.isFinite(canonical.to?.z?.known));}
|
|
4803
4876
|
}
|
|
4804
4877
|
}
|
|
4878
|
+
/**
|
|
4879
|
+
* Does something else own the panel or the selection right now?
|
|
4880
|
+
*
|
|
4881
|
+
* The reference object is the LOWEST-PRIORITY thing this panel can show. It beats the two "there is
|
|
4882
|
+
* nothing to say" notices below it (`NO_PLAN_VIEW`, the read-only note) — for a drilled-into object
|
|
4883
|
+
* there IS something to say, and it is true — but it must lose to everything the user explicitly did.
|
|
4884
|
+
*
|
|
4885
|
+
* The dispatch cannot simply be moved below those takeovers: they sit BELOW the two notices, which is
|
|
4886
|
+
* correct for them (a v2 document cannot reach them) and would put the reference branch back under
|
|
4887
|
+
* `NO_PLAN_VIEW`, where the whole feature was unreachable. So the ORDER stays and this predicate carries
|
|
4888
|
+
* the rule instead — the same shape `dimStyleMode` already uses one line further down.
|
|
4889
|
+
*
|
|
4890
|
+
* Two classes, and both were missed by the first cut (Codex review):
|
|
4891
|
+
* a SELECTION of ours — including 3D dimensions and clip planes, which are deleted by the same
|
|
4892
|
+
* Delete key that would then be acting on something the panel is not describing;
|
|
4893
|
+
* a MODE the user armed — the 3D local frame, Dimension, Dimension style, Set local axes, Move/Copy.
|
|
4894
|
+
* Each of those renders instructions into this panel, and the reference object was swallowing them
|
|
4895
|
+
* whole: drill in, arm the frame, and the frame's own prompts never appeared.
|
|
4896
|
+
*
|
|
4897
|
+
* `gridMode` is deliberately NOT here: it is dispatched above the reference branch already.
|
|
4898
|
+
*
|
|
4899
|
+
* WHICH of the two it is matters, so this returns the kind rather than a boolean. A SELECTION of ours
|
|
4900
|
+
* clears the reference outright — that is what `clickSelect` already does when a click lands on one of
|
|
4901
|
+
* our members, and anything less is worse than nothing: the independent QA pass found that releasing to
|
|
4902
|
+
* a whole-reference selection left all nineteen objects LIT at the exact moment the user selected their
|
|
4903
|
+
* own steel, which draws more attention to the reference than the drill did. A MODE only drops the
|
|
4904
|
+
* drill; arming the Dimension tool is not a statement about which reference you care about.
|
|
4905
|
+
*/
|
|
4906
|
+
function refPanelPreempted(){
|
|
4907
|
+
if(selIds.size||selDimIds.size||selGridIds.size||sel3dDimIds.size)return 'selection';
|
|
4908
|
+
const v=window.Steel3DView;
|
|
4909
|
+
if(view3d&&v&&v.selectedClips&&v.selectedClips().length)return 'selection';
|
|
4910
|
+
if(dimStyleMode||dimMode||csaxisMode||cmTool)return 'mode';
|
|
4911
|
+
if(view3d&&v&&v.frameArmed&&v.frameArmed())return 'mode';
|
|
4912
|
+
return null;
|
|
4913
|
+
}
|
|
4805
4914
|
function panel(){
|
|
4806
4915
|
const p=document.getElementById('panel');
|
|
4807
4916
|
if(MODEL_V2)queueMicrotask(()=>syncV2SelectionNotice(p));
|
|
4808
4917
|
if(!selDimIds.size||!dimsVisible)dimSplitMode=false;document.body.classList.toggle('dimsplit',dimSplitMode); // split mode is meaningless without a (visible) dim selected — also disarms when dims are hidden
|
|
4809
4918
|
if(gridMode){renderGridPanel(p);return;}
|
|
4919
|
+
// FIRST after the grid takeover, and ABOVE the two "there is nothing to say" panels below — because for
|
|
4920
|
+
// a drilled-into reference object there IS something to say, and it is true. A reference model is
|
|
4921
|
+
// model-level: it does not belong to a plan view and it does not depend on our own model being
|
|
4922
|
+
// editable, so both of the notices below answer a question the user did not ask. Sitting under
|
|
4923
|
+
// NO_PLAN_VIEW in particular made the whole feature UNREACHABLE on a document whose only views are
|
|
4924
|
+
// elevations or sections — you could drill in, the object would highlight, and the panel would go on
|
|
4925
|
+
// saying "No editable plan view". (Codex review.)
|
|
4926
|
+
//
|
|
4927
|
+
// The grid panel stays above it: that one is a mode the user explicitly entered and must be able to leave.
|
|
4928
|
+
//
|
|
4929
|
+
// ANYTHING THAT SELECTS SOMETHING OF OURS TAKES THE PANEL BACK — the same rule, in the same place, as
|
|
4930
|
+
// `dimStyleMode` three lines below, and for the same reason: there are far too many ways to select for a
|
|
4931
|
+
// release call at each of them to survive. `clickSelect` drops the drill when a click lands on one of
|
|
4932
|
+
// our members, but that is the ONLY path that does; a marquee (`onSelectMany`), a legend locate, Ctrl+A,
|
|
4933
|
+
// an RFI jump and a switch back to 2D all leave it standing, and the panel would then describe somebody
|
|
4934
|
+
// else's IFC object while Delete and the arrow keys acted on your beam. Confidently wrong about what is
|
|
4935
|
+
// selected is the worst state this panel has. (Code review.)
|
|
4936
|
+
//
|
|
4937
|
+
// The view is told too, so the 3D highlight cannot outlive the panel that explained it. That call is
|
|
4938
|
+
// not re-entrant: it emits `onReferenceSelect(id, null)`, which finds the editor state already updated
|
|
4939
|
+
// on the line above and returns before repainting.
|
|
4940
|
+
{const _pre=refSelectedObjIdx!==null?refPanelPreempted():null,_v=window.Steel3DView;
|
|
4941
|
+
if(_pre){
|
|
4942
|
+
refSelectedObjIdx=null;
|
|
4943
|
+
if(_pre==='selection'){
|
|
4944
|
+
// OUR SELECTION DROPS THE REFERENCE ENTIRELY, exactly as `clickSelect` does for a direct member
|
|
4945
|
+
// click. Releasing to a whole-reference selection instead lit all nineteen of its objects at the
|
|
4946
|
+
// moment the user selected their own steel — a louder reference, from an action about our model.
|
|
4947
|
+
refSelectedId=null;
|
|
4948
|
+
if(_v&&_v.selectReference)_v.selectReference(null);
|
|
4949
|
+
if(legendTab==='refs')renderRefsTab();
|
|
4950
|
+
} else if(_v&&_v.selectReference&&_v.selectedReferenceObject&&_v.selectedReferenceObject()){
|
|
4951
|
+
_v.selectReference(refSelectedId); // an armed MODE only ends the drill; the reference you were reading stays selected
|
|
4952
|
+
}
|
|
4953
|
+
}}
|
|
4954
|
+
if(refSelectedId!==null&&refSelectedObjIdx!==null&&renderPanelReferenceObject(p))return;
|
|
4810
4955
|
if(NO_PLAN_VIEW){p.innerHTML='<span class=badge>No editable plan view</span><div class=hint style="margin-top:8px">This model has no registered plan view to map into the 2D canvas. Elevation, section, detail, and unknown views stay available in 3D, but they are not edited as plans.</div>';return;}
|
|
4811
4956
|
if(MODEL_RO){renderPanelV2(p);return;} // …after the grid panel, which is the one panel a v2 document does reach
|
|
4812
4957
|
if(dimStyleMode&&(selIds.size||selDimIds.size))dimStyleMode=false; // anything that selects (Ctrl+A, Duplicates, Reversed beams, a legend/RFI locate…) takes the panel back from the style pane — one guard instead of a disarm call at every such command
|
|
@@ -7913,7 +8058,31 @@ const view3dApi={
|
|
|
7913
8058
|
// one-way — the panel drives the 3D view but a pick in the 3D view leaves the panel showing the
|
|
7914
8059
|
// previous row, which is worse than no highlight because it is confidently wrong. Found by clicking
|
|
7915
8060
|
// the canvas for real; every panel-driven path had looked fine.
|
|
7916
|
-
|
|
8061
|
+
// `obj` is the ONE object drilled into (Ctrl+click), or null for a whole-reference select. The panel is
|
|
8062
|
+
// rendered from it, so it is compared as well as the id: Ctrl+clicking a second object inside the SAME
|
|
8063
|
+
// reference leaves `id` unchanged, and an early return on the id alone would leave the Inspect panel
|
|
8064
|
+
// describing the first object while the 3D view highlights the second.
|
|
8065
|
+
onReferenceSelect:(id,obj)=>{
|
|
8066
|
+
const nextId=id||null,nextIdx=obj&&Number.isInteger(obj.index)?obj.index:null;
|
|
8067
|
+
if(refSelectedId===nextId&&refSelectedObjIdx===nextIdx)return;
|
|
8068
|
+
refSelectedId=nextId;refSelectedObjIdx=nextIdx;
|
|
8069
|
+
// DRILLING IN TAKES THE SELECTION, NOT JUST THE PANEL — the exact mirror of `clickSelect` dropping the
|
|
8070
|
+
// reference the moment a click lands on one of our own members. The two are one selection between
|
|
8071
|
+
// them, and the first cut let them coexist: with a beam selected, drilling into a reference object put
|
|
8072
|
+
// its facts in the panel while Delete and the arrow keys still acted on the beam. Panel and keystroke
|
|
8073
|
+
// target pointing at different things is the worst state this feature has.
|
|
8074
|
+
//
|
|
8075
|
+
// Only a DRILL steals. Selecting a whole reference (a row click) does not take the panel, so it has no
|
|
8076
|
+
// business taking the selection either.
|
|
8077
|
+
//
|
|
8078
|
+
// This is also what keeps `panel()`'s release guard from fighting an intentional drill: the guard fires
|
|
8079
|
+
// when something of ours is selected, and by the time it runs, nothing is. The browser pass caught
|
|
8080
|
+
// that — with a marquee selection live, drilling was silently impossible.
|
|
8081
|
+
const stole=nextIdx!==null&&(selIds.size||selDimIds.size||selGridIds.size||sel3dDimIds.size);
|
|
8082
|
+
if(stole){selIds.clear();selDimIds.clear();selGridIds.clear();sel3dDimIds.clear();}
|
|
8083
|
+
if(legendTab==='refs')renderRefsTab();
|
|
8084
|
+
if(stole)render();else panel(); // render() repaints the canvas too, so our own highlight goes with the selection
|
|
8085
|
+
},
|
|
7917
8086
|
onBasePickModeChange:()=>{}, // Mode B armed state shows via the 3D crosshair + elevation readout; nothing else to reflect
|
|
7918
8087
|
onBasePick:(p)=>{ // Mode B: retarget the armed column's base to the picked elevation (world mm → inches), ONE undo entry
|
|
7919
8088
|
const m=byId(basePickColId); if(!m||m.role!=='column'||!m.col){toast('No column to trim');return;}
|
|
@@ -8799,8 +8968,58 @@ const refLoading=new Set(); // ids with a geometry fetch in flight — the
|
|
|
8799
8968
|
const refFailed=new Map(); // id -> why its geometry could not be fetched (see loadReferenceGeometry)
|
|
8800
8969
|
const refEmpty=new Set(); // ids the reader answered for, with nothing drawable in the answer
|
|
8801
8970
|
let refSelectedId=null; // the reference the panel has expanded (and the 3D layer has selected)
|
|
8971
|
+
/**
|
|
8972
|
+
* The INDEX of the one object drilled into inside `refSelectedId`, or null.
|
|
8973
|
+
*
|
|
8974
|
+
* An index rather than an id, because that is what addresses a mesh — see `xrefSubSelected` in
|
|
8975
|
+
* web/steel-3d-view.js for why an IFC GlobalId cannot. It indexes `refGeom.get(refSelectedId).objects`,
|
|
8976
|
+
* the very array the 3D layer was handed, so the panel and the highlight cannot describe two different
|
|
8977
|
+
* objects.
|
|
8978
|
+
*
|
|
8979
|
+
* THE 3D LAYER IS THE OWNER OF THE INDEX. `onReferenceSelect` is the only thing that ever sets this to a
|
|
8980
|
+
* NUMBER; every other write — the row click, `refRemove`, the import, `panel()`'s takeover release —
|
|
8981
|
+
* only ever clears it to null. So the panel can never point at an object the 3D layer is not currently
|
|
8982
|
+
* drilled into, and a rebuild that drops the selection (a re-read after "Reload its geometry") clears
|
|
8983
|
+
* the panel with it. (An earlier draft of this comment claimed this was written from nowhere else at
|
|
8984
|
+
* all, which was simply false — review caught it; the invariant above is both true and stronger.)
|
|
8985
|
+
*/
|
|
8986
|
+
let refSelectedObjIdx=null;
|
|
8987
|
+
/**
|
|
8988
|
+
* Which property-set groups the user has opened, PER OBJECT.
|
|
8989
|
+
*
|
|
8990
|
+
* `refId|objectIndex` → the set of open group indices. Group INDICES, because a set's name is neither
|
|
8991
|
+
* unique nor always present (`null` when the file omits it).
|
|
8992
|
+
*
|
|
8993
|
+
* PER OBJECT, NOT "THE LAST OBJECT". A single Set with a key beside it was the first cut, and the
|
|
8994
|
+
* independent QA pass failed it on exactly the sentence the QA script promises: close a group, look at
|
|
8995
|
+
* another object, come back — your choice is still yours. It was not; the key had moved on and the
|
|
8996
|
+
* default reopened it. Which is the right rule is not obvious in the abstract and is obvious in the
|
|
8997
|
+
* hand: an object you have already tidied should stay tidy, and what you opened on a DIFFERENT object
|
|
8998
|
+
* still says nothing about this one — this map gives both, where one Set could only give one.
|
|
8999
|
+
*
|
|
9000
|
+
* Unbounded by clicks and that is fine: an entry is two small integers' worth of state, and it lives
|
|
9001
|
+
* exactly as long as the page does.
|
|
9002
|
+
*/
|
|
9003
|
+
const refPsetOpen=new Map(); // key -> Set of open group indices; the key's ABSENCE means "never touched"
|
|
8802
9004
|
const refUnresolved=new Set(); // ids whose original file is missing from the project (relink case)
|
|
8803
9005
|
|
|
9006
|
+
/**
|
|
9007
|
+
* One geometry response, normalised for `refGeom` — the ONE place that shape is written.
|
|
9008
|
+
*
|
|
9009
|
+
* It used to be spelled out twice, at the two arrivals (the geometry route and the import), under a
|
|
9010
|
+
* comment asking that the two be kept identical. Review's point was that a comment is not a mechanism.
|
|
9011
|
+
*
|
|
9012
|
+
* BOTH `*Available` FLAGS DEFAULT TO `null`, NEVER `false`. An absent key means a server too old to
|
|
9013
|
+
* answer, which is exactly the "we cannot tell" state; `false` would claim the file records none, and
|
|
9014
|
+
* only the reader could know that. The server never sends `false` for `propertySetsAvailable` at all.
|
|
9015
|
+
*/
|
|
9016
|
+
function refGeomFrom(d){
|
|
9017
|
+
return {
|
|
9018
|
+
objects:d.objects||[],dropped:d.dropped||0,spanMm:d.spanMm||0,
|
|
9019
|
+
colorsAvailable:d.colorsAvailable===undefined?null:d.colorsAvailable,
|
|
9020
|
+
propertySetsAvailable:d.propertySetsAvailable===undefined?null:d.propertySetsAvailable,
|
|
9021
|
+
};
|
|
9022
|
+
}
|
|
8804
9023
|
function refList(){return Array.isArray(C.reference_models)?C.reference_models:[];}
|
|
8805
9024
|
function refById(id){return refList().find(r=>r&&r.id===id)||null;}
|
|
8806
9025
|
function refDisp(r){return (r&&r.display)||{};}
|
|
@@ -8813,7 +9032,13 @@ function pushReferences(){
|
|
|
8813
9032
|
id:r.id,name:r.name,placement:r.placement||null,display:refDisp(r),
|
|
8814
9033
|
objects:(refGeom.get(r.id)||{}).objects||[],
|
|
8815
9034
|
})));
|
|
8816
|
-
|
|
9035
|
+
// RE-ASSERT ONLY ON A REAL DIVERGENCE. The 3D layer preserves its own selection across the rebuild
|
|
9036
|
+
// above, and re-validates any object drilled into (`revalidateSubSelection`) — so an unconditional
|
|
9037
|
+
// `selectReference` here would UN-DRILL the user on every geometry arrival, and re-drilling by index
|
|
9038
|
+
// would re-select whatever landed in that slot after a re-read, which is the exact confusion the
|
|
9039
|
+
// re-validation exists to prevent. The one case worth fixing is the two genuinely disagreeing.
|
|
9040
|
+
const v=window.Steel3DView;
|
|
9041
|
+
if(refSelectedId&&v.selectReference&&(!v.selectedReference||v.selectedReference()!==refSelectedId))v.selectReference(refSelectedId);
|
|
8817
9042
|
}
|
|
8818
9043
|
|
|
8819
9044
|
/**
|
|
@@ -8844,7 +9069,7 @@ async function loadReferenceGeometry(id,opts){
|
|
|
8844
9069
|
// a row ends up claiming both "file missing" and "nothing to draw", or keeps a stale reason after a
|
|
8845
9070
|
// successful retry.
|
|
8846
9071
|
const only=(set)=>{for(const s of [refUnresolved,refFailed,refEmpty])if(s!==set)s.delete(id);};
|
|
8847
|
-
if(res.ok&&d.ok){refGeom.set(id,
|
|
9072
|
+
if(res.ok&&d.ok){refGeom.set(id,refGeomFrom(d));only(null);}
|
|
8848
9073
|
else if(d.code==='reference-unresolved'){only(refUnresolved);refUnresolved.add(id);}
|
|
8849
9074
|
else if(d.code==='reference-empty'){only(refEmpty);refEmpty.add(id);}
|
|
8850
9075
|
// An `else` is mandatory here: a 500 whose body is not JSON parses to `{}`, so without one a failed
|
|
@@ -8863,7 +9088,20 @@ async function loadReferenceGeometry(id,opts){
|
|
|
8863
9088
|
}
|
|
8864
9089
|
console.error('[reference] geometry fetch failed',id,e);
|
|
8865
9090
|
}
|
|
8866
|
-
|
|
9091
|
+
// `panel()` IS PART OF THE ARRIVAL, not an extra — but ONLY when the panel is showing an object out of
|
|
9092
|
+
// a reference, which is the only thing on it this arrival can have changed.
|
|
9093
|
+
//
|
|
9094
|
+
// The reload case is why it is needed: the panel tells the user "your reader may be too old — reload its
|
|
9095
|
+
// geometry", they do exactly that, the new read carries the properties AND keeps the same object (so
|
|
9096
|
+
// neither the selection callback nor the re-assert fires), and the panel goes on repeating the sentence
|
|
9097
|
+
// that sent them there. Following your own instruction and seeing nothing happen is the worst version of
|
|
9098
|
+
// this bug.
|
|
9099
|
+
//
|
|
9100
|
+
// The condition is why it is SAFE. `panel()` rebuilds the whole inspector, so an unconditional repaint
|
|
9101
|
+
// here destroys an in-progress edit: a member selected, a value half-typed and not yet blurred, and any
|
|
9102
|
+
// reference finishing its fetch removes the focused input and restores the old value. `loadAllReferences`
|
|
9103
|
+
// fires one of these per uncached reference at boot, so it is not a rare race. (Both halves: Codex.)
|
|
9104
|
+
finally{refLoading.delete(id);pushReferences();if(legendTab==='refs')renderRefsTab();if(refSelectedObjIdx!==null)panel();}
|
|
8867
9105
|
}
|
|
8868
9106
|
/** Pull every reference's geometry once the 3D view is up. Sequential: one AWARE run at a time anyway. */
|
|
8869
9107
|
async function loadAllReferences(){for(const r of refList())await loadReferenceGeometry(r.id);}
|
|
@@ -9010,7 +9248,7 @@ function buildRefRow(r){
|
|
|
9010
9248
|
:failed?failed+' — use ⋯ ▸ Reload its geometry to try again'
|
|
9011
9249
|
:empty?'The reader read this file but found nothing it could draw'
|
|
9012
9250
|
:(geom&&geom.dropped)?geom.dropped+' object'+(geom.dropped===1?'':'s')+' in this file carried no usable mesh, so they are not shown'
|
|
9013
|
-
:'Click to select the whole model';
|
|
9251
|
+
:'Click to select the whole model. Ctrl+click an object in 3D for just that one.';
|
|
9014
9252
|
row.appendChild(name);
|
|
9015
9253
|
|
|
9016
9254
|
// PERMANENT, not hover-revealed. A reference can arrive correctly sized and 74 m up, entirely
|
|
@@ -9035,8 +9273,9 @@ function buildRefRow(r){
|
|
|
9035
9273
|
|
|
9036
9274
|
row.addEventListener('click',()=>{
|
|
9037
9275
|
refSelectedId=refSelectedId===r.id?null:r.id;
|
|
9276
|
+
refSelectedObjIdx=null; // picking a WHOLE reference from the row leaves no object drilled into — same rule the 3D layer's `selectReference` follows, so the two surfaces cannot disagree
|
|
9038
9277
|
if(window.Steel3DView&&window.Steel3DView.selectReference)window.Steel3DView.selectReference(refSelectedId);
|
|
9039
|
-
renderRefsTab();});
|
|
9278
|
+
renderRefsTab();panel();});
|
|
9040
9279
|
return row;
|
|
9041
9280
|
}
|
|
9042
9281
|
|
|
@@ -9157,6 +9396,19 @@ function buildRefDetail(r){
|
|
|
9157
9396
|
:'Hiding this reference does not stop snapping to it — the cyan dot on the row does.';
|
|
9158
9397
|
wrap.appendChild(note);
|
|
9159
9398
|
|
|
9399
|
+
// WHERE DRILLING IS TAUGHT. Nothing on the canvas says Ctrl+click exists, and a tooltip cannot teach it
|
|
9400
|
+
// — a keyboard or screen-reader user never sees one, which is the same reasoning the note above is
|
|
9401
|
+
// written for. This detail block is already where this feature explains itself in plain text (once the
|
|
9402
|
+
// row is open), so the one sentence goes here rather than becoming a banner or a first-run toast.
|
|
9403
|
+
//
|
|
9404
|
+
// Gated on there being geometry: offering a gesture against a reference that draws nothing is an
|
|
9405
|
+
// instruction the user can only follow into silence.
|
|
9406
|
+
if(refGeom.has(r.id)){
|
|
9407
|
+
const drill=Object.assign(document.createElement('div'),{className:'dnote'});
|
|
9408
|
+
drill.textContent='Ctrl+click one object in the 3D view to select just that part of the file and read what the file says about it.';
|
|
9409
|
+
wrap.appendChild(drill);
|
|
9410
|
+
}
|
|
9411
|
+
|
|
9160
9412
|
// The TRUE size — measured off the geometry that is actually on screen, which is the only place this
|
|
9161
9413
|
// number can be honest. The import modal deliberately shows none: before tessellation the sole
|
|
9162
9414
|
// measurement available is the reader's own APPROXIMATE bbox, and that spans every point the file
|
|
@@ -9210,6 +9462,224 @@ function buildRefDetail(r){
|
|
|
9210
9462
|
return wrap;
|
|
9211
9463
|
}
|
|
9212
9464
|
|
|
9465
|
+
// ── The drilled-into reference object (S2 Stage A) ────────────────────────────────────────────────
|
|
9466
|
+
//
|
|
9467
|
+
// Ctrl+click one object inside a reference and this is what the Inspect panel shows: what the FILE says
|
|
9468
|
+
// about that object, read-only, in the file's own words. Nothing here is editable and nothing here is
|
|
9469
|
+
// ours — it never reaches the contract, the BOM, an export or the lock, exactly like the geometry it
|
|
9470
|
+
// describes.
|
|
9471
|
+
|
|
9472
|
+
/**
|
|
9473
|
+
* Plain English for an IFC type token, with the token itself kept beside it.
|
|
9474
|
+
*
|
|
9475
|
+
* TRANSLATED AND NOT REPLACED. "IFCWALLSTANDARDCASE" means nothing to the people this panel is written
|
|
9476
|
+
* for, and "Wall" alone quietly discards what the file actually said — which matters here more than
|
|
9477
|
+
* anywhere, because on a file like the Motebello sample the type is one of only two things that
|
|
9478
|
+
* distinguish one object from another. So both are shown, and an unmapped token degrades to a
|
|
9479
|
+
* title-cased version of itself rather than to a guess: a future entity reads as "Buildingelementproxy"
|
|
9480
|
+
* rather than as whatever this map last believed.
|
|
9481
|
+
*/
|
|
9482
|
+
const IFC_TYPE_WORDS={IFCBEAM:'Beam',IFCCOLUMN:'Column',IFCMEMBER:'Member',IFCPLATE:'Plate',IFCSLAB:'Slab',
|
|
9483
|
+
IFCWALL:'Wall',IFCWALLSTANDARDCASE:'Wall',IFCWINDOW:'Window',IFCDOOR:'Door',IFCRAILING:'Railing',
|
|
9484
|
+
IFCSTAIR:'Stair',IFCSTAIRFLIGHT:'Stair flight',IFCRAMP:'Ramp',IFCROOF:'Roof',IFCCOVERING:'Covering',
|
|
9485
|
+
IFCFOOTING:'Footing',IFCPILE:'Pile',IFCCURTAINWALL:'Curtain wall',IFCFURNISHINGELEMENT:'Furnishing',
|
|
9486
|
+
IFCFLOWTERMINAL:'Terminal fitting',IFCFLOWSEGMENT:'Duct or pipe segment',IFCFLOWFITTING:'Duct or pipe fitting',
|
|
9487
|
+
IFCDISCRETEACCESSORY:'Accessory',IFCMECHANICALFASTENER:'Fastener',IFCREINFORCINGBAR:'Reinforcing bar',
|
|
9488
|
+
IFCBUILDINGELEMENTPART:'Building element part',IFCBUILDINGELEMENTPROXY:'Generic element'};
|
|
9489
|
+
function ifcTypeWords(t){
|
|
9490
|
+
const k=String(t||'').trim().toUpperCase();
|
|
9491
|
+
if(!k)return null;
|
|
9492
|
+
if(IFC_TYPE_WORDS[k])return IFC_TYPE_WORDS[k];
|
|
9493
|
+
const bare=k.replace(/^IFC/,'');
|
|
9494
|
+
return bare?bare.charAt(0)+bare.slice(1).toLowerCase():null;
|
|
9495
|
+
}
|
|
9496
|
+
|
|
9497
|
+
/**
|
|
9498
|
+
* Is this a name, or is it the file's way of writing "nothing"?
|
|
9499
|
+
*
|
|
9500
|
+
* The Motebello sample names all nineteen of its objects `-`. Printing that as a headline reads as a
|
|
9501
|
+
* broken template rather than as "the author did not name this", so a string with no letter and no digit
|
|
9502
|
+
* is treated as no name at all — and what the file DID write is then stated in words underneath, because
|
|
9503
|
+
* hiding it would be this panel telling a smaller truth than the file did.
|
|
9504
|
+
*/
|
|
9505
|
+
function refObjNamed(n){return typeof n==='string'&&/[\p{L}\p{N}]/u.test(n);}
|
|
9506
|
+
|
|
9507
|
+
/** One `name: value` row. The FOUR value states are rendered differently ON PURPOSE — see the CSS. */
|
|
9508
|
+
function buildPropRow(prop){
|
|
9509
|
+
const row=document.createElement('div');row.className='psrow';
|
|
9510
|
+
row.appendChild(Object.assign(document.createElement('div'),{className:'psk',textContent:prop.name}));
|
|
9511
|
+
const v=document.createElement('div');
|
|
9512
|
+
// FOUR DIFFERENT FACTS, FOUR DIFFERENT SENTENCES. Each pair of them was, at some point on this branch,
|
|
9513
|
+
// rendered identically, and each collapse states something the file does not say:
|
|
9514
|
+
// a real value — printed verbatim, never parsed
|
|
9515
|
+
// `unreadable` — WE cannot render the shape the reader sent (a list, an enumerated value). A
|
|
9516
|
+
// statement about us. Was folded into null, which claimed the file left it blank.
|
|
9517
|
+
// `null` — the file records the property and gives it no value. A statement about the file.
|
|
9518
|
+
// `''` — the file records it as empty text. A different statement about the file.
|
|
9519
|
+
// `undefined` cannot reach here — `toPropertySets` normalises every value to `string|null` before it
|
|
9520
|
+
// leaves the server — so that arm is belt-and-braces, not a fifth state.
|
|
9521
|
+
if(prop.unreadable){v.className='psv psnone';v.textContent='— value in a form FloLess can’t show';}
|
|
9522
|
+
else if(prop.value===null||prop.value===undefined){v.className='psv psnone';v.textContent='— not recorded';}
|
|
9523
|
+
else if(prop.value===''){v.className='psv psempty';v.textContent='(empty text)';}
|
|
9524
|
+
else {v.className='psv';v.textContent=String(prop.value);}
|
|
9525
|
+
row.appendChild(v);
|
|
9526
|
+
return row;
|
|
9527
|
+
}
|
|
9528
|
+
|
|
9529
|
+
/**
|
|
9530
|
+
* One property set, as a collapsible group.
|
|
9531
|
+
*
|
|
9532
|
+
* COLLAPSED WHEN THERE IS MORE THAN ONE, expanded when there is exactly one: with a single group there
|
|
9533
|
+
* is nothing to choose between, and a click to reveal the only content would be a toll. The row count
|
|
9534
|
+
* sits in every header, so the shape of the object is legible without opening anything — which is what
|
|
9535
|
+
* makes collapsing-by-default a summary rather than a hiding place.
|
|
9536
|
+
*/
|
|
9537
|
+
function buildPsetGroup(set,i,total,key){
|
|
9538
|
+
const wrap=document.createElement('div');wrap.className='psetgrp';
|
|
9539
|
+
const chosen=refPsetOpen.get(key); // absent = the user has never touched THIS object's groups
|
|
9540
|
+
const open=chosen?chosen.has(i):total===1;
|
|
9541
|
+
const bodyId='pset-'+i;
|
|
9542
|
+
const hd=document.createElement('button');hd.type='button';hd.className='psethd';
|
|
9543
|
+
hd.setAttribute('aria-expanded',String(open));
|
|
9544
|
+
hd.setAttribute('aria-controls',bodyId); // the other half of #moreMenu's recipe, which the first cut copied without
|
|
9545
|
+
// `aria-hidden` on the chevron: it is decoration, and without this a screen reader announces
|
|
9546
|
+
// "black right-pointing small triangle" ahead of the set name on every single header. (Codex review.)
|
|
9547
|
+
const chev=Object.assign(document.createElement('span'),{className:'chev',textContent:'▸'});
|
|
9548
|
+
chev.setAttribute('aria-hidden','true');
|
|
9549
|
+
hd.append(chev,
|
|
9550
|
+
Object.assign(document.createElement('span'),{className:'psn',textContent:set.name||'Unnamed property set'}),
|
|
9551
|
+
Object.assign(document.createElement('span'),{className:'psc',textContent:String(set.properties.length)}));
|
|
9552
|
+
hd.dataset.tip=(set.name||'This set has no name in the file')+' — '+set.properties.length+' propert'+(set.properties.length===1?'y':'ies')+' the file records for this object';
|
|
9553
|
+
const body=document.createElement('div');body.className='psetbody'+(open?' open':'');body.id=bodyId;
|
|
9554
|
+
for(const prop of set.properties)body.appendChild(buildPropRow(prop));
|
|
9555
|
+
hd.addEventListener('click',()=>{
|
|
9556
|
+
const now=!body.classList.contains('open');
|
|
9557
|
+
body.classList.toggle('open',now);hd.setAttribute('aria-expanded',String(now));
|
|
9558
|
+
// The first interaction on THIS object takes the default off the table, seeding the set with what the
|
|
9559
|
+
// default was showing — otherwise closing the only group of a one-group object would re-open it on the
|
|
9560
|
+
// very next repaint, and opening one of six would close again on the next repaint.
|
|
9561
|
+
let s=refPsetOpen.get(key);
|
|
9562
|
+
if(!s){s=new Set();if(total===1)s.add(0);refPsetOpen.set(key,s);}
|
|
9563
|
+
if(now)s.add(i);else s.delete(i);
|
|
9564
|
+
});
|
|
9565
|
+
wrap.append(hd,body);
|
|
9566
|
+
return wrap;
|
|
9567
|
+
}
|
|
9568
|
+
|
|
9569
|
+
/**
|
|
9570
|
+
* The Inspect panel for one object inside a reference model.
|
|
9571
|
+
*
|
|
9572
|
+
* RETURNS FALSE RATHER THAN RENDERING A HOLE when the selection cannot be resolved — a reference whose
|
|
9573
|
+
* geometry has been dropped, an index past the end after a re-read. `panel()` then falls through to
|
|
9574
|
+
* whatever it would otherwise have shown, which is the honest outcome: we no longer know what was
|
|
9575
|
+
* selected, so we say nothing about it rather than something empty under a confident heading.
|
|
9576
|
+
*/
|
|
9577
|
+
function renderPanelReferenceObject(p){
|
|
9578
|
+
const r=refById(refSelectedId);if(!r)return false;
|
|
9579
|
+
const g=refGeom.get(refSelectedId);if(!g||!Array.isArray(g.objects))return false;
|
|
9580
|
+
const o=g.objects[refSelectedObjIdx];if(!o)return false;
|
|
9581
|
+
|
|
9582
|
+
const key=refSelectedId+'|'+refSelectedObjIdx; // `refPsetOpen` is keyed by this; nothing to reset
|
|
9583
|
+
p.replaceChildren();
|
|
9584
|
+
|
|
9585
|
+
p.appendChild(Object.assign(document.createElement('span'),{className:'badge',textContent:'Reference object'}));
|
|
9586
|
+
const chipRow=document.createElement('div');chipRow.className='row';chipRow.style.margin='0 0 6px';
|
|
9587
|
+
// The NEUTRAL chip, deliberately. The brand-bordered variant is this panel's "you can act on this"
|
|
9588
|
+
// signal (the parametric-connection chip wears it); borrowing it for borrowed geometry would say the
|
|
9589
|
+
// one thing about a reference that must never be said.
|
|
9590
|
+
const chip=Object.assign(document.createElement('span'),{className:'chip',textContent:'Somebody else’s IFC — read-only'});
|
|
9591
|
+
chip.style.borderColor='var(--line)';chip.style.color='var(--mut)';
|
|
9592
|
+
chipRow.appendChild(chip);p.appendChild(chipRow);
|
|
9593
|
+
|
|
9594
|
+
const named=refObjNamed(o.name);
|
|
9595
|
+
// Trimmed for the same reason the identity line below is: this file pads fields to a fixed width, and a
|
|
9596
|
+
// headline of eighty spaces followed by a word is a broken-looking panel, not a faithful one.
|
|
9597
|
+
p.appendChild(Object.assign(document.createElement('div'),{className:'robjname',textContent:named?String(o.name).trim():'Unnamed object'}));
|
|
9598
|
+
|
|
9599
|
+
const fact=(s)=>(typeof s==='string'&&s.trim()?s.trim():null);
|
|
9600
|
+
const words=ifcTypeWords(o.ifcType);
|
|
9601
|
+
const meta=[];
|
|
9602
|
+
// The TYPE token is trimmed too. It is the one identity field the first cut left raw, on the grounds
|
|
9603
|
+
// that a schema token cannot be padded — which is exactly the assumption the material field disproved
|
|
9604
|
+
// on this very file. Same rule everywhere is cheaper than a rule with one exception. (Code review.)
|
|
9605
|
+
const typeTok=fact(o.ifcType);
|
|
9606
|
+
if(words)meta.push(typeTok&&typeTok.toUpperCase()!==words.toUpperCase()?words+' ('+typeTok+')':words);
|
|
9607
|
+
// TRIMMED, AND A BLANK STRING IS ABSENT. Twelve of the Motebello sample's nineteen objects carry a
|
|
9608
|
+
// material of EIGHTY SPACES — a fixed-width field written out verbatim, which is a real thing IFC
|
|
9609
|
+
// authoring tools do. Truthiness alone accepted it, and the identity line rendered "… · BA-E05 · " with
|
|
9610
|
+
// a dangling separator and a paragraph of whitespace after it. Only a run against the real file could
|
|
9611
|
+
// have found that, which is the argument for the run.
|
|
9612
|
+
//
|
|
9613
|
+
// Trimming for DISPLAY is safe here in a way it would not be for a property value: this line is an
|
|
9614
|
+
// identity summary, and leading or trailing spaces on a storey name carry nothing a user can act on.
|
|
9615
|
+
// The property panel below still prints values exactly as the file wrote them.
|
|
9616
|
+
for(const f of [fact(o.storey),fact(o.profile),fact(o.material)])if(f)meta.push(f);
|
|
9617
|
+
// OMITTED, NOT BLANK. A "Storey —" row for a file that records no storey is a field the user could try
|
|
9618
|
+
// to fill; there is nothing here they can fill, so an absent fact is simply absent.
|
|
9619
|
+
// `robjmeta` / `robjnone` below are addressable on purpose: what this panel can get wrong is a
|
|
9620
|
+
// SENTENCE, and a test that reads the whole panel as one string cannot tell "the storey line is absent"
|
|
9621
|
+
// from "the storey line says something else that happens not to contain the storey". A mutation pass
|
|
9622
|
+
// found exactly that hole in both places.
|
|
9623
|
+
if(meta.length){const m=Object.assign(document.createElement('div'),{className:'hint robjmeta'});m.style.margin='0 0 4px';m.textContent=meta.join(' · ');p.appendChild(m);}
|
|
9624
|
+
|
|
9625
|
+
const inRef=Object.assign(document.createElement('div'),{className:'hint'});
|
|
9626
|
+
inRef.style.cssText='margin:0 0 2px;font-size:11px';
|
|
9627
|
+
inRef.textContent='In “'+r.name+'”';
|
|
9628
|
+
p.appendChild(inRef);
|
|
9629
|
+
// Say what the file wrote even where we refused to use it as a headline — this panel must never claim
|
|
9630
|
+
// to know less than the file does.
|
|
9631
|
+
if(!named&&typeof o.name==='string'&&o.name.trim()){
|
|
9632
|
+
const n=Object.assign(document.createElement('div'),{className:'hint'});
|
|
9633
|
+
n.style.cssText='margin:0 0 2px;font-size:11px';
|
|
9634
|
+
n.textContent='The file names it “'+o.name+'”.';
|
|
9635
|
+
p.appendChild(n);
|
|
9636
|
+
}
|
|
9637
|
+
const escNote=Object.assign(document.createElement('div'),{className:'hint'});
|
|
9638
|
+
escNote.style.cssText='margin:0 0 6px;font-size:11px';
|
|
9639
|
+
escNote.append(Object.assign(document.createElement('b'),{textContent:'Esc'}),document.createTextNode(' steps back to the whole reference.'));
|
|
9640
|
+
p.appendChild(escNote);
|
|
9641
|
+
|
|
9642
|
+
const div=document.createElement('div');div.className='divrow';div.appendChild(document.createElement('hr'));p.appendChild(div);
|
|
9643
|
+
|
|
9644
|
+
const sets=Array.isArray(o.propertySets)?o.propertySets:null;
|
|
9645
|
+
if(sets&&sets.length){
|
|
9646
|
+
if(!named){
|
|
9647
|
+
const why=Object.assign(document.createElement('div'),{className:'hint'});
|
|
9648
|
+
why.style.cssText='margin:0 0 6px;font-size:11px';
|
|
9649
|
+
why.textContent='This file didn’t give it a name — the property sets below are what tell it apart from the other objects in “'+r.name+'”.';
|
|
9650
|
+
p.appendChild(why);
|
|
9651
|
+
}
|
|
9652
|
+
sets.forEach((s,i)=>p.appendChild(buildPsetGroup(s,i,sets.length,key)));
|
|
9653
|
+
return true;
|
|
9654
|
+
}
|
|
9655
|
+
|
|
9656
|
+
const none=Object.assign(document.createElement('div'),{className:'hint robjnone'});
|
|
9657
|
+
none.style.fontSize='11px';
|
|
9658
|
+
// THE THREE-STATE ANSWER, and the two branches are the difference between a fact and a guess. `true`
|
|
9659
|
+
// means this read carried properties, so an object without any genuinely has none and saying so is a
|
|
9660
|
+
// fact. `null` means nobody could tell us — the file may record none, or the IFC reader may be too old
|
|
9661
|
+
// to send them — and "this model has no properties" would then be a false sentence about a fixable
|
|
9662
|
+
// state. So that branch names the fix, in the words the References tab already uses for its sibling
|
|
9663
|
+
// failure ("use ⋯ ▸ Reload its geometry to try again").
|
|
9664
|
+
//
|
|
9665
|
+
// AND THE FILE-WIDE FLAG IS NOT A PER-OBJECT FACT. `propertySetsAvailable` is `true` the moment ANY
|
|
9666
|
+
// object in the read carried usable sets; spending it on THIS object would state "the file attached
|
|
9667
|
+
// none" over an object whose sets we ourselves refused, because some other object's happened to be well
|
|
9668
|
+
// formed. `propertySetsRefused` is the per-object receipt that closes it. (Code review.)
|
|
9669
|
+
// "OFFERS PROPERTY INFORMATION", not "records properties". The receipt says the reader handed over
|
|
9670
|
+
// something set-shaped that we could not use — which includes a set with no usable properties in it,
|
|
9671
|
+
// and for that "the file records properties" would be a claim the evidence does not carry. (Codex.)
|
|
9672
|
+
if(o.propertySetsRefused)none.textContent='This file offers property information for this object that FloLess could not read — so none is shown rather than some of it guessed at.';
|
|
9673
|
+
else if(g.propertySetsAvailable===true)none.textContent='This object carries no properties. The file simply didn’t attach any to it.';
|
|
9674
|
+
// A LOCKED REFERENCE CANNOT BE RELOADED — the ⋯ item refuses it outright — so offering that as the
|
|
9675
|
+
// remedy would send the user to a dead end. Name the extra step instead of omitting the offer: unlike
|
|
9676
|
+
// the row menu's own hidden items, there IS something the user can do here.
|
|
9677
|
+
else none.textContent='This file’s properties couldn’t be read — that could mean the file records none, or that your IFC reader is too old to send them. In the References list (bottom left), open “'+r.name+'” ▸ ⋯ ▸ Reload its geometry to check with today’s reader.'
|
|
9678
|
+
+(refDisp(r).locked?' It is locked, so switch Locked off first.':'');
|
|
9679
|
+
p.appendChild(none);
|
|
9680
|
+
return true;
|
|
9681
|
+
}
|
|
9682
|
+
|
|
9213
9683
|
/** A file size a human recognises from their file manager. KB under a megabyte, MB above it. */
|
|
9214
9684
|
function fileSizeWords(bytes){
|
|
9215
9685
|
const n=Number(bytes)||0;
|
|
@@ -9302,8 +9772,8 @@ async function refRemove(r){
|
|
|
9302
9772
|
adoptReferenceWrite(d.etag);
|
|
9303
9773
|
const i=refList().findIndex(x=>x&&x.id===r.id);if(i>=0)C.reference_models.splice(i,1);
|
|
9304
9774
|
refGeom.delete(r.id);refUnresolved.delete(r.id);refFailed.delete(r.id);refEmpty.delete(r.id);
|
|
9305
|
-
if(refSelectedId===r.id)refSelectedId=null;
|
|
9306
|
-
pushReferences();renderRefsTab();
|
|
9775
|
+
if(refSelectedId===r.id){refSelectedId=null;refSelectedObjIdx=null;} // the object drilled into goes with the reference it was inside — leaving the index behind would point the panel into a reference that no longer exists
|
|
9776
|
+
pushReferences();renderRefsTab();panel();
|
|
9307
9777
|
}catch(_){toast('Could not remove that reference');}
|
|
9308
9778
|
}
|
|
9309
9779
|
|
|
@@ -9321,8 +9791,24 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
9321
9791
|
// `riProbeCentre` is reset alongside the rest on every open — it used to survive from the PREVIOUS
|
|
9322
9792
|
// file, which only failed to matter because `riInsert` bails on a missing `riSha`.
|
|
9323
9793
|
let riSha=null,riName='',riVerdict=null,riProbeCentre=null,riSoftT=null,riBusy=false;
|
|
9794
|
+
// ── ONE ATTEMPT'S IDENTITY (#580) ────────────────────────────────────────────────────────────────
|
|
9795
|
+
// `riRun` names the current attempt and `riAbort` is its escape hatch. Both exist because Cancel
|
|
9796
|
+
// used to only HIDE the modal: the upload kept going, and when the abandoned probe finally answered
|
|
9797
|
+
// it wrote its results into whatever the modal was showing by then. The independent QA pass caught
|
|
9798
|
+
// exactly that — cancel a 66 MB file, drop an 18 KB one, and be shown the big file's "5878 objects"
|
|
9799
|
+
// above the small file's name, one click away from adding the wrong thing.
|
|
9800
|
+
//
|
|
9801
|
+
// AND ABORTING IS NOT MERELY TIDY. The server cancels a reader run when its client disconnects, and
|
|
9802
|
+
// that guard could never fire from this UI, because the browser never disconnected — Cancel left the
|
|
9803
|
+
// request in flight, so a cancelled 66 MB read went on holding the single run lock for its full
|
|
9804
|
+
// duration and the next import queued behind the file the user had just given up on.
|
|
9805
|
+
let riRun=0,riAbort=null;
|
|
9806
|
+
/** End the current attempt: nothing it started may touch the modal, and its upload stops now. */
|
|
9807
|
+
const riStop=()=>{riRun++;if(riAbort){try{riAbort.abort();}catch(_){/* already settled */}riAbort=null;}};
|
|
9324
9808
|
const riClearSoft=()=>{if(riSoftT){clearTimeout(riSoftT);riSoftT=null;}};
|
|
9809
|
+
let riStageNow='drop';
|
|
9325
9810
|
const riStage=s=>{ // 'drop' | 'prog' | 'confirm'
|
|
9811
|
+
riStageNow=s;
|
|
9326
9812
|
ri$('riDropStage').style.display=s==='drop'?'':'none';
|
|
9327
9813
|
ri$('riProgStage').style.display=s==='prog'?'':'none';
|
|
9328
9814
|
ri$('riConfirmStage').style.display=s==='confirm'?'':'none';
|
|
@@ -9336,10 +9822,11 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
9336
9822
|
function openRefImport(){
|
|
9337
9823
|
if(!MODEL_V2){toast('Reference models need this project on the model-level contract');return;}
|
|
9338
9824
|
if(!view3d){toast('Switch to the 3D view to add a reference model');return;}
|
|
9825
|
+
riStop(); // a previous attempt's in-flight probe must not answer into this one
|
|
9339
9826
|
riSha=null;riName='';riVerdict=null;riProbeCentre=null;riErr('');ri$('riDrop').classList.remove('drag');
|
|
9340
9827
|
riStage('drop');ri$('refImportModal').style.display='flex';}
|
|
9341
9828
|
window.openRefImport=openRefImport;
|
|
9342
|
-
function riClose(){riClearSoft();ri$('refImportModal').style.display='none';}
|
|
9829
|
+
function riClose(){riStop();riClearSoft();ri$('refImportModal').style.display='none';}
|
|
9343
9830
|
|
|
9344
9831
|
const RI_MAX_BYTES=150*1024*1024; // mirrors MAX_BYTES in server/reference-import.ts (pinned by the parity test)
|
|
9345
9832
|
function riReadFile(f){ if(!f||riBusy)return;riErr('');
|
|
@@ -9347,19 +9834,28 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
9347
9834
|
if(f.size>RI_MAX_BYTES){riErr('“'+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;}
|
|
9348
9835
|
riName=f.name;
|
|
9349
9836
|
const fr=new FileReader();
|
|
9350
|
-
|
|
9351
|
-
|
|
9837
|
+
// The read itself is async, so it is part of the attempt: a 66 MB file still being turned into a
|
|
9838
|
+
// data URL when the user hits Cancel must not go on to probe.
|
|
9839
|
+
const mine=riRun;
|
|
9840
|
+
fr.onerror=()=>{if(mine!==riRun)return;riStage('drop');riErr('Could not read that file.');};
|
|
9841
|
+
fr.onload=()=>{if(mine!==riRun)return;riProbe(String(fr.result||''),f,mine);};
|
|
9352
9842
|
riStage('prog');riProg('Reading “'+f.name+'”…');
|
|
9353
9843
|
fr.readAsDataURL(f);}
|
|
9354
9844
|
|
|
9355
|
-
async function riProbe(dataUrl,f){
|
|
9845
|
+
async function riProbe(dataUrl,f,mine){
|
|
9356
9846
|
riProg('Checking what “'+f.name+'” says about itself…','Still checking — a large model takes a moment.');
|
|
9847
|
+
riAbort=new AbortController();
|
|
9848
|
+
const signal=riAbort.signal;
|
|
9357
9849
|
try{
|
|
9358
|
-
const res=await fetch(refApi('/probe'),{method:'POST',headers:{'content-type':'application/json'},
|
|
9850
|
+
const res=await fetch(refApi('/probe'),{method:'POST',signal,headers:{'content-type':'application/json'},
|
|
9359
9851
|
// The model's CENTRE rides along with its span: "off-screen" is a question about the distance
|
|
9360
9852
|
// between the reference and the steel, and the server has no other way to know where the steel is.
|
|
9361
9853
|
body:JSON.stringify({dataUrl,name:f.name,nativeSpan:nativeModelSpan(),nativeCenter:nativeModelCentre()})});
|
|
9362
9854
|
const d=await res.json().catch(()=>({}));
|
|
9855
|
+
// THE ANSWER IS ONLY OURS IF THE ATTEMPT IS STILL THE CURRENT ONE. Abort is best-effort — a
|
|
9856
|
+
// response already on the wire lands anyway — so the id is what actually stops a cancelled
|
|
9857
|
+
// file's facts being written under a different file's name.
|
|
9858
|
+
if(mine!==riRun)return;
|
|
9363
9859
|
riClearSoft();
|
|
9364
9860
|
if(!res.ok||!d.ok){riStage('drop');riErr(d.error||'Could not read that file.');return;}
|
|
9365
9861
|
riSha=d.sha;riVerdict=d.verdict||null;
|
|
@@ -9376,7 +9872,11 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
9376
9872
|
ri$('riBytes').textContent=fileSizeWords(d.bytes||0);
|
|
9377
9873
|
riShowVerdict(d.warn,d.bytes);
|
|
9378
9874
|
riStage('confirm');
|
|
9379
|
-
}catch(
|
|
9875
|
+
}catch(e){
|
|
9876
|
+
// An abort is the user's own Cancel, not a failure to report at them.
|
|
9877
|
+
if(mine!==riRun||(e&&e.name==='AbortError'))return;
|
|
9878
|
+
riClearSoft();riStage('drop');riErr('Could not reach the reader — check the app is running.');}
|
|
9879
|
+
finally{if(mine===riRun)riAbort=null;}}
|
|
9380
9880
|
|
|
9381
9881
|
/** The advisory. AMBER, never red: a scale or position guess is an offer, not something being broken. */
|
|
9382
9882
|
function riShowVerdict(warn,bytes){
|
|
@@ -9401,7 +9901,21 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
9401
9901
|
|
|
9402
9902
|
async function riInsert(){
|
|
9403
9903
|
if(!riSha||riBusy)return;riBusy=true;
|
|
9404
|
-
|
|
9904
|
+
// The insert is the SAME attempt as the probe that fed it, and Cancel stays visible for the whole
|
|
9905
|
+
// of it (the ✕ is hidden mid-run precisely so Cancel owns the exit). Without an identity, hitting
|
|
9906
|
+
// Cancel while "Reading the geometry…" was showing hid the modal and then committed the reference
|
|
9907
|
+
// anyway — the one outcome a Cancel must never produce.
|
|
9908
|
+
//
|
|
9909
|
+
// WHAT THE SERVER GUARANTEES, stated precisely rather than optimistically (an earlier version of
|
|
9910
|
+
// this comment claimed a cancelled insert "leaves nothing behind", which is not what the staged
|
|
9911
|
+
// order buys on its own): the route asks whether we have gone after the read and again inside the
|
|
9912
|
+
// project lock, and refuses to commit if we have — so an abort before that last check leaves the
|
|
9913
|
+
// copy rolled back and nothing written. It cannot refuse in the sliver between committing and its
|
|
9914
|
+
// response reaching us; that one is handled below, by releasing the claim so the broadcast lands.
|
|
9915
|
+
const mine=riRun;
|
|
9916
|
+
riAbort=new AbortController();
|
|
9917
|
+
const signal=riAbort.signal;
|
|
9918
|
+
let inserted=null,d=null,hadDrill=false; // `hadDrill` is read by the presentation half below, after the insert has already cleared the index
|
|
9405
9919
|
const takeOrigin=!!ri$('riVerdict').querySelector('button.on')&&riVerdict&&riVerdict.offscreen;
|
|
9406
9920
|
// Computed from the PROBE's own centre, which is what the offer was based on, and TOWARDS THE
|
|
9407
9921
|
// MODEL'S CENTRE rather than the world origin — the same correction `refMoveToOrigin` carries, for
|
|
@@ -9414,23 +9928,39 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
9414
9928
|
riStage('prog');riProg('Reading the geometry…','Still reading — a whole building takes a moment.');
|
|
9415
9929
|
try{
|
|
9416
9930
|
const mid=newMutationId();claimMutation(mid);
|
|
9417
|
-
const res=await fetch(refApi(''),{method:'POST',headers:{'content-type':'application/json','x-floless-mutation-id':mid},
|
|
9931
|
+
const res=await fetch(refApi(''),{method:'POST',signal,headers:{'content-type':'application/json','x-floless-mutation-id':mid},
|
|
9418
9932
|
// The placement rides the INSERT, so the choice the user made in the modal is committed with
|
|
9419
9933
|
// the reference rather than by a debounced PUT afterwards. Applying it in the presentation
|
|
9420
9934
|
// block left it outside the point of no return: a closed tab or a save conflict would leave
|
|
9421
9935
|
// the server holding the site coordinates the user had just asked to move away from.
|
|
9422
9936
|
body:JSON.stringify({sha:riSha,name:riName,...(takeOrigin&&riOriginShift?{placement:{origin:riOriginShift}}:{})})});
|
|
9423
9937
|
d=await res.json().catch(()=>({}));
|
|
9938
|
+
if(mine!==riRun){
|
|
9939
|
+
// Cancelled while this was in flight. The server refuses to commit for a client that has gone
|
|
9940
|
+
// — it asks twice, after the read and again inside the project lock — but it cannot refuse in
|
|
9941
|
+
// the sliver between committing and this response reaching us, so that sliver is handled here
|
|
9942
|
+
// rather than asserted away. RELEASING THE CLAIM is what handles it: the id was claimed so our
|
|
9943
|
+
// own echo would not be replayed at us, and if the write DID land, suppressing its broadcast
|
|
9944
|
+
// is precisely what would leave a reference committed on disk and invisible in the editor —
|
|
9945
|
+
// where the next full save could quietly drop it. Released, the broadcast reconciles instead.
|
|
9946
|
+
releaseMutation(mid);
|
|
9947
|
+
return;
|
|
9948
|
+
}
|
|
9424
9949
|
riClearSoft();
|
|
9425
9950
|
if(!res.ok||!d.ok){riStage('drop');riErr(d.error||'Could not add that reference.');return;}
|
|
9426
9951
|
adoptReferenceWrite(d.etag);
|
|
9427
9952
|
if(!Array.isArray(C.reference_models))C.reference_models=[];
|
|
9428
9953
|
C.reference_models.push(d.reference);
|
|
9429
|
-
refGeom.set(d.reference.id,
|
|
9430
|
-
|
|
9954
|
+
refGeom.set(d.reference.id,refGeomFrom(d)); // the same normaliser the geometry route's arrival uses — one shape, one spelling
|
|
9955
|
+
hadDrill=refSelectedObjIdx!==null; // …before this line drops it; the presentation half below needs to know
|
|
9956
|
+
refSelectedId=d.reference.id;refSelectedObjIdx=null;
|
|
9431
9957
|
inserted=d.reference;
|
|
9432
|
-
}catch(e){
|
|
9433
|
-
|
|
9958
|
+
}catch(e){
|
|
9959
|
+
// Aborted: no response at all, so we cannot know whether the write landed. Same reasoning as
|
|
9960
|
+
// above — release the claim so a broadcast that does arrive is applied rather than swallowed.
|
|
9961
|
+
if(mine!==riRun||(e&&e.name==='AbortError')){releaseMutation(mid);return;}
|
|
9962
|
+
riClearSoft();riStage('drop');riErr('Could not add that reference.');console.error('[reference] insert failed',e);return;}
|
|
9963
|
+
finally{riBusy=false;if(mine===riRun)riAbort=null;}
|
|
9434
9964
|
// ── PAST THE POINT OF NO RETURN. Everything above is the transaction; everything below is showing
|
|
9435
9965
|
// it. They were one try, and a throw in the presentation half ran riErr() on a modal riClose() had
|
|
9436
9966
|
// already hidden — so the user saw NOTHING while the reference was committed and on disk, and the
|
|
@@ -9445,13 +9975,26 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
9445
9975
|
// WITH the insert — see the request body — so there is nothing to apply here.)
|
|
9446
9976
|
if(window.Steel3DView&&window.Steel3DView.frameReference)window.Steel3DView.frameReference(inserted.id);
|
|
9447
9977
|
renderRefsTab();
|
|
9978
|
+
// AND REPAINT THE INSPECT PANEL — but only if it was showing an object. The import wrote
|
|
9979
|
+
// `refSelectedId`/`refSelectedObjIdx` itself before `pushReferences`, so by the time the 3D layer
|
|
9980
|
+
// selects the new reference the editor state already matches and `onReferenceSelect` returns early
|
|
9981
|
+
// without repainting. Drill into an object, import a second reference, and the panel would go on
|
|
9982
|
+
// describing the object inside the FIRST one while everything else on screen had moved to the new
|
|
9983
|
+
// file. Gated for the same reason the geometry arrival is: an unconditional repaint here would
|
|
9984
|
+
// throw away whatever else the inspector was in the middle of. (Codex review, both halves.)
|
|
9985
|
+
if(hadDrill)panel();
|
|
9448
9986
|
toast('Added “'+inserted.name+'” as a reference'+(d.dropped?' ('+d.dropped+' object'+(d.dropped===1?'':'s')+' had nothing to draw)':''));
|
|
9449
9987
|
}catch(e){
|
|
9450
9988
|
console.error('[reference] added, but the view could not be updated',e);
|
|
9451
9989
|
toast('Added “'+inserted.name+'” — reload the view to see it');
|
|
9452
9990
|
}}
|
|
9453
9991
|
|
|
9454
|
-
ri$('riClose').onclick=riClose;ri$('riCancel').onclick=riClose;
|
|
9992
|
+
ri$('riClose').onclick=riClose;ri$('riCancel').onclick=riClose;
|
|
9993
|
+
// THE BACKDROP IS NOT AN EXIT MID-RUN. `riStage` hides the ✕ during 'prog' so that Cancel owns the
|
|
9994
|
+
// exit — and the backdrop, a full-viewport overlay that looks like nothing at all, quietly offered
|
|
9995
|
+
// the same abort to a stray click just outside the panel. Hiding one of two identical exits and
|
|
9996
|
+
// leaving the invisible one is the version of that rule that does not hold. (UX review, #580.)
|
|
9997
|
+
ri$('riBackdrop').onclick=()=>{if(riStageNow!=='prog')riClose();};
|
|
9455
9998
|
ri$('riInsert').onclick=riInsert;
|
|
9456
9999
|
ri$('riDrop').onclick=()=>ri$('riFile').click();
|
|
9457
10000
|
ri$('riDrop').onkeydown=e=>{if(e.key==='Enter'||e.key===' '){e.preventDefault();ri$('riFile').click();}};
|