@floless/app 0.122.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 +2418 -2113
- package/dist/schemas/steel.model.v2.schema.json +3 -1
- package/dist/schemas/steel.takeoff.v1.schema.json +1 -0
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +332 -37
- package/dist/web/app.css +74 -17
- package/dist/web/app.js +2 -1
- package/dist/web/grid-core.js +11 -1
- package/dist/web/steel-3d-core.js +10 -6
- package/dist/web/steel-3d-view.js +626 -35
- package/dist/web/steel-editor.html +708 -34
- package/dist/web/steel-filter-core.js +61 -0
- package/dist/web/steel-filter.html +17 -2
- package/dist/web/steel-model-adapter.js +16 -18
- package/dist/web/steel-model-commands.js +4 -4
- package/dist/web/steel-plan-transform.js +8 -6
- package/dist/web/steel-view-generation.js +0 -2
- package/dist/web/vector-3d.html +33 -1
- package/dist/web/vector-editor.html +33 -1
- package/dist/web/workspaces.js +62 -83
- package/package.json +2 -1
|
@@ -72,6 +72,70 @@
|
|
|
72
72
|
body.panel-collapsed #panelToggle{right:4px}
|
|
73
73
|
aside h3{margin:0 0 8px;font-size:12px;color:var(--mut);text-transform:uppercase;letter-spacing:.05em}
|
|
74
74
|
select,input{background:#0f172a;color:var(--text);border:1px solid #475569;border-radius:6px;padding:6px;width:100%;font:13px system-ui}
|
|
75
|
+
/* The two control classes the generic rule above actively BREAKS, themed globally so anything added
|
|
76
|
+
later inherits the fix instead of needing its own escape hatch (CLAUDE.md "Style EVERY control").
|
|
77
|
+
Radios: with no accent-color a native radio paints in the LIGHT scheme on this dark page, and
|
|
78
|
+
`width:100%;padding:6px` above stretches it into a smear. Every checkbox in this file carries a
|
|
79
|
+
hand-written escape hatch for exactly that (.gck input, .m3dmenu label input, …); the two radios in
|
|
80
|
+
openCaptureModal/openDetailPick carried none. Numbers: the native spinner is drawn light too —
|
|
81
|
+
#confTarget suppressed it per-id and the three #csF3dFields origin inputs did not, which is the
|
|
82
|
+
per-container patching the scrollbar guard's history says never holds. Global, once, for both. */
|
|
83
|
+
/* appearance:none, NOT accent-color. accent-color only tints the CHECKED fill; the UNCHECKED radio
|
|
84
|
+
stays the UA widget — a solid white disc with a grey ring on this #070a0f page — and nothing here
|
|
85
|
+
declares `color-scheme`, so nothing pushes that widget dark. Measured in Chromium at 6x before
|
|
86
|
+
picking this route. So the radio is rebuilt the way app.css:1271 already builds .modal-check's
|
|
87
|
+
checkbox: own box, own ::before dot, :checked border, focus ring. */
|
|
88
|
+
input[type=radio]{appearance:none;-webkit-appearance:none;width:13px;height:13px;flex:none;padding:0;
|
|
89
|
+
border:1px solid #475569;border-radius:50%;background:#0f172a;cursor:pointer;display:inline-grid;place-content:center;
|
|
90
|
+
transition:border-color .12s} /* the ring animates WITH the dot, as app.css:1276 .modal-check already does — without this the border-colour snaps while the dot eases, which reads as two separate events (design review) */
|
|
91
|
+
input[type=radio]::before{content:'';width:7px;height:7px;border-radius:50%;background:var(--brand);transform:scale(0);transition:transform .12s ease}
|
|
92
|
+
input[type=radio]:checked{border-color:var(--brand)}
|
|
93
|
+
input[type=radio]:checked::before{transform:scale(1)}
|
|
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
|
+
}
|
|
137
|
+
input[type=number]{-moz-appearance:textfield;appearance:textfield}
|
|
138
|
+
input[type=number]::-webkit-outer-spin-button,input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
|
|
75
139
|
.row{margin:8px 0} .danger{background:#7f1d1d;border-color:#991b1b} .danger:hover{background:#991b1b}
|
|
76
140
|
.pill{display:inline-block;padding:1px 6px;border-radius:4px;font-size:11px}
|
|
77
141
|
.pill-clickable{cursor:pointer;text-decoration:underline dotted rgba(254,202,202,.55);text-underline-offset:2px}
|
|
@@ -165,7 +229,7 @@
|
|
|
165
229
|
.tfchip:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
|
|
166
230
|
.tfchip.tfdim{border-style:dashed}
|
|
167
231
|
.defck{display:inline-flex;align-items:center;gap:4px;font-size:10px;text-transform:uppercase;letter-spacing:.05em;color:var(--mut);cursor:pointer}
|
|
168
|
-
.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 */
|
|
169
233
|
input:disabled{opacity:.55;cursor:default}
|
|
170
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}
|
|
171
235
|
.pick{color:var(--brand)!important}
|
|
@@ -356,8 +420,10 @@
|
|
|
356
420
|
.mhead{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--line)}
|
|
357
421
|
.mhead b{font-size:14px} .mhead button{padding:2px 9px}
|
|
358
422
|
.conf-tgt{display:flex;align-items:center;gap:6px;margin-left:auto;margin-right:12px;font-size:12px;color:var(--mut)}
|
|
359
|
-
|
|
360
|
-
|
|
423
|
+
/* Layout only — the spinner suppression this used to carry per-id now lives on the global
|
|
424
|
+
input[type=number] rule near the top, which is what the three origin fields were missing. Leaving
|
|
425
|
+
the per-id copy here would just be the template for the next field to be patched one at a time. */
|
|
426
|
+
#confTarget{width:54px;text-align:right;padding:4px 6px;font:13px system-ui}
|
|
361
427
|
.mgrid{padding:14px;overflow:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(168px,1fr));gap:12px}
|
|
362
428
|
.dcard{border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--bg)}
|
|
363
429
|
.dcard .dprev{height:120px;display:flex;align-items:center;justify-content:center;background:#0b1220;color:var(--mut);font-size:11px;text-align:center;padding:8px;line-height:1.4}
|
|
@@ -481,6 +547,34 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
481
547
|
#panel .pintog.on .mck::after{transform:translateX(12px);background:var(--brand)}
|
|
482
548
|
#panel .pintog svg{margin-right:4px;color:#22d3ee;flex:none} /* the pin glyph carries the dim accent, matching the on-canvas markers */
|
|
483
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 */
|
|
484
578
|
#dimEditPop .dimEditTog:hover{border-color:var(--brand);color:var(--text)}
|
|
485
579
|
#dimEditPop .dimEditTog.on{border-color:var(--brand);background:rgba(59,130,246,.18);color:var(--text)}
|
|
486
580
|
#dimEditPop .dimEditTog.pin.on{border-color:#22d3ee;background:rgba(34,211,238,.16);color:var(--text)}
|
|
@@ -516,7 +610,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
516
610
|
.gerr{color:#fca5a5;font-size:11px;margin-top:3px}
|
|
517
611
|
.gbtns{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px} .gbtns button{margin:0}
|
|
518
612
|
.gck{display:flex;align-items:center;gap:8px;color:var(--text);cursor:pointer;font-size:12px;padding:2px 0}
|
|
519
|
-
.gck input{
|
|
613
|
+
.gck input{cursor:pointer;margin:0;width:14px;height:14px;flex:none} /* beat the panel's generic full-width input rule */
|
|
520
614
|
/* F11 generated views modal — baseline modal/tabs/inputs, sized for batch selection without crowding the 240px Views pane. */
|
|
521
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 */
|
|
522
616
|
#viewGenModal .mpanel{width:min(640px,92vw)}
|
|
@@ -532,7 +626,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
532
626
|
#vgList .vggroup{padding:5px 7px 3px;color:var(--mut);font-size:10px;text-transform:uppercase;letter-spacing:.07em}
|
|
533
627
|
#vgList .vgrow{display:flex;align-items:center;gap:9px;padding:6px 8px;border-radius:5px;cursor:pointer}
|
|
534
628
|
#vgList .vgrow:hover{background:#33415580}
|
|
535
|
-
#vgList .vgrow input{
|
|
629
|
+
#vgList .vgrow input{width:14px;height:14px;margin:0;flex:none}
|
|
536
630
|
#vgList .vgaxis{width:18px;color:var(--mut);font-size:10px;font-weight:700}
|
|
537
631
|
#vgList .vgname{color:var(--text);font-size:12px}
|
|
538
632
|
#vgList .vgempty{padding:28px 16px;text-align:center;color:var(--mut);font-size:12px;line-height:1.5}
|
|
@@ -640,7 +734,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
640
734
|
.m3dmenu hr{border:0;border-top:1px solid var(--line);margin:4px 0}
|
|
641
735
|
.m3dmenu label{display:flex;align-items:center;gap:7px;padding:7px 12px;color:var(--text);font-size:12px;cursor:pointer;white-space:nowrap}
|
|
642
736
|
.m3dmenu label:hover{background:#334155}
|
|
643
|
-
.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) */
|
|
644
738
|
.m3dmenu .wpprow{display:flex;gap:4px;align-items:center;padding:4px 12px}
|
|
645
739
|
.m3dmenu .wpprow button{width:auto;flex:none;padding:4px 8px;border:1px solid var(--line);border-radius:5px}
|
|
646
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}
|
|
@@ -664,7 +758,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
664
758
|
#propPop .pprow:hover{background:#334155}
|
|
665
759
|
#propPop .pprow.dis{opacity:.5;cursor:default}
|
|
666
760
|
#propPop .pprow.dis:hover{background:transparent}
|
|
667
|
-
#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 */
|
|
668
762
|
#propPop .pprow .pn{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
669
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}
|
|
670
764
|
#propPop .pprow .pv.varies{font-style:italic}
|
|
@@ -672,7 +766,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
672
766
|
#propPop .ppfoot{border-top:1px solid var(--line);padding:8px 10px;display:flex;flex-direction:column;gap:6px}
|
|
673
767
|
#propPop .ppfoot .seg2{margin-top:0}
|
|
674
768
|
#propPop .ppfoot label{display:flex;align-items:center;gap:7px;color:var(--text);cursor:pointer;font-size:11px}
|
|
675
|
-
#propPop .ppfoot label input{margin:0;
|
|
769
|
+
#propPop .ppfoot label input{margin:0;cursor:pointer;flex:none}
|
|
676
770
|
/* Connection read-only mode: no labeling, so hide the label footer + Clear-all; rows aren't clickable. */
|
|
677
771
|
#propPop.connmode .ppfoot{display:none}
|
|
678
772
|
#propPop.connmode #ppClear{display:none}
|
|
@@ -756,7 +850,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
756
850
|
than a new hue being invented. ── */
|
|
757
851
|
#refHeadRow{display:flex;align-items:stretch;gap:6px;margin-bottom:6px;flex:none}
|
|
758
852
|
#refAddBtn{flex:1;min-width:0;height:28px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
759
|
-
#m3dRefsBody .refempty
|
|
853
|
+
#m3dRefsBody .refempty{color:var(--mut);font-size:11px;line-height:1.5;padding:6px 4px}
|
|
760
854
|
#m3dRefsBody .refrow{display:flex;align-items:center;gap:6px;padding:3px 4px;border-radius:5px;cursor:pointer;user-select:none;white-space:nowrap}
|
|
761
855
|
#m3dRefsBody .refrow:hover{background:#33415580}
|
|
762
856
|
#m3dRefsBody .refrow.sel{box-shadow:inset 2px 0 0 var(--brand);background:rgba(59,130,246,.16);padding-left:2px}
|
|
@@ -785,6 +879,20 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
785
879
|
#m3dRefsBody .refdet .lockrow .mck::after{content:'';position:absolute;top:1px;left:1px;width:10px;height:10px;border-radius:50%;background:#64748b;transition:transform .15s,background-color .15s}
|
|
786
880
|
#m3dRefsBody .refdet .lockrow.on .mck{background:rgba(59,130,246,.28);border-color:var(--brand)}
|
|
787
881
|
#m3dRefsBody .refdet .lockrow.on .mck::after{transform:translateX(12px);background:var(--brand)}
|
|
882
|
+
/* ── Reference colour: File / Grey / your own.
|
|
883
|
+
THE SWATCH IS THE THIRD SEGMENT, not a control beside one. Picking a colour and choosing "custom"
|
|
884
|
+
are one decision, so they are one gesture — the native colour input IS the third pill, and its own
|
|
885
|
+
swatch chrome carries the chosen colour. `.swc` is 14x14 and `flex:none` for the profile legend, so
|
|
886
|
+
it is restretched here to fill its cell; everything else about it is inherited, which is what makes
|
|
887
|
+
this read as a sibling of the member-profile swatch rather than a new species of control.
|
|
888
|
+
Selection is `var(--brand)` exactly as `.seg2 button.on` already does — but as an inset RING on the
|
|
889
|
+
swatch, never a fill: filling it would hide the very colour it exists to show. */
|
|
890
|
+
#m3dRefsBody .refdet .seg2{margin-top:0;height:24px}
|
|
891
|
+
#m3dRefsBody .refdet .seg2 button{font-size:11px;padding:0}
|
|
892
|
+
#m3dRefsBody .refdet .seg2 .swc{flex:1;width:auto;height:100%;border:0;border-radius:0;min-width:0}
|
|
893
|
+
#m3dRefsBody .refdet .seg2 .swc.on{box-shadow:inset 0 0 0 2px var(--brand)}
|
|
894
|
+
#m3dRefsBody .refdet .colrow{display:flex;align-items:center;gap:6px}
|
|
895
|
+
#m3dRefsBody .refdet .colrow .seg2{flex:1;min-width:0}
|
|
788
896
|
/* ── Reference-model import modal (#refImportModal) — the #connImportModal recipe, under its own ids.
|
|
789
897
|
A sibling rather than a third stage inside it: that modal's last stage is "pick one of several
|
|
790
898
|
candidates found inside the file", and this one's is "confirm the one thing you are about to add",
|
|
@@ -1320,7 +1428,10 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1320
1428
|
<div id=riDropErr role=alert></div>
|
|
1321
1429
|
<input id=riFile type=file accept=".ifc,.ifczip" style="display:none">
|
|
1322
1430
|
</div>
|
|
1323
|
-
|
|
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>
|
|
1324
1435
|
<div id=riConfirmStage style="display:none">
|
|
1325
1436
|
<div id=riSays></div>
|
|
1326
1437
|
<div class=rirow><span class=pn>Schema</span><span class=pv id=riSchema>—</span></div>
|
|
@@ -4764,11 +4875,83 @@ function syncV2SelectionNotice(p){
|
|
|
4764
4875
|
else if(m&&canonical){mark('tosA',!Number.isFinite(canonical.from?.z?.known));mark('tosB',!Number.isFinite(canonical.to?.z?.known));}
|
|
4765
4876
|
}
|
|
4766
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
|
+
}
|
|
4767
4914
|
function panel(){
|
|
4768
4915
|
const p=document.getElementById('panel');
|
|
4769
4916
|
if(MODEL_V2)queueMicrotask(()=>syncV2SelectionNotice(p));
|
|
4770
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
|
|
4771
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;
|
|
4772
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;}
|
|
4773
4956
|
if(MODEL_RO){renderPanelV2(p);return;} // …after the grid panel, which is the one panel a v2 document does reach
|
|
4774
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
|
|
@@ -7875,7 +8058,31 @@ const view3dApi={
|
|
|
7875
8058
|
// one-way — the panel drives the 3D view but a pick in the 3D view leaves the panel showing the
|
|
7876
8059
|
// previous row, which is worse than no highlight because it is confidently wrong. Found by clicking
|
|
7877
8060
|
// the canvas for real; every panel-driven path had looked fine.
|
|
7878
|
-
|
|
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
|
+
},
|
|
7879
8086
|
onBasePickModeChange:()=>{}, // Mode B armed state shows via the 3D crosshair + elevation readout; nothing else to reflect
|
|
7880
8087
|
onBasePick:(p)=>{ // Mode B: retarget the armed column's base to the picked elevation (world mm → inches), ONE undo entry
|
|
7881
8088
|
const m=byId(basePickColId); if(!m||m.role!=='column'||!m.col){toast('No column to trim');return;}
|
|
@@ -8761,8 +8968,58 @@ const refLoading=new Set(); // ids with a geometry fetch in flight — the
|
|
|
8761
8968
|
const refFailed=new Map(); // id -> why its geometry could not be fetched (see loadReferenceGeometry)
|
|
8762
8969
|
const refEmpty=new Set(); // ids the reader answered for, with nothing drawable in the answer
|
|
8763
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"
|
|
8764
9004
|
const refUnresolved=new Set(); // ids whose original file is missing from the project (relink case)
|
|
8765
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
|
+
}
|
|
8766
9023
|
function refList(){return Array.isArray(C.reference_models)?C.reference_models:[];}
|
|
8767
9024
|
function refById(id){return refList().find(r=>r&&r.id===id)||null;}
|
|
8768
9025
|
function refDisp(r){return (r&&r.display)||{};}
|
|
@@ -8775,7 +9032,13 @@ function pushReferences(){
|
|
|
8775
9032
|
id:r.id,name:r.name,placement:r.placement||null,display:refDisp(r),
|
|
8776
9033
|
objects:(refGeom.get(r.id)||{}).objects||[],
|
|
8777
9034
|
})));
|
|
8778
|
-
|
|
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);
|
|
8779
9042
|
}
|
|
8780
9043
|
|
|
8781
9044
|
/**
|
|
@@ -8786,11 +9049,17 @@ function pushReferences(){
|
|
|
8786
9049
|
* what rebuilds it. That is also why nothing here blocks — the native steel is already on screen and
|
|
8787
9050
|
* the reference streams in behind it.
|
|
8788
9051
|
*/
|
|
8789
|
-
|
|
9052
|
+
// `rebuild` forces the SERVER to re-read the IFC instead of serving its cache. Clearing the client
|
|
9053
|
+
// maps alone is not a reload: the cache is keyed on the IFC bytes, which a bridge upgrade does not
|
|
9054
|
+
// change, so a reference read before colours existed would stay grey for ever however often you asked.
|
|
9055
|
+
async function loadReferenceGeometry(id,opts){
|
|
8790
9056
|
if(refGeom.has(id)||refLoading.has(id))return;
|
|
8791
9057
|
refLoading.add(id);if(legendTab==='refs')renderRefsTab();
|
|
8792
9058
|
try{
|
|
8793
|
-
|
|
9059
|
+
// INSIDE the suffix, not appended after. `refApi` already adds `?project=` and picks its own
|
|
9060
|
+
// separator from whether the suffix carries a `?` — appending afterwards produced a second `?`
|
|
9061
|
+
// and a 400, which is exactly what the browser pass caught.
|
|
9062
|
+
const res=await fetch(refApi('/'+encodeURIComponent(id)+'/geometry'+((opts&&opts.rebuild)?'?rebuild=1':'')));
|
|
8794
9063
|
const d=await res.json().catch(()=>({}));
|
|
8795
9064
|
// A LATE RESPONSE FOR A REMOVED REFERENCE IS DROPPED. These bodies can be hundreds of megabytes, and
|
|
8796
9065
|
// repopulating `refGeom` under an id the contract no longer holds leaks all of it while making the
|
|
@@ -8800,7 +9069,7 @@ async function loadReferenceGeometry(id){
|
|
|
8800
9069
|
// a row ends up claiming both "file missing" and "nothing to draw", or keeps a stale reason after a
|
|
8801
9070
|
// successful retry.
|
|
8802
9071
|
const only=(set)=>{for(const s of [refUnresolved,refFailed,refEmpty])if(s!==set)s.delete(id);};
|
|
8803
|
-
if(res.ok&&d.ok){refGeom.set(id,
|
|
9072
|
+
if(res.ok&&d.ok){refGeom.set(id,refGeomFrom(d));only(null);}
|
|
8804
9073
|
else if(d.code==='reference-unresolved'){only(refUnresolved);refUnresolved.add(id);}
|
|
8805
9074
|
else if(d.code==='reference-empty'){only(refEmpty);refEmpty.add(id);}
|
|
8806
9075
|
// An `else` is mandatory here: a 500 whose body is not JSON parses to `{}`, so without one a failed
|
|
@@ -8819,7 +9088,20 @@ async function loadReferenceGeometry(id){
|
|
|
8819
9088
|
}
|
|
8820
9089
|
console.error('[reference] geometry fetch failed',id,e);
|
|
8821
9090
|
}
|
|
8822
|
-
|
|
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();}
|
|
8823
9105
|
}
|
|
8824
9106
|
/** Pull every reference's geometry once the 3D view is up. Sequential: one AWARE run at a time anyway. */
|
|
8825
9107
|
async function loadAllReferences(){for(const r of refList())await loadReferenceGeometry(r.id);}
|
|
@@ -8966,7 +9248,7 @@ function buildRefRow(r){
|
|
|
8966
9248
|
:failed?failed+' — use ⋯ ▸ Reload its geometry to try again'
|
|
8967
9249
|
:empty?'The reader read this file but found nothing it could draw'
|
|
8968
9250
|
:(geom&&geom.dropped)?geom.dropped+' object'+(geom.dropped===1?'':'s')+' in this file carried no usable mesh, so they are not shown'
|
|
8969
|
-
:'Click to select the whole model';
|
|
9251
|
+
:'Click to select the whole model. Ctrl+click an object in 3D for just that one.';
|
|
8970
9252
|
row.appendChild(name);
|
|
8971
9253
|
|
|
8972
9254
|
// PERMANENT, not hover-revealed. A reference can arrive correctly sized and 74 m up, entirely
|
|
@@ -8991,16 +9273,104 @@ function buildRefRow(r){
|
|
|
8991
9273
|
|
|
8992
9274
|
row.addEventListener('click',()=>{
|
|
8993
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
|
|
8994
9277
|
if(window.Steel3DView&&window.Steel3DView.selectReference)window.Steel3DView.selectReference(refSelectedId);
|
|
8995
|
-
renderRefsTab();});
|
|
9278
|
+
renderRefsTab();panel();});
|
|
8996
9279
|
return row;
|
|
8997
9280
|
}
|
|
8998
9281
|
|
|
9282
|
+
/** The default a custom swatch opens on: the app's own reference grey, so the picker starts somewhere
|
|
9283
|
+
* deliberate rather than on black. Mirrors XREF_COLOR in web/steel-3d-view.js. */
|
|
9284
|
+
const REF_GREY='#94a3b8';
|
|
9285
|
+
/** `file` unless the contract says otherwise — see the schema: absence must mean colours, so a
|
|
9286
|
+
* reference imported before this existed picks them up instead of staying grey forever. */
|
|
9287
|
+
const refColourMode=(d)=>(d&&(d.colorMode==='uniform'||d.colorMode==='custom')?d.colorMode:'file');
|
|
9288
|
+
|
|
9289
|
+
/**
|
|
9290
|
+
* Colour: File / Grey / a colour you pick.
|
|
9291
|
+
*
|
|
9292
|
+
* ONE CONTROL, NOT TWO. The swatch IS the third segment rather than a picker standing beside a
|
|
9293
|
+
* "Custom" button — choosing custom and choosing which colour are the same decision, and splitting
|
|
9294
|
+
* them into two controls would leave "Custom" meaning nothing until the other one was used.
|
|
9295
|
+
*
|
|
9296
|
+
* "File" IS HIDDEN, NOT DISABLED, for an IFC that carries no colour. A disabled option says "do
|
|
9297
|
+
* something and this will light up", and nothing the user can do in this panel will ever give that
|
|
9298
|
+
* file a palette — the same mistake as shipping disabled bulk actions in an empty state. What the
|
|
9299
|
+
* stored `colorMode` says is left ALONE while it is hidden: reload the geometry against a file that
|
|
9300
|
+
* has since gained colours, or refresh a bridge too old to report them, and File comes straight back
|
|
9301
|
+
* with the preference intact and nothing to migrate.
|
|
9302
|
+
*/
|
|
9303
|
+
function buildRefColourRow(r,d){
|
|
9304
|
+
const row=document.createElement('div');row.className='colrow';
|
|
9305
|
+
row.appendChild(Object.assign(document.createElement('span'),{className:'dlab',textContent:'Colour'}));
|
|
9306
|
+
|
|
9307
|
+
const geom=refGeom.get(r.id);
|
|
9308
|
+
// TRUE ONLY WHEN THE ANSWER IS IN. Before geometry arrives there is nothing to say, and flickering
|
|
9309
|
+
// the segment out and back while a big model streams would be worse than showing it optimistically.
|
|
9310
|
+
// `colorsAvailable===false` is the file speaking; null is a bridge that could not be asked.
|
|
9311
|
+
const noColours=!!geom&&geom.colorsAvailable===false;
|
|
9312
|
+
const mode=refColourMode(d);
|
|
9313
|
+
// WHAT THE CONTROL SHOWS, which is not always what the contract stores. With File hidden, a stored
|
|
9314
|
+
// `file` would leave no segment lit at all — a radio group with nothing selected, when the reference
|
|
9315
|
+
// is plainly being drawn in something. It IS being drawn in the grey, so Grey is what lights up.
|
|
9316
|
+
// The stored value is left alone deliberately: reload against a file that has since gained colours,
|
|
9317
|
+
// or refresh a bridge too old to report them, and File returns already selected with nothing to migrate.
|
|
9318
|
+
const shown=(noColours&&mode==='file')?'uniform':mode;
|
|
9319
|
+
|
|
9320
|
+
const seg=document.createElement('div');seg.className='seg2';
|
|
9321
|
+
// role=group, NOT radiogroup. A radiogroup promises three elements with role=radio, and the third
|
|
9322
|
+
// is an <input type=color>, which ARIA-in-HTML allows no role on at all — overriding it announced
|
|
9323
|
+
// "radio button, not checked" and threw away the colour-picker semantics a screen reader needs.
|
|
9324
|
+
// Two toggle buttons plus a labelled colour input describes what this actually is.
|
|
9325
|
+
seg.setAttribute('role','group');seg.setAttribute('aria-label','Reference colour');
|
|
9326
|
+
const pick=(m,extra)=>{refEdit(r.id,{display:{colorMode:m,...(extra||{})}});};
|
|
9327
|
+
const mk=(m,label,tip)=>{
|
|
9328
|
+
const b=document.createElement('button');b.type='button';b.textContent=label;
|
|
9329
|
+
b.className=(shown===m?'on':'');b.dataset.mode=m;
|
|
9330
|
+
b.setAttribute('aria-pressed',String(shown===m));
|
|
9331
|
+
b.dataset.tip=tip;b.addEventListener('click',()=>pick(m));
|
|
9332
|
+
return b;};
|
|
9333
|
+
if(!noColours)seg.appendChild(mk('file','File','This model’s own colours, as the file authors them.'));
|
|
9334
|
+
seg.appendChild(mk('uniform','Grey','Flat grey — the reminder that this isn’t your steel, whatever colours the file uses.'));
|
|
9335
|
+
|
|
9336
|
+
const sw=document.createElement('input');sw.type='color';sw.className='swc'+(shown==='custom'?' on':'');
|
|
9337
|
+
sw.value=(d&&typeof d.color==='string'&&/^#[0-9a-fA-F]{6}$/.test(d.color))?d.color.toLowerCase():REF_GREY;
|
|
9338
|
+
sw.dataset.mode='custom';
|
|
9339
|
+
// A data-tip is invisible to a screen reader, so the swatch carries a real accessible name — and
|
|
9340
|
+
// it states whether this colour is the one in use, since there is no aria-pressed on an input.
|
|
9341
|
+
sw.setAttribute('aria-label','Custom colour for this reference'+(shown==='custom'?' (in use)':''));
|
|
9342
|
+
sw.dataset.tip='One colour for the whole reference — click to pick it.';
|
|
9343
|
+
// `input` repaints live as the user drags around the OS picker; `change` is what persists. Both set
|
|
9344
|
+
// the mode, so picking a colour IS choosing custom and there is never a colour chosen but not shown.
|
|
9345
|
+
sw.addEventListener('input',()=>{const v=window.Steel3DView;
|
|
9346
|
+
if(v&&v.setReferenceDisplay)v.setReferenceDisplay(r.id,{...refDisp(r),colorMode:'custom',color:sw.value});});
|
|
9347
|
+
sw.addEventListener('change',()=>pick('custom',{color:sw.value}));
|
|
9348
|
+
seg.appendChild(sw);
|
|
9349
|
+
row.appendChild(seg);
|
|
9350
|
+
|
|
9351
|
+
const wrap=document.createElement('div');wrap.style.cssText='display:flex;flex-direction:column;gap:4px';
|
|
9352
|
+
wrap.appendChild(row);
|
|
9353
|
+
// ALWAYS VISIBLE, never only a tooltip — a keyboard or screen-reader user never sees a data-tip, and
|
|
9354
|
+
// both of these sentences are the kind a user has to have to read the control correctly.
|
|
9355
|
+
if(noColours){
|
|
9356
|
+
const n=Object.assign(document.createElement('div'),{className:'dnote'});
|
|
9357
|
+
n.textContent='This file carries no colour information, so there is no File-colours option for it.';
|
|
9358
|
+
wrap.appendChild(n);
|
|
9359
|
+
} else if(shown==='file'){
|
|
9360
|
+
const n=Object.assign(document.createElement('div'),{className:'dnote'});
|
|
9361
|
+
n.textContent='Grey is this app’s signal that a reference is not your own content.';
|
|
9362
|
+
wrap.appendChild(n);
|
|
9363
|
+
}
|
|
9364
|
+
return wrap;
|
|
9365
|
+
}
|
|
9366
|
+
|
|
8999
9367
|
/** The expanded block for the selected reference — the five controls a row has no room for. */
|
|
9000
9368
|
function buildRefDetail(r){
|
|
9001
9369
|
const d=refDisp(r),wrap=document.createElement('div');wrap.className='refdet';
|
|
9002
9370
|
const opPct=Math.round((Number.isFinite(d.opacity)?d.opacity:0.5)*100);
|
|
9003
9371
|
|
|
9372
|
+
wrap.appendChild(buildRefColourRow(r,d));
|
|
9373
|
+
|
|
9004
9374
|
const opRow=document.createElement('div');opRow.className='drow';
|
|
9005
9375
|
opRow.appendChild(Object.assign(document.createElement('span'),{className:'dlab',textContent:'Opacity'}));
|
|
9006
9376
|
const op=document.createElement('input');op.type='range';op.min='10';op.max='100';op.value=String(opPct);
|
|
@@ -9026,6 +9396,19 @@ function buildRefDetail(r){
|
|
|
9026
9396
|
:'Hiding this reference does not stop snapping to it — the cyan dot on the row does.';
|
|
9027
9397
|
wrap.appendChild(note);
|
|
9028
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
|
+
|
|
9029
9412
|
// The TRUE size — measured off the geometry that is actually on screen, which is the only place this
|
|
9030
9413
|
// number can be honest. The import modal deliberately shows none: before tessellation the sole
|
|
9031
9414
|
// measurement available is the reader's own APPROXIMATE bbox, and that spans every point the file
|
|
@@ -9079,6 +9462,224 @@ function buildRefDetail(r){
|
|
|
9079
9462
|
return wrap;
|
|
9080
9463
|
}
|
|
9081
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
|
+
|
|
9082
9683
|
/** A file size a human recognises from their file manager. KB under a megabyte, MB above it. */
|
|
9083
9684
|
function fileSizeWords(bytes){
|
|
9084
9685
|
const n=Number(bytes)||0;
|
|
@@ -9141,7 +9742,7 @@ function openRefRowMenu(r,anchorEl){closeRefRowMenu();
|
|
|
9141
9742
|
if(nativeModelBounds())m.append(mk(REF_MOVE_LABEL,()=>refMoveToOrigin(r.id)));
|
|
9142
9743
|
m.append(mk('Reload its geometry',()=>{
|
|
9143
9744
|
if(refDisp(r).locked){toast('“'+r.name+'” is locked — unlock it to reload it');return;} // the lock freezes reload, as the schema says
|
|
9144
|
-
refGeom.delete(r.id);refFailed.delete(r.id);refEmpty.delete(r.id);refUnresolved.delete(r.id);loadReferenceGeometry(r.id);}));
|
|
9745
|
+
refGeom.delete(r.id);refFailed.delete(r.id);refEmpty.delete(r.id);refUnresolved.delete(r.id);loadReferenceGeometry(r.id,{rebuild:true});}));
|
|
9145
9746
|
m.appendChild(document.createElement('hr'));
|
|
9146
9747
|
m.appendChild(mk('Remove',()=>refRemove(r),true));
|
|
9147
9748
|
document.body.appendChild(m);
|
|
@@ -9171,8 +9772,8 @@ async function refRemove(r){
|
|
|
9171
9772
|
adoptReferenceWrite(d.etag);
|
|
9172
9773
|
const i=refList().findIndex(x=>x&&x.id===r.id);if(i>=0)C.reference_models.splice(i,1);
|
|
9173
9774
|
refGeom.delete(r.id);refUnresolved.delete(r.id);refFailed.delete(r.id);refEmpty.delete(r.id);
|
|
9174
|
-
if(refSelectedId===r.id)refSelectedId=null;
|
|
9175
|
-
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();
|
|
9176
9777
|
}catch(_){toast('Could not remove that reference');}
|
|
9177
9778
|
}
|
|
9178
9779
|
|
|
@@ -9190,8 +9791,24 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
9190
9791
|
// `riProbeCentre` is reset alongside the rest on every open — it used to survive from the PREVIOUS
|
|
9191
9792
|
// file, which only failed to matter because `riInsert` bails on a missing `riSha`.
|
|
9192
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;}};
|
|
9193
9808
|
const riClearSoft=()=>{if(riSoftT){clearTimeout(riSoftT);riSoftT=null;}};
|
|
9809
|
+
let riStageNow='drop';
|
|
9194
9810
|
const riStage=s=>{ // 'drop' | 'prog' | 'confirm'
|
|
9811
|
+
riStageNow=s;
|
|
9195
9812
|
ri$('riDropStage').style.display=s==='drop'?'':'none';
|
|
9196
9813
|
ri$('riProgStage').style.display=s==='prog'?'':'none';
|
|
9197
9814
|
ri$('riConfirmStage').style.display=s==='confirm'?'':'none';
|
|
@@ -9205,10 +9822,11 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
9205
9822
|
function openRefImport(){
|
|
9206
9823
|
if(!MODEL_V2){toast('Reference models need this project on the model-level contract');return;}
|
|
9207
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
|
|
9208
9826
|
riSha=null;riName='';riVerdict=null;riProbeCentre=null;riErr('');ri$('riDrop').classList.remove('drag');
|
|
9209
9827
|
riStage('drop');ri$('refImportModal').style.display='flex';}
|
|
9210
9828
|
window.openRefImport=openRefImport;
|
|
9211
|
-
function riClose(){riClearSoft();ri$('refImportModal').style.display='none';}
|
|
9829
|
+
function riClose(){riStop();riClearSoft();ri$('refImportModal').style.display='none';}
|
|
9212
9830
|
|
|
9213
9831
|
const RI_MAX_BYTES=150*1024*1024; // mirrors MAX_BYTES in server/reference-import.ts (pinned by the parity test)
|
|
9214
9832
|
function riReadFile(f){ if(!f||riBusy)return;riErr('');
|
|
@@ -9216,19 +9834,28 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
9216
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;}
|
|
9217
9835
|
riName=f.name;
|
|
9218
9836
|
const fr=new FileReader();
|
|
9219
|
-
|
|
9220
|
-
|
|
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);};
|
|
9221
9842
|
riStage('prog');riProg('Reading “'+f.name+'”…');
|
|
9222
9843
|
fr.readAsDataURL(f);}
|
|
9223
9844
|
|
|
9224
|
-
async function riProbe(dataUrl,f){
|
|
9845
|
+
async function riProbe(dataUrl,f,mine){
|
|
9225
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;
|
|
9226
9849
|
try{
|
|
9227
|
-
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'},
|
|
9228
9851
|
// The model's CENTRE rides along with its span: "off-screen" is a question about the distance
|
|
9229
9852
|
// between the reference and the steel, and the server has no other way to know where the steel is.
|
|
9230
9853
|
body:JSON.stringify({dataUrl,name:f.name,nativeSpan:nativeModelSpan(),nativeCenter:nativeModelCentre()})});
|
|
9231
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;
|
|
9232
9859
|
riClearSoft();
|
|
9233
9860
|
if(!res.ok||!d.ok){riStage('drop');riErr(d.error||'Could not read that file.');return;}
|
|
9234
9861
|
riSha=d.sha;riVerdict=d.verdict||null;
|
|
@@ -9245,7 +9872,11 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
9245
9872
|
ri$('riBytes').textContent=fileSizeWords(d.bytes||0);
|
|
9246
9873
|
riShowVerdict(d.warn,d.bytes);
|
|
9247
9874
|
riStage('confirm');
|
|
9248
|
-
}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;}}
|
|
9249
9880
|
|
|
9250
9881
|
/** The advisory. AMBER, never red: a scale or position guess is an offer, not something being broken. */
|
|
9251
9882
|
function riShowVerdict(warn,bytes){
|
|
@@ -9270,7 +9901,21 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
9270
9901
|
|
|
9271
9902
|
async function riInsert(){
|
|
9272
9903
|
if(!riSha||riBusy)return;riBusy=true;
|
|
9273
|
-
|
|
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
|
|
9274
9919
|
const takeOrigin=!!ri$('riVerdict').querySelector('button.on')&&riVerdict&&riVerdict.offscreen;
|
|
9275
9920
|
// Computed from the PROBE's own centre, which is what the offer was based on, and TOWARDS THE
|
|
9276
9921
|
// MODEL'S CENTRE rather than the world origin — the same correction `refMoveToOrigin` carries, for
|
|
@@ -9283,23 +9928,39 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
9283
9928
|
riStage('prog');riProg('Reading the geometry…','Still reading — a whole building takes a moment.');
|
|
9284
9929
|
try{
|
|
9285
9930
|
const mid=newMutationId();claimMutation(mid);
|
|
9286
|
-
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},
|
|
9287
9932
|
// The placement rides the INSERT, so the choice the user made in the modal is committed with
|
|
9288
9933
|
// the reference rather than by a debounced PUT afterwards. Applying it in the presentation
|
|
9289
9934
|
// block left it outside the point of no return: a closed tab or a save conflict would leave
|
|
9290
9935
|
// the server holding the site coordinates the user had just asked to move away from.
|
|
9291
9936
|
body:JSON.stringify({sha:riSha,name:riName,...(takeOrigin&&riOriginShift?{placement:{origin:riOriginShift}}:{})})});
|
|
9292
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
|
+
}
|
|
9293
9949
|
riClearSoft();
|
|
9294
9950
|
if(!res.ok||!d.ok){riStage('drop');riErr(d.error||'Could not add that reference.');return;}
|
|
9295
9951
|
adoptReferenceWrite(d.etag);
|
|
9296
9952
|
if(!Array.isArray(C.reference_models))C.reference_models=[];
|
|
9297
9953
|
C.reference_models.push(d.reference);
|
|
9298
|
-
refGeom.set(d.reference.id,
|
|
9299
|
-
|
|
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;
|
|
9300
9957
|
inserted=d.reference;
|
|
9301
|
-
}catch(e){
|
|
9302
|
-
|
|
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;}
|
|
9303
9964
|
// ── PAST THE POINT OF NO RETURN. Everything above is the transaction; everything below is showing
|
|
9304
9965
|
// it. They were one try, and a throw in the presentation half ran riErr() on a modal riClose() had
|
|
9305
9966
|
// already hidden — so the user saw NOTHING while the reference was committed and on disk, and the
|
|
@@ -9314,13 +9975,26 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
9314
9975
|
// WITH the insert — see the request body — so there is nothing to apply here.)
|
|
9315
9976
|
if(window.Steel3DView&&window.Steel3DView.frameReference)window.Steel3DView.frameReference(inserted.id);
|
|
9316
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();
|
|
9317
9986
|
toast('Added “'+inserted.name+'” as a reference'+(d.dropped?' ('+d.dropped+' object'+(d.dropped===1?'':'s')+' had nothing to draw)':''));
|
|
9318
9987
|
}catch(e){
|
|
9319
9988
|
console.error('[reference] added, but the view could not be updated',e);
|
|
9320
9989
|
toast('Added “'+inserted.name+'” — reload the view to see it');
|
|
9321
9990
|
}}
|
|
9322
9991
|
|
|
9323
|
-
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();};
|
|
9324
9998
|
ri$('riInsert').onclick=riInsert;
|
|
9325
9999
|
ri$('riDrop').onclick=()=>ri$('riFile').click();
|
|
9326
10000
|
ri$('riDrop').onkeydown=e=>{if(e.key==='Enter'||e.key===' '){e.preventDefault();ri$('riFile').click();}};
|