@floless/app 0.127.5 → 0.128.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floless-server.cjs +10189 -13091
- package/dist/schemas/drawing.vector.v1.schema.json +1 -1
- package/dist/schemas/steel.model.v2.schema.json +50 -127
- package/dist/skills/floless-app-steel-model/SKILL.md +5 -6
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +172 -1704
- package/dist/skills/floless-app-tweak-contract/SKILL.md +64 -174
- package/dist/skills/reading-structural-drawings/SKILL.md +2 -2
- package/dist/skills/steel-drawing-abbreviations/SKILL.md +2 -2
- package/dist/templates/steel-model.flo +45 -24
- package/dist/web/app.css +18 -92
- package/dist/web/aware.js +7 -1
- package/dist/web/grid-core.js +47 -0
- package/dist/web/index.html +0 -27
- package/dist/web/renderers.js +3 -14
- package/dist/web/steel-3d-view.js +87 -35
- package/dist/web/steel-editor.html +82 -58
- package/dist/web/steel-filter-core.js +7 -26
- package/dist/web/steel-filter.html +7 -7
- package/dist/web/steel-model-adapter.js +19 -250
- package/dist/web/steel-model-v2-commands.js +1 -0
- package/dist/web/workspaces.js +46 -838
- package/package.json +1 -1
- package/dist/schemas/steel.takeoff.v1.schema.json +0 -562
- package/dist/schemas/steel.takeoff.v1.staging-snapshot.json +0 -263
|
@@ -403,6 +403,7 @@
|
|
|
403
403
|
#selBar button:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
|
|
404
404
|
#selBar button .car{position:absolute;right:1px;bottom:0;font-size:8px;opacity:.7;pointer-events:none}
|
|
405
405
|
#selBar button .seldot{position:absolute;top:2px;right:2px;width:6px;height:6px;border-radius:50%;background:var(--brand);box-shadow:0 0 0 1.5px var(--panel)}
|
|
406
|
+
body:not(.v3d) #selBar [data-cls=reference]{display:none} /* borrowed IFC geometry has no 2D pick surface */
|
|
406
407
|
/* shared type flyout (Members / Connections) — opens upward from the bar */
|
|
407
408
|
#selFly{position:fixed;z-index:46;min-width:210px;background:var(--panel);border:1px solid var(--line);border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.55);padding:6px;display:none}
|
|
408
409
|
#selFly.open{display:block}
|
|
@@ -1551,6 +1552,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1551
1552
|
<button data-cls=connection data-fly=connections aria-label="Connections" data-tip="Connections — click to choose which connection types can be selected · Alt+click: toggle all types"><svg viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><rect x="4" y="4" width="10" height="10" rx="1"/><circle cx="6.5" cy="6.5" r="1.15" fill="currentColor" stroke="none"/><circle cx="11.5" cy="6.5" r="1.15" fill="currentColor" stroke="none"/><circle cx="6.5" cy="11.5" r="1.15" fill="currentColor" stroke="none"/><circle cx="11.5" cy="11.5" r="1.15" fill="currentColor" stroke="none"/></svg><span class=car aria-hidden=true>▾</span></button>
|
|
1552
1553
|
<button data-cls=grid aria-label="Grid lines" data-tip="Grid lines — allow selecting grid lines (area-select / Ctrl+A)"><svg viewBox="0 0 18 18" fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden=true><path d="M6 2v14M12 2v14M2 6h14M2 12h14"/></svg></button>
|
|
1553
1554
|
<button data-cls=dim aria-label="Dimensions" data-tip="Dimensions — allow selecting dimensions"><svg viewBox="0 0 18 18" fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden=true><path d="M3 5v8M15 5v8M3 9h12M3 9l3-2M3 9l3 2M15 9l-3-2M15 9l-3 2"/></svg></button>
|
|
1555
|
+
<button data-cls=reference aria-label="Reference models" data-tip="Reference models — allow selecting reference models. Visibility and snapping are controlled separately."><svg viewBox="0 0 18 18" fill=none stroke=currentColor stroke-width=1.35 stroke-linejoin=round aria-hidden=true><path d="M2.5 5.5l5-2.5 5 2.5-5 2.5-5-2.5Z"/><path d="M2.5 5.5v5l5 2.5 5-2.5v-5M7.5 8v5"/><path d="M10.5 8.5l2-1 3 1.5v3l-3 1.5"/></svg></button>
|
|
1554
1556
|
</div>
|
|
1555
1557
|
<!-- Quick-access snap toggles (same persistent state as the ⋯ menu → Snapping section; keep the two in sync — same 7 items).
|
|
1556
1558
|
Glyphs mirror SNAP_KINDS_2D — see the endpoint-glyph constraint there before "correcting" ◻ to □. -->
|
|
@@ -1761,22 +1763,19 @@ const PROJECT_QS = PROJECT ? ('?project=' + encodeURIComponent(PROJECT)) : '';
|
|
|
1761
1763
|
// the empty states below branch on, and never on the PUT — a write wants the ordinary refusal.
|
|
1762
1764
|
const CONTRACT_QS = PROJECT ? (PROJECT_QS + '&quietMissing=1') : PROJECT_QS;
|
|
1763
1765
|
// ── The browser draft's identity, and the contract type this page can render (unit 5, P1c-3) ──
|
|
1764
|
-
// The one contract type this editor renders. A contract with
|
|
1766
|
+
// The one contract type this editor renders. A contract with no `type` is invalid — the server's
|
|
1765
1767
|
// own validator says so and falls back to exactly this (contract-schema.ts, validateContract), so
|
|
1766
1768
|
// diverging here would refuse documents this app itself wrote.
|
|
1767
|
-
const EDITOR_TYPE = 'steel.takeoff/v1';
|
|
1768
1769
|
// The canonical model format. New and migrated projects edit this shape through validated,
|
|
1769
1770
|
// transactional commands; the v1 branch remains as a compatibility reader during the rollout.
|
|
1770
1771
|
const MODEL_V2_TYPE = 'steel.model/v2';
|
|
1771
1772
|
// P3's single activation switch. Reads and writes consult this same constant; there is no half-v2 mode.
|
|
1772
|
-
const MODEL_V2_LIVE = true;
|
|
1773
1773
|
// Every type this page will open. A type NOT in here is refused before anything mutates the document; the
|
|
1774
1774
|
// refusal copy below still tells a newer STEEL model apart from "you opened the wrong workflow".
|
|
1775
|
-
const OPENABLE_TYPES = [EDITOR_TYPE, MODEL_V2_TYPE];
|
|
1776
1775
|
// The type the draft key is built from. Captured ONCE, right after boot() validates it, and never re-read
|
|
1777
1776
|
// from `C` afterwards: `C` is mutable, and a key that can change identity mid-session would orphan the
|
|
1778
1777
|
// draft it was writing (persist and restoreSaved would address different rows).
|
|
1779
|
-
let DRAFT_TYPE =
|
|
1778
|
+
let DRAFT_TYPE = MODEL_V2_TYPE;
|
|
1780
1779
|
/**
|
|
1781
1780
|
* Is the open document READ-ONLY to this editor?
|
|
1782
1781
|
*
|
|
@@ -1791,7 +1790,7 @@ let DRAFT_TYPE = EDITOR_TYPE;
|
|
|
1791
1790
|
* they never made. See docs/superpowers/specs/2026-07-26-steel-v2-p7d-design.md §8.4.
|
|
1792
1791
|
*
|
|
1793
1792
|
* This preserves the pre-activation safety gate without creating a half-live mode:
|
|
1794
|
-
*
|
|
1793
|
+
* v2 reads and canonical writes are always enabled together.
|
|
1795
1794
|
*/
|
|
1796
1795
|
let MODEL_V2 = false;
|
|
1797
1796
|
let MODEL_RO = false;
|
|
@@ -2212,10 +2211,10 @@ async function boot() {
|
|
|
2212
2211
|
return;
|
|
2213
2212
|
}
|
|
2214
2213
|
const loadedType = loaded.type;
|
|
2215
|
-
// A missing
|
|
2214
|
+
// A missing or non-v2 type is refused
|
|
2216
2215
|
// HERE, before the normalisation below starts mutating the document and before main() runs restoreSaved()
|
|
2217
2216
|
// — which would otherwise overlay a steel draft onto a document of a different type entirely.
|
|
2218
|
-
if (loadedType
|
|
2217
|
+
if (loadedType !== MODEL_V2_TYPE) {
|
|
2219
2218
|
// Two different situations, and one message for both would be false in one of them. A newer
|
|
2220
2219
|
// steel.model/* IS a Steel Model — just a format this build cannot draw yet — so telling that user
|
|
2221
2220
|
// "this is not a Steel Model" would be plainly wrong. Anything else means they opened the wrong
|
|
@@ -2232,14 +2231,12 @@ async function boot() {
|
|
|
2232
2231
|
}
|
|
2233
2232
|
// Pin the draft identity for the rest of the session. Read once, from the validated value, never from
|
|
2234
2233
|
// the mutable `C` — see draftKey().
|
|
2235
|
-
DRAFT_TYPE =
|
|
2236
|
-
MODEL_V2 =
|
|
2237
|
-
MODEL_RO =
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
V2_SCHEMA = await schemaRes.json();
|
|
2242
|
-
}
|
|
2234
|
+
DRAFT_TYPE = MODEL_V2_TYPE;
|
|
2235
|
+
MODEL_V2 = true;
|
|
2236
|
+
MODEL_RO = false;
|
|
2237
|
+
const schemaRes = await fetch('/api/schema/steel-model-v2');
|
|
2238
|
+
if (!schemaRes.ok) throw new Error('steel.model/v2 schema unavailable');
|
|
2239
|
+
V2_SCHEMA = await schemaRes.json();
|
|
2243
2240
|
try {
|
|
2244
2241
|
const hr = await fetch('/api/health');
|
|
2245
2242
|
if (hr.ok) DEV_MODE = (await hr.json()).appChannel === 'dev';
|
|
@@ -2467,7 +2464,6 @@ const CHANGE_LEAD = Object.assign(Object.create(null), {
|
|
|
2467
2464
|
//
|
|
2468
2465
|
// The row above inherits this trade rather than re-deciding it: same phrase, one decision.
|
|
2469
2466
|
'revision-read': 'The AI read a revised drawing set into this model',
|
|
2470
|
-
'migration': 'This project was converted to the 3D model',
|
|
2471
2467
|
});
|
|
2472
2468
|
|
|
2473
2469
|
/**
|
|
@@ -2953,7 +2949,7 @@ const autofillTOS=syncDefaults;
|
|
|
2953
2949
|
// grid that does not live on a sheet, so without this line every grid edit on a v2 document would be
|
|
2954
2950
|
// unundoable — silently, since Ctrl+Z would restore the sheets and report success.
|
|
2955
2951
|
function snapshot(){
|
|
2956
|
-
if(MODEL_V2)return JSON.stringify({v2:true,members:C.members,grid:C.grid||null,plans:C.plans.map(p=>({sheet:p.sheet,dims:p.dims||[],memberRefs:p.memberRefs||[],memberObservations:p.memberObservations||[],frame:p.frame||null})),joints:C.joints||[],connections:C.connections||[],details:C.detail_placements||[],views:C.views||[],member_types:C.member_types||[],dim_style:C.dim_style||null,member_styles:C.member_styles||{}});
|
|
2952
|
+
if(MODEL_V2)return JSON.stringify({v2:true,members:C.members,grid:C.grid||null,plans:C.plans.map(p=>({sheet:p.sheet,dims:p.dims||[],memberRefs:p.memberRefs||[],memberObservations:p.memberObservations||[],frame:p.frame||null})),joints:C.joints||[],connections:C.connections||[],details:C.detail_placements||[],views:C.views||[],member_types:C.member_types||[],dim_style:C.dim_style||null,member_styles:C.member_styles||{},...(Array.isArray(C.reference_models)?{reference_models:C.reference_models}:{})});
|
|
2957
2953
|
return JSON.stringify({planes:C.plans.map(p=>({sheet:p.sheet,members:p.members,dims:p.dims||[],frame:p.frame||null,grid:p.grid||null})),joints:C.joints||[],connections:Array.isArray(C.connections)?C.connections:null,clips:(window.Steel3DView&&window.Steel3DView.clipState)?window.Steel3DView.clipState():null,details:(C.detail_placements||[]),member_types:C.member_types||[],dim_style:C.dim_style||null,member_styles:C.member_styles||{}});
|
|
2958
2954
|
}
|
|
2959
2955
|
// Undo/redo is a SINGLE GLOBAL stack (not per-plane): snapshot() above captures EVERY plane's
|
|
@@ -3032,6 +3028,7 @@ function apply(json){
|
|
|
3032
3028
|
cmDraft=null;cmPrevClear();cmHudClose(); // same for an in-progress Move/Copy pick — the base may reference removed geometry
|
|
3033
3029
|
if(window.Steel3DView&&window.Steel3DView.cmClear3d)window.Steel3DView.cmClear3d(); // and the 3D-side draft/ghosts
|
|
3034
3030
|
if(window.Steel3DView&&window.Steel3DView.setClipState&&'clips' in d)window.Steel3DView.setClipState(d.clips); // restore clips + work area alongside the contract
|
|
3031
|
+
if(MODEL_V2&&'reference_models' in d)pushReferences(); // native sync3D cannot repaint the editor-only reference layer
|
|
3035
3032
|
if('member_types' in d)C.member_types=sanitizeMemberTypes(d.member_types);
|
|
3036
3033
|
if('member_styles' in d)C.member_styles=(d.member_styles&&typeof d.member_styles==='object'&&!Array.isArray(d.member_styles))?d.member_styles:{}; // F5: model-global per-type line styles ride the undo stack (like dim_style) so a setMemberLineStyle() edit() is undoable
|
|
3037
3034
|
scheduleSave();render();sync3D();}
|
|
@@ -3545,7 +3542,7 @@ function v2DraftFits(d){
|
|
|
3545
3542
|
// JSON compare: both sides descend from the same object graph (C → persist → JSON.parse), so key
|
|
3546
3543
|
// order matches whenever the values do. A false "differs" would only cost a no-op offer; a false
|
|
3547
3544
|
// "same" would drop the user's edit, so the comparison errs in the safe direction by construction.
|
|
3548
|
-
|
|
3545
|
+
{
|
|
3549
3546
|
const rootKeys=['members','grid','custom_details','profile_colors','member_styles','member_types','target_confidence','dims3d','dim_overlays','dim_style','prop_labels','joints','connections','detail_placements','views'];
|
|
3550
3547
|
if(rootKeys.some(k=>k in d&&JSON.stringify(d[k])!==JSON.stringify(C&&C[k])))return true;
|
|
3551
3548
|
// Asked through the SAME reconciliation the restore performs, or the two disagree: a draft that is
|
|
@@ -3556,7 +3553,7 @@ function v2DraftFits(d){
|
|
|
3556
3553
|
// SAID PLAINLY: this whole function is UNREACHABLE today, so this arm has never executed. Its two
|
|
3557
3554
|
// callers are `draftFits` — which short-circuits on `canWriteModel()` — and `applyDraftReadOnlyFields`,
|
|
3558
3555
|
// which is itself behind `if(!canWriteModel())`. `canWriteModel()` is `!MODEL_RO`,
|
|
3559
|
-
//
|
|
3556
|
+
// MODEL_RO is false for the canonical v2 editor. This compatibility logic is kept
|
|
3560
3557
|
// aligned rather than left behind because the read-only mode is the thing that would resurrect it,
|
|
3561
3558
|
// and a half-updated pair is how the original defect got in — but nothing exercises it, and a comment
|
|
3562
3559
|
// claiming otherwise would be the same kind of lie this pass has been removing.
|
|
@@ -4480,7 +4477,7 @@ function reflect2dGridSelection(){const geo=gridGeo()||{};
|
|
|
4480
4477
|
if(!selDimIds.size){svg.querySelectorAll('.dimsel').forEach(el=>el.classList.remove('dimsel'));svg.querySelectorAll('circle.dimhandle').forEach(el=>el.remove());} // an additive grid click keeps an already-selected dimension visibly selected; a plain grid click cleared selDimIds above
|
|
4481
4478
|
if(!selIds.size)svg.querySelectorAll('circle.handle,circle.numbg,text.numtx,g.mlenlabels').forEach(el=>el.remove());
|
|
4482
4479
|
panel();try{updateConnCrumb();}catch(_){}syncPropLabelsAfterRender();}
|
|
4483
|
-
function selectGridLine(id,additive,surgical=false){if(!id||!selGridOK())return;if(!additive){selDimIds.clear();sel3dDimIds.clear();selIds.clear();selGridIds=new Set([id]);if(window.Steel3DView&&window.Steel3DView.setSelectedClips)window.Steel3DView.setSelectedClips([]);}else{selGridIds.has(id)?selGridIds.delete(id):selGridIds.add(id);}surgical?reflect2dGridSelection():render();} // additive grid picks preserve an intentional mixed dimension/grid selection in either click order
|
|
4480
|
+
function selectGridLine(id,additive,surgical=false){if(!id||!selGridOK())return;clearWholeReferenceSelection();if(!additive){selDimIds.clear();sel3dDimIds.clear();selIds.clear();selGridIds=new Set([id]);if(window.Steel3DView&&window.Steel3DView.setSelectedClips)window.Steel3DView.setSelectedClips([]);}else{selGridIds.has(id)?selGridIds.delete(id):selGridIds.add(id);}surgical?reflect2dGridSelection():render();} // additive grid picks preserve an intentional mixed dimension/grid selection in either click order
|
|
4484
4481
|
// selected grid lines → display rows {label,type} for the inspector (resolves labels/types from gridGeo)
|
|
4485
4482
|
function gridSelSummary(){const geo=gridGeo()||{};const out=[];
|
|
4486
4483
|
for(const id of selGridIds){
|
|
@@ -4944,6 +4941,10 @@ function doDup(){const arr=sel2d();if(!arr.length)return;const o=12,pv=snapshot(
|
|
|
4944
4941
|
selIds=ns;selDimIds.clear();mode='sel';setMode();pushUndo(pv);render();}
|
|
4945
4942
|
function esc(s){return String(s).replace(/[<>&"]/g,c=>({'<':'<','>':'>','&':'&','"':'"'}[c]));}
|
|
4946
4943
|
function render(){
|
|
4944
|
+
// Selection has many entry points (2D clicks/marquees, 3D picks, inspectors, Locate actions). Enforce
|
|
4945
|
+
// the one-target invariant at their shared paint boundary as well as at the direct 3D sinks: if any
|
|
4946
|
+
// native/dimension/grid target is about to be shown selected, a stale whole-reference selection ends.
|
|
4947
|
+
if(refSelectedId&&(selIds.size||selDimIds.size||selGridIds.size||sel3dDimIds.size))clearWholeReferenceSelection();
|
|
4947
4948
|
// A v2 document has no 2D plan to draw (§1): its members are world-mm and model-level, and the sheet
|
|
4948
4949
|
// registration that would place them back into this sheet's display space is computed at migration and
|
|
4949
4950
|
// never persisted — the adapter's own sheetFrame() refuses to fabricate one. So the canvas stays empty
|
|
@@ -5101,7 +5102,7 @@ function stats(){
|
|
|
5101
5102
|
// THE PREDICATE IS `NO_PLAN_VIEW`, AND IT USED TO BE `MODEL_RO` (#515). That was written when v2 was
|
|
5102
5103
|
// read-only and had no plan projection at all, so "a v2 document" and "no per-sheet members" were the
|
|
5103
5104
|
// same statement. They stopped being the same when v2 went live, and the guard did not follow:
|
|
5104
|
-
//
|
|
5105
|
+
// MODEL_RO is false for the canonical v2 editor, which makes it permanently
|
|
5105
5106
|
// FALSE, so this branch was dead and a v2 model with no plan view printed exactly the zeros it exists to
|
|
5106
5107
|
// prevent. A v2 model that DOES have a plan view is NOT the case being excluded: its `P.members` is the
|
|
5107
5108
|
// real projection for that sheet, so its numbers are as honest as v1's and it keeps every one of them.
|
|
@@ -5357,12 +5358,12 @@ function panel(){
|
|
|
5357
5358
|
if(csaxisMode){p.innerHTML=`<span class=badge>Set local axes</span>
|
|
5358
5359
|
<div class=hint style="margin-top:8px">${csDraft?'Click the <b>second</b> point — the local-X direction. Y follows at 90°.':'Click the <b>origin</b> point to start.'}</div>
|
|
5359
5360
|
<div class=hint style="margin-top:8px">Two clicks define the frame; snaps to member ends & grid (<b>Alt</b> off). <b>Esc</b> cancels.</div>`;return;}
|
|
5360
|
-
if(cmTool){const nsel=selIds.size;
|
|
5361
|
+
if(cmTool){const refTarget=view3d&&!selIds.size&&refSelectedId&&refSelectedObjIdx===null?refById(refSelectedId):null,nsel=refTarget?1:selIds.size;
|
|
5361
5362
|
p.innerHTML=`<span class=badge>${cmTool==='move'?'Move':(cmArrayMode?'Copy array':'Copy')}</span>
|
|
5362
5363
|
<div class=hint id=cmHint style="margin-top:8px">${esc(cmHintText())}</div>
|
|
5363
5364
|
${cmTool==='copy'&&!cmArrayMode?`<div class=sect style="margin-top:12px">Copies</div><input id=cmN inputmode=numeric value="${cmCount}" autocomplete=off><div class=hint style="margin-top:4px">×N places a row — each copy one step further along the pick (linear).</div>`:''}
|
|
5364
5365
|
${cmArrayMode?`<div class=sect style="margin-top:12px">Array counts</div><div class=elab>Direction A</div><input id=cmNA inputmode=numeric value="${cmCountA}" autocomplete=off><div class=elab>Direction B</div><input id=cmNB inputmode=numeric value="${cmCountB}" autocomplete=off><div class=hint id=cmCapHint style="margin-top:4px">Counts include the original — 4 × 6 fills a 4-by-6 grid (max 100).</div>`:''}
|
|
5365
|
-
<div class=hint style="margin-top:8px">${nsel
|
|
5366
|
+
<div class=hint style="margin-top:8px">${refTarget?'1 reference model selected.':nsel+' member'+(nsel===1?'':'s')+' selected.'} ${view3d?'<b>Shift</b>=straight · <b>X/Y/Z</b> lock (press again to release · <b>F</b> clears; lock two to snap to whichever you drag toward) · <b>Alt</b>=lock out-of-plane':'<b>Shift</b>=straight · <b>X/Y/F</b> axis · <b>Alt</b>=no snap'} · type after the first pick for an exact value · <b>Esc</b> cancels.${refTarget?'':' Connections don’t copy.'}</div>`;
|
|
5366
5367
|
const wireN=(id,set)=>{const i=document.getElementById(id);if(i)i.onchange=e=>{const n=Math.max(1,Math.min(99,Math.round(Number(e.target.value)||1)));set(n);e.target.value=n;
|
|
5367
5368
|
const ch=document.getElementById('cmCapHint');if(ch)ch.style.color=(cmArrayMode&&cmCountA*cmCountB>100)?'#fca5a5':'';cmRefreshPrev();};};
|
|
5368
5369
|
wireN('cmN',n=>cmCount=n);wireN('cmNA',n=>cmCountA=n);wireN('cmNB',n=>cmCountB=n);
|
|
@@ -6127,12 +6128,12 @@ function saveOriginGrid(){try{localStorage.setItem(OGRID_ON_KEY,originGridOn?'1'
|
|
|
6127
6128
|
// connection kinds — may enter a selection. One persisted source of truth, consulted at every pick
|
|
6128
6129
|
// sink (2D click/marquee/Ctrl+A, 3D pick/box). Default: everything ON, so nothing is filtered out
|
|
6129
6130
|
// (that default is also what fixes the silent Ctrl+A/marquee drops of dims + grids). GLOBAL like snaps.
|
|
6130
|
-
// State: grid/dim are plain on/off; Members & Connections have per-TYPE switches (mtype/ckind, absent===on)
|
|
6131
|
+
// State: grid/dim/reference are plain on/off; Members & Connections have per-TYPE switches (mtype/ckind, absent===on)
|
|
6131
6132
|
// and their class button is DERIVED (all/some/none on) — so "Members off" just means every member type off.
|
|
6132
6133
|
const SELF_KEY='steel:selFilter:v1';
|
|
6133
6134
|
// Grids default OFF (opt-in) — grid-line selection is a deliberate act, so a plain marquee/Ctrl+A doesn't
|
|
6134
|
-
// sweep the structural grid unless you switch it on. Members/Connections/Dimensions default ON.
|
|
6135
|
-
let selFilter=(()=>{try{const s=JSON.parse(localStorage.getItem(SELF_KEY)||'{}');return {grid:s.grid===true,dim:s.dim!==false,mtype:(s.mtype&&typeof s.mtype==='object')?s.mtype:{},ckind:(s.ckind&&typeof s.ckind==='object')?s.ckind:{}};}catch(_){return {grid:false,dim:true,mtype:{},ckind:{}};}})();
|
|
6135
|
+
// sweep the structural grid unless you switch it on. Members/Connections/Dimensions/References default ON.
|
|
6136
|
+
let selFilter=(()=>{try{const s=JSON.parse(localStorage.getItem(SELF_KEY)||'{}');return {grid:s.grid===true,dim:s.dim!==false,reference:s.reference!==false,mtype:(s.mtype&&typeof s.mtype==='object')?s.mtype:{},ckind:(s.ckind&&typeof s.ckind==='object')?s.ckind:{}};}catch(_){return {grid:false,dim:true,reference:true,mtype:{},ckind:{}};}})();
|
|
6136
6137
|
function saveSelFilter(){try{localStorage.setItem(SELF_KEY,JSON.stringify(selFilter));}catch(_){}}
|
|
6137
6138
|
const normConnKind=k=>String(k||'').trim().toLowerCase(); // 'base-plate' | 'shear-plate' | 'custom'
|
|
6138
6139
|
const selTypeOK=k=>selFilter.mtype[k]!==false; // per-member-type; absent === allowed
|
|
@@ -6142,6 +6143,7 @@ function connKindOfPart(id){const p=partsById&&partsById[id];if(!p||!p.conn)retu
|
|
|
6142
6143
|
function selConnPartOK(id){return selKindOK(connKindOfPart(id));}
|
|
6143
6144
|
const selGridOK=()=>selFilter.grid!==false;
|
|
6144
6145
|
const selDimOK=()=>selFilter.dim!==false;
|
|
6146
|
+
const selReferenceOK=()=>selFilter.reference!==false;
|
|
6145
6147
|
// classify any id already in / entering selIds — connection part, placed detail, or plain member — → allowed?
|
|
6146
6148
|
function selIdOK(id){if(id==null)return true;if(partsById&&partsById[id]&&partsById[id].conn)return selConnPartOK(id);if(/^det:/.test(id))return true;const m=byId(id);return m?selMemberOK(m):true;}
|
|
6147
6149
|
// a type fires when a transient override forces exactly it (override ignores running-snaps, AutoCAD-style), else when its running-snap is on
|
|
@@ -6306,7 +6308,7 @@ function _len3dFt(m,ppf,dTos){
|
|
|
6306
6308
|
* Two traps met here, and both produced a confidently wrong number rather than an error:
|
|
6307
6309
|
*
|
|
6308
6310
|
* 1. THE PREDICATE IS THE FORMAT, NOT WRITABILITY. This shipped as `MODEL_RO ? …`, which was
|
|
6309
|
-
* indistinguishable from MODEL_V2 while v2 was read-only.
|
|
6311
|
+
* indistinguishable from MODEL_V2 while v2 was read-only. Once canonical writes turned on, MODEL_RO
|
|
6310
6312
|
* became permanently false and every v2 length fell back to the v1 plan path.
|
|
6311
6313
|
* 2. ON v2 THE CALLER HANDS US A PROJECTED MEMBER. `selArr()`/`byId()` resolve through
|
|
6312
6314
|
* `v2ProjectedMember`, which returns the plan-space twin (it carries `wp`, not `from`/`to`) because the
|
|
@@ -7034,8 +7036,14 @@ function disarmCm(){cmTool=null;cmArrayMode=false;cmDraft=null;cmHudClose();cmPr
|
|
|
7034
7036
|
if(window.Steel3DView&&window.Steel3DView.cmClear3d)window.Steel3DView.cmClear3d();} // drop the 3D-side pick/preview too
|
|
7035
7037
|
function armCm(tool,array){ // re-arming the same config toggles the tool off — works in 2D and (on the working plane) in 3D
|
|
7036
7038
|
if(cmTool===tool&&cmArrayMode===!!array){disarmCm();render();return;}
|
|
7039
|
+
const refTarget=view3d&&!selIds.size&&refSelectedId&&refSelectedObjIdx===null?refById(refSelectedId):null;
|
|
7040
|
+
if(view3d&&refSelectedObjIdx!==null){toast('Select the whole reference model to move it');return;}
|
|
7041
|
+
if(refTarget&&tool!=='move'){toast('Reference models can only be moved');return;}
|
|
7042
|
+
if(refTarget&&refDisp(refTarget).locked){toast('“'+refTarget.name+'” is locked — unlock it to move it');return;}
|
|
7043
|
+
const refObjects=refTarget&&(refGeom.get(refTarget.id)||{}).objects;
|
|
7044
|
+
if(refTarget&&(!Array.isArray(refObjects)||!refObjects.length)){toast(refLoading.has(refTarget.id)?'Still reading its geometry — try again in a moment':'There is no reference geometry to move yet');return;}
|
|
7037
7045
|
if(view3d&&window.Steel3DView){const dm=document.getElementById('m3dDim');if(dm&&dm.classList.contains('on'))window.Steel3DView.toggleDimTool();if(window.Steel3DView.disarmFrame3d)window.Steel3DView.disarmFrame3d();if(window.Steel3DView.armRefMeasure3d){window.Steel3DView.armRefMeasure3d(null);refMeasureClear();}} // the 3D dim tool + the local frame share the left-click — disarm both
|
|
7038
|
-
if(!selIds.size){toast('Select members first, then '+(tool==='move'?'Move':'Copy'));return;}
|
|
7046
|
+
if(!selIds.size&&!refTarget){toast(view3d&&tool==='move'?'Select members or a reference model first, then Move':'Select members first, then '+(tool==='move'?'Move':'Copy'));return;}
|
|
7039
7047
|
if(mode==='add'){mode='sel';setMode();if(window.Steel3DView&&window.Steel3DView.drClear3d)window.Steel3DView.drClear3d();}
|
|
7040
7048
|
if(dimMode){dimMode=false;setDimMode();}
|
|
7041
7049
|
if(csaxisMode){csaxisMode=false;setCsMode();}
|
|
@@ -7348,6 +7356,7 @@ svg.addEventListener('pointerdown',e=>{if(e.button!==0)return;const t=e.target;
|
|
|
7348
7356
|
if(isDimAnchorableMember(m))gm={mid:m.id,pt:ref0.pt,rigid:ref0.pt==='mid'||(m.role||'beam')==='column',ow:[m.wp[0].slice(),m.wp[1].slice()],oa:(end===0?d0.a:d0.b).slice()};}
|
|
7349
7357
|
buildSnap(gm?new Set([id,gm.mid]):id);drag={type:'dimend',id,end,grip:gm,pre:snapshot()};svg.setPointerCapture(e.pointerId);e.preventDefault();return;}
|
|
7350
7358
|
if(t.dataset.dim&&mode==='sel'&&selDimOK()){const did=t.dataset.dim,add=e.ctrlKey||e.metaKey;
|
|
7359
|
+
clearWholeReferenceSelection();
|
|
7351
7360
|
if(!add&&_lastDimDown&&_lastDimDown.id===did&&(e.timeStamp-_lastDimDown.t)<400){_lastDimDown=null;selDimIds=new Set([did]);openDimEdit(did);e.preventDefault();return;} // F8: double-click a dim → value editor. Detected HERE (in pointerdown), NOT via the native dblclick event, so the select-render between the two clicks can't swallow it (Codex R4 #2).
|
|
7352
7361
|
_lastDimDown={id:did,t:e.timeStamp};
|
|
7353
7362
|
selIds.clear();if(!add)selGridIds.clear(); // a plain dim click is exclusive (clears member + grid selection); Ctrl keeps an intentional mixed grid/dim selection. Dimensions select-switch off → click falls through (inert)
|
|
@@ -7920,16 +7929,17 @@ addEventListener('keydown',e=>{
|
|
|
7920
7929
|
if(k==='z'&&!e.shiftKey){e.preventDefault();doUndo();}
|
|
7921
7930
|
else if(k==='y'||(k==='z'&&e.shiftKey)){e.preventDefault();doRedo();}
|
|
7922
7931
|
else if(k==='d'&&selIds.size){e.preventDefault();doDup();}
|
|
7923
|
-
else if(k==='a'&&!inForm){e.preventDefault(); // Ctrl+A — select
|
|
7924
|
-
// Scope to what's VISIBLE: 3D asks the renderer
|
|
7925
|
-
const
|
|
7926
|
-
selIds=new Set(
|
|
7932
|
+
else if(k==='a'&&!inForm){e.preventDefault(); // Ctrl+A — select every visible/selectable object: 3D members + connection parts, plus logical grids when their switch is on; 2D keeps its members + dims + grids scope.
|
|
7933
|
+
// Scope to what's VISIBLE: 3D asks the renderer after legend/isolate/work-area/selection-hide filtering, then the editor applies its per-type Select switches. 2D uses the active plan, matching its marquee.
|
|
7934
|
+
const objectIds=view3d?(window.Steel3DView&&window.Steel3DView.visibleObjectIds?window.Steel3DView.visibleObjectIds():[]):P.members.map(m=>m.id);
|
|
7935
|
+
selIds=new Set(objectIds.filter(selIdOK));
|
|
7927
7936
|
selDimIds.clear();sel3dDimIds.clear();selGridIds.clear();
|
|
7928
|
-
if(selGridOK())selGridIds=new Set(gridSelectables().map(g=>g.id));
|
|
7937
|
+
if(selGridOK())selGridIds=new Set(view3d?(window.Steel3DView&&window.Steel3DView.visibleGridIds?window.Steel3DView.visibleGridIds():[]):gridSelectables().map(g=>g.id));
|
|
7929
7938
|
if(!view3d){ // the 2D-drawable dimensions join the sweep
|
|
7930
7939
|
if(selDimOK()&&dimsVisible)selDimIds=new Set((P.dims||[]).map(d=>d.id)); // dimensions now included — fixes the reported "Ctrl+A doesn't select dimensions" (skip when dims are hidden, like the marquee)
|
|
7931
7940
|
}
|
|
7932
|
-
|
|
7941
|
+
if(selIds.size||selDimIds.size||selGridIds.size)clearWholeReferenceSelection();
|
|
7942
|
+
render();}
|
|
7933
7943
|
else if(k==='s'){e.preventDefault();persist();(window.flushContract?window.flushContract():Promise.resolve()).then(()=>toast('Saved ✓')).catch(()=>toast('Save failed'));}}); // edits autosave; Ctrl+S just flushes now (no browser "save page" dialog)
|
|
7934
7944
|
// zoom bar
|
|
7935
7945
|
document.getElementById('zIn').onclick=()=>zoomCentered(zoom*1.25);
|
|
@@ -8423,6 +8433,15 @@ function modelReadsV2(){
|
|
|
8423
8433
|
return {g,geo:gc.gridGeometry(g,V2_PT_PER_FT,V2_GRID_OPTS),k:1,flipY:false};}, // k=1 and no flip: the stored coordinates ARE the scene's
|
|
8424
8434
|
};
|
|
8425
8435
|
}
|
|
8436
|
+
// One canvas has one action target. Direct native/grid/clip sinks call this before taking selection for
|
|
8437
|
+
// immediate state coherence, and render() is the invariant boundary that covers 2D + programmatic sinks.
|
|
8438
|
+
function clearWholeReferenceSelection(){
|
|
8439
|
+
if(!refSelectedId)return false;
|
|
8440
|
+
refSelectedId=null;refSelectedObjIdx=null;
|
|
8441
|
+
const v=window.Steel3DView;if(v&&v.selectReference)v.selectReference(null);
|
|
8442
|
+
if(legendTab==='refs')renderRefsTab();
|
|
8443
|
+
return true;
|
|
8444
|
+
}
|
|
8426
8445
|
const view3dApi={
|
|
8427
8446
|
// The model read half — see modelReadsV1 / modelReadsV2 above. Built ONCE per view init; the arm is
|
|
8428
8447
|
// decided by MODEL_RO, which boot() pinned from the validated type and nothing changes afterwards.
|
|
@@ -8459,14 +8478,14 @@ const view3dApi={
|
|
|
8459
8478
|
for(const p of (C.detail_placements||[])){if(!p||!p.id)continue;const raw=C.custom_details[p.detailName];if(raw==null)continue;const url=String(raw).startsWith('data:')?raw:'data:image/jpeg;base64,'+raw;const el={kind:'image',id:'det:'+p.id,group:'detail',url,pos:p.pos||[0,0,0],u:p.u,n:p.n,rotZ:p.rotZ||0,size:p.size||1000,opacity:p.opacity==null?1:p.opacity};sc.elements.push(el);pb[el.id]=el;}
|
|
8460
8479
|
copesByMember=cm;partsById=pb;return sc;}, // cache resolved parts by id (real dims for the part Inspector) AND cope labels per member; placed details ride in as image elements
|
|
8461
8480
|
|
|
8462
|
-
onSelect:(id,additive)=>{if(id&&!selIdOK(id))return;selDimIds.clear();sel3dDimIds.clear();if(!id){selIds=new Set();if(!additive)selGridIds.clear();}else{if(additive){selIds.has(id)?selIds.delete(id):selIds.add(id);}else{selIds=new Set([id]);selGridIds.clear();}}render();if(window.Steel3DView&&window.Steel3DView.refreshDims)window.Steel3DView.refreshDims();}, // 3D pick → shared model-wide selection (byId/selArr span all sheets, so no plan switch needed; clears dimension + non-additive grid selection so Delete is unambiguous). A filtered object (Select switch off) is inert.
|
|
8481
|
+
onSelect:(id,additive)=>{if(id&&!selIdOK(id))return;if(id)clearWholeReferenceSelection();selDimIds.clear();sel3dDimIds.clear();if(!id){selIds=new Set();if(!additive)selGridIds.clear();}else{if(additive){selIds.has(id)?selIds.delete(id):selIds.add(id);}else{selIds=new Set([id]);selGridIds.clear();}}render();if(window.Steel3DView&&window.Steel3DView.refreshDims)window.Steel3DView.refreshDims();}, // 3D pick → shared model-wide selection (byId/selArr span all sheets, so no plan switch needed; clears dimension + non-additive grid selection so Delete is unambiguous). A filtered object (Select switch off) is inert.
|
|
8463
8482
|
onSelectMany:(ids,additive)=>{const ids2=(ids||[]).filter(selIdOK); // 3D box / whole-connection → gate each framed id through the Select switches (members by type, connection parts by kind)
|
|
8464
8483
|
if(!additive&&(ids||[]).length&&!ids2.length)return; // a direct pick / box that caught ONLY filtered objects → inert (leave the current selection), matching a filtered single-pick; a genuinely empty box (ids empty) still falls through and clears
|
|
8465
|
-
selDimIds.clear();sel3dDimIds.clear();
|
|
8484
|
+
if(ids2.length)clearWholeReferenceSelection();selDimIds.clear();sel3dDimIds.clear();
|
|
8466
8485
|
if(additive){for(const id of ids2)selIds.has(id)?selIds.delete(id):selIds.add(id);} // Ctrl/Shift + 3D area-select → toggle each framed object into the current selection (add/remove), like Tekla — spans sheets
|
|
8467
8486
|
else{selIds=new Set(ids2);selGridIds.clear();}
|
|
8468
8487
|
if(mode==='add'){mode='sel';setMode();}render();if(window.Steel3DView&&window.Steel3DView.refreshDims)window.Steel3DView.refreshDims();}, // 3D box-select → shared selection
|
|
8469
|
-
onSelectBatch:({memberIds=[],gridIds=[]},additive)=>{const mids=memberIds.filter(selIdOK),gridAllowed=selGridOK(),gids=gridAllowed?gridIds:[];if(!additive&&(memberIds.length||gridIds.length)&&!mids.length&&!gids.length)return;selDimIds.clear();sel3dDimIds.clear();if(additive){for(const id of mids)selIds.has(id)?selIds.delete(id):selIds.add(id);for(const id of gids)selGridIds.has(id)?selGridIds.delete(id):selGridIds.add(id);}else{selIds=new Set(mids);selGridIds=new Set(gids);if(window.Steel3DView&&window.Steel3DView.setSelectedClips)window.Steel3DView.setSelectedClips([]);}render();if(window.Steel3DView&&window.Steel3DView.refreshDims)window.Steel3DView.refreshDims();}, // Atomic 3D area/direct pick for members + logical grids: filter each class, toggle additively, otherwise replace both selections together.
|
|
8488
|
+
onSelectBatch:({memberIds=[],gridIds=[]},additive)=>{const mids=memberIds.filter(selIdOK),gridAllowed=selGridOK(),gids=gridAllowed?gridIds:[];if(!additive&&(memberIds.length||gridIds.length)&&!mids.length&&!gids.length)return;if(mids.length||gids.length)clearWholeReferenceSelection();selDimIds.clear();sel3dDimIds.clear();if(additive){for(const id of mids)selIds.has(id)?selIds.delete(id):selIds.add(id);for(const id of gids)selGridIds.has(id)?selGridIds.delete(id):selGridIds.add(id);}else{selIds=new Set(mids);selGridIds=new Set(gids);if(window.Steel3DView&&window.Steel3DView.setSelectedClips)window.Steel3DView.setSelectedClips([]);}render();if(window.Steel3DView&&window.Steel3DView.refreshDims)window.Steel3DView.refreshDims();}, // Atomic 3D area/direct pick for members + logical grids: filter each class, toggle additively, otherwise replace both selections together.
|
|
8470
8489
|
// THE MEMBER LIST. v1 keeps one per sheet; v2 keeps ONE at the document root, which IS the whole model —
|
|
8471
8490
|
// so for v2 both of these answer the same list, truthfully, rather than the silent [] that reading
|
|
8472
8491
|
// `C.plans[].members` would give (§8.3). The view takes ids and hands the records back to
|
|
@@ -8490,6 +8509,9 @@ const view3dApi={
|
|
|
8490
8509
|
originGrid:()=>({on:originGridOn,incMm:originGridInc*25.4}), // UCS Stage 6 origin-relative snap — read live per hover; incMm from the inches step. Off ⇒ view skips it; requires a local frame to have any effect
|
|
8491
8510
|
canSelectId:(id)=>selIdOK(id), // Select-filter predicate for the 3D view (e.g. don't draw a whole-connection envelope for a fully-filtered connection)
|
|
8492
8511
|
canSelectGrid:()=>selGridOK(), // Grid line/bubble picks and area selection obey the same Select switch as 2D.
|
|
8512
|
+
canSelectReference:()=>selReferenceOK(), // Reference picks/drills obey their 3D-only Select switch; visibility and snapping stay independent.
|
|
8513
|
+
gridScopeKey:()=>MODEL_V2?'model':String(((C&&Number.isInteger(C.active))?C.active:'')+':'+((P&&P.sheet)||'')), // v2's grid is model-global; v1 needs the plan index too because its valid schema permits duplicate sheet labels
|
|
8514
|
+
onGridSelectionReset:()=>queueMicrotask(()=>{if(!selGridIds.size)return;selGridIds.clear();render();}), // a grid rebuild may invalidate positional ids; mirror the renderer reset after its current stack completes
|
|
8493
8515
|
ptPerFt:()=>MODEL_V2?v2Refuse('ptPerFt — a drawing scale belongs to a SHEET; v2 members and grid are world mm'):(P&&P.pt_per_ft>0?P.pt_per_ft:1),
|
|
8494
8516
|
defaultTosMm:()=>MODEL_V2?v2Refuse('defaultTosMm — v2 materialised every elevation, so a substituted default would silently relocate members'):(defaultTOS!=null?defaultTOS*25.4:0), // editor stores default T.O.S in inches
|
|
8495
8517
|
geoMode:()=>geoMode, // 'el' | 'split' | null — armed Trim/Extend/Split state
|
|
@@ -8549,7 +8571,7 @@ const view3dApi={
|
|
|
8549
8571
|
onDeleteDim3d:(id)=>{if(!canWriteModel())return;C.dims3d=(C.dims3d||[]).filter(x=>x.id!==id);sel3dDimIds.delete(id);scheduleSave();refreshDims3d();},
|
|
8550
8572
|
onSelectDim3d:(id,mods)=>{ // Ctrl/Shift multi-select (same as parts); selecting a dim is exclusive with member/2D-dim/clip selection
|
|
8551
8573
|
if(id&&!selDimOK())return; // Dimensions select-switch off → a 3D dim is inert too
|
|
8552
|
-
if(!id){sel3dDimIds.clear();render();return;}
|
|
8574
|
+
if(!id){sel3dDimIds.clear();render();return;}clearWholeReferenceSelection();
|
|
8553
8575
|
selIds=new Set();selDimIds.clear();selGridIds.clear();if(window.Steel3DView&&window.Steel3DView.setSelectedClips)window.Steel3DView.setSelectedClips([]);
|
|
8554
8576
|
const ids=(C.dims3d||[]).map(d=>d.id),cur=new Set(sel3dDimIds);let next;
|
|
8555
8577
|
if(mods&&mods.shift&&dim3dAnchor!=null&&ids.includes(dim3dAnchor)&&ids.includes(id)){const i0=ids.indexOf(dim3dAnchor),i1=ids.indexOf(id);next=ids.slice(Math.min(i0,i1),Math.max(i0,i1)+1);}
|
|
@@ -8567,11 +8589,17 @@ const view3dApi={
|
|
|
8567
8589
|
// app under the cursor without a round-trip per pointer move. Advisory: the release re-resolves.
|
|
8568
8590
|
hostWindows:async()=>{try{const r=await fetch('/api/host-windows');return await r.json();}catch(e){return null;}},
|
|
8569
8591
|
// 3D Move/Copy: the 3D view reads the armed tool + counts, and hands commit offsets back in scene mm.
|
|
8570
|
-
cmState:()=>cmTool?{tool:cmTool,array:cmArrayMode,count:cmCount,countA:cmCountA,countB:cmCountB}:null,
|
|
8592
|
+
cmState:()=>cmTool?{tool:cmTool,array:cmArrayMode,count:cmCount,countA:cmCountA,countB:cmCountB,referenceId:(view3d&&refSelectedObjIdx===null?refSelectedId:null)}:null,
|
|
8571
8593
|
// mm → plan px (Y FLIPPED) + inches for dz, now owned by the model boundary. toDisplayOffsets MUTATES
|
|
8572
8594
|
// NOTHING on purpose: cmApplyOffsets below is what moves the members, and it also owns the empty-selection
|
|
8573
8595
|
// toast, the 100-copy cap and the distance toast — which measures from these same ROUNDED offsets.
|
|
8574
|
-
onTransform3d:(offsMm)=>{
|
|
8596
|
+
onTransform3d:(offsMm)=>{const refTarget=refSelectedId&&refSelectedObjIdx===null?refById(refSelectedId):null;
|
|
8597
|
+
if(refTarget&&cmTool==='move'&&!selIds.size){const off=offsMm&&offsMm[0];if(!off||off.length<3)return;
|
|
8598
|
+
if(refDisp(refTarget).locked){toast('“'+refTarget.name+'” is locked — unlock it to move it');disarmCm();render();return;}
|
|
8599
|
+
const old=(refTarget.placement&&refTarget.placement.origin)||[0,0,0],next=[0,1,2].map(i=>(Number(old[i])||0)+(Number(off[i])||0));
|
|
8600
|
+
refEdit(refTarget.id,{placement:{origin:next}});
|
|
8601
|
+
toast('Moved 1 reference model · '+fmtFtIn(Math.hypot(off[0],off[1],off[2])/25.4));panel();return;}
|
|
8602
|
+
cmApplyOffsets(MC().toDisplayOffsets(offsMm));},
|
|
8575
8603
|
disarmTransform:()=>{if(cmTool){disarmCm();render();}}, // the 3D dim tool arming kicks Move/Copy off the left-click
|
|
8576
8604
|
// 3D draw-on-plane (spec §7): the editor's add-member mode + profile drive it; two plane picks (scene mm) come back here.
|
|
8577
8605
|
addModeActive:()=>mode==='add',
|
|
@@ -8596,7 +8624,7 @@ const view3dApi={
|
|
|
8596
8624
|
selIds=new Set([id]);});
|
|
8597
8625
|
const asCol=hIn<6&&dzIn>6;
|
|
8598
8626
|
toast('Added '+(asCol?'a column':'a beam')+' on the working plane'+(((addType==='column')!==asCol)?' — the pick geometry set the type, not '+memberTypeLabel(addType):''));}, // say it out loud when 3D geometry overrode the Add panel's type
|
|
8599
|
-
onClipsChange:()=>{build3DLegend();}, // a clip added / removed / toggled → rebuild the legend's Clip section
|
|
8627
|
+
onClipsChange:()=>{const v=window.Steel3DView;if(v&&v.selectedClips&&v.selectedClips().length)clearWholeReferenceSelection();build3DLegend();}, // a clip added / removed / toggled → its renderer-side selection also takes the one action target, then rebuild the legend's Clip section
|
|
8600
8628
|
beginClipEdit:()=>pushUndo(snapshot()), // a clip / work-area manipulation → push a pre-edit snapshot so Ctrl+Z/Y restores it
|
|
8601
8629
|
onClipModeChange:(m)=>{const b=document.getElementById('m3dClip');if(b){b.classList.toggle('on',!!m);b.textContent=m?'Clip ✕':'Clip ▾';}}, // armed → button fills brand-blue + becomes a cancel target (✕ = cancel)
|
|
8602
8630
|
onInsertModeChange:(on)=>{const b=document.getElementById('m3dInsert');if(b){b.classList.toggle('on',!!on);b.textContent=on?'✕ Cancel insert':'Insert…';} if(!on)favDisarmed();}, // armed → cancel target; disarm also clears any armed favourite (the pinned bar + the .armed row)
|
|
@@ -8610,22 +8638,16 @@ const view3dApi={
|
|
|
8610
8638
|
// describing the first object while the 3D view highlights the second.
|
|
8611
8639
|
onReferenceSelect:(id,obj)=>{
|
|
8612
8640
|
const nextId=id||null,nextIdx=obj&&Number.isInteger(obj.index)?obj.index:null;
|
|
8613
|
-
|
|
8641
|
+
const nativeSelected=selIds.size||selDimIds.size||selGridIds.size||sel3dDimIds.size;
|
|
8642
|
+
if(refSelectedId===nextId&&refSelectedObjIdx===nextIdx&&!(nextId&&nativeSelected))return;
|
|
8614
8643
|
refSelectedId=nextId;refSelectedObjIdx=nextIdx;
|
|
8615
|
-
//
|
|
8616
|
-
//
|
|
8617
|
-
//
|
|
8618
|
-
//
|
|
8619
|
-
|
|
8620
|
-
//
|
|
8621
|
-
// Only a DRILL steals. Selecting a whole reference (a row click) does not take the panel, so it has no
|
|
8622
|
-
// business taking the selection either.
|
|
8623
|
-
//
|
|
8624
|
-
// This is also what keeps `panel()`'s release guard from fighting an intentional drill: the guard fires
|
|
8625
|
-
// when something of ours is selected, and by the time it runs, nothing is. The browser pass caught
|
|
8626
|
-
// that — with a marquee selection live, drilling was silently impossible.
|
|
8627
|
-
const stole=nextIdx!==null&&(selIds.size||selDimIds.size||selGridIds.size||sel3dDimIds.size);
|
|
8644
|
+
// A REFERENCE TAKES THE SELECTION, whole or drilled. Move with two points accepts a whole reference,
|
|
8645
|
+
// so letting a beam remain selected would make one toolbar command have two incompatible targets.
|
|
8646
|
+
// Drilling already needed the same exclusivity for a more dangerous reason: the panel could describe
|
|
8647
|
+
// an IFC object while Delete and the arrow keys still acted on our beam. One canvas now has one target.
|
|
8648
|
+
const stole=nextId!==null&&!!nativeSelected;
|
|
8628
8649
|
if(stole){selIds.clear();selDimIds.clear();selGridIds.clear();sel3dDimIds.clear();}
|
|
8650
|
+
if(nextId&&window.Steel3DView&&window.Steel3DView.setSelectedClips)window.Steel3DView.setSelectedClips([]);
|
|
8629
8651
|
// The object tree, if the user has it open, comes to the object — see `revealRefTreeObject`. It
|
|
8630
8652
|
// repaints the tab itself, so the ordinary repaint below is skipped when it did.
|
|
8631
8653
|
if(!(nextId&&nextIdx!==null&&revealRefTreeObject(nextId,nextIdx))&&legendTab==='refs')renderRefsTab();
|
|
@@ -8818,6 +8840,7 @@ let clipAnchor=null;
|
|
|
8818
8840
|
// Shift = the range from the anchor (in list order). Selecting a clip clears member/dim/grid selection (exclusive).
|
|
8819
8841
|
function clipSelect(id,e){
|
|
8820
8842
|
if(!window.Steel3DView)return;
|
|
8843
|
+
clearWholeReferenceSelection();
|
|
8821
8844
|
if(selIds.size||sel3dDimIds.size||selGridIds.size||(typeof selDimIds!=='undefined'&&selDimIds.size)){selIds=new Set();sel3dDimIds.clear();selGridIds.clear();if(typeof selDimIds!=='undefined')selDimIds.clear();render();}
|
|
8822
8845
|
const ids=window.Steel3DView.getClips().map(c=>c.id),cur=new Set(window.Steel3DView.selectedClips());
|
|
8823
8846
|
let next;
|
|
@@ -11857,7 +11880,7 @@ function build3DLegend(){const host=document.getElementById('m3dLegendBody');if(
|
|
|
11857
11880
|
// Contextual visibility menu: selection exposes Isolate/Hide; any active object filter keeps Show all reachable
|
|
11858
11881
|
// after Hide selected clears that now-invisible selection. Updated on selection change + every visibility callback.
|
|
11859
11882
|
function updateIsolateBtn(){const wrap=document.getElementById('m3dIsoWrap'),b=document.getElementById('m3dIso'),menu=document.getElementById('m3dIsoMenu');if(!wrap||!b||!menu||!window.Steel3DView)return;
|
|
11860
|
-
const V=window.Steel3DView,filtered=V.hasVisibilityFilter?V.hasVisibilityFilter():!!(V.isIsolated&&V.isIsolated()),hasSel=selIds.size>0;
|
|
11883
|
+
const V=window.Steel3DView,filtered=V.hasVisibilityFilter?V.hasVisibilityFilter():!!(V.isIsolated&&V.isIsolated()),hasSel=selIds.size>0||selGridIds.size>0;
|
|
11861
11884
|
const visible=filtered||hasSel;if(!visible&&wrap.contains(document.activeElement)){const stable=document.getElementById('m3dViewsBtn');if(stable)stable.focus();}wrap.style.display=visible?'':'none';b.classList.toggle('on',filtered);b.textContent=filtered?'Show all ▾':'Isolate ▾';
|
|
11862
11885
|
b.setAttribute('data-tip',filtered?'Restore hidden objects or change the current selection’s visibility':'Visibility actions for the selected objects');
|
|
11863
11886
|
const show=menu.querySelector('[data-vis=show-all]'),div=menu.querySelector('[data-vis-divider]'),iso=menu.querySelector('[data-vis=isolate]'),hide=menu.querySelector('[data-vis=hide]');
|
|
@@ -11886,6 +11909,7 @@ function refresh3DLegend(){if(!window.Steel3DView)return;const st=window.Steel3D
|
|
|
11886
11909
|
function legendRowClick(e,row){if(row&&row._dragging)return;const mods={ctrl:e.ctrlKey||e.metaKey,shift:e.shiftKey};clearTimeout(leg3dClickT);if(mods.ctrl||mods.shift)legendSelect(row,mods);else leg3dClickT=setTimeout(()=>legendSelect(row,mods),220);}
|
|
11887
11910
|
function legendSelect(row,mods){
|
|
11888
11911
|
if(!row)return;const ids=legRowIds(row);if(!ids.length)return;
|
|
11912
|
+
clearWholeReferenceSelection();
|
|
11889
11913
|
if(mods&&mods.shift&&legendSelAnchor&&document.body.contains(legendSelAnchor)){ // Shift → union every VISIBLE object row from the anchor to here (a search-hidden row can't be range-selected)
|
|
11890
11914
|
const rows=[...document.querySelectorAll('#m3dLegend .lrow[data-key]:not(.qhide),#m3dLegend .lrow[data-connkey]:not(.qhide)')];
|
|
11891
11915
|
const i0=rows.indexOf(legendSelAnchor),i1=rows.indexOf(row);
|
|
@@ -12133,7 +12157,7 @@ function wire3DBar(){if(bar3dWired||!window.Steel3DView)return;bar3dWired=true;
|
|
|
12133
12157
|
isoMenu.classList.add('open');isoBtn.setAttribute('aria-expanded','true');document.addEventListener('mousedown',isoMenuOutside,true);menuItems(isoMenu)[0]?.focus();}};
|
|
12134
12158
|
isoMenu.querySelector('[data-vis=show-all]').onclick=()=>{d3.showAllGroups();isoMenuClose(true);toast('Showing all objects');};
|
|
12135
12159
|
isoMenu.querySelector('[data-vis=isolate]').onclick=()=>{d3.isolateSelected();isoMenuClose(true);};
|
|
12136
|
-
isoMenu.querySelector('[data-vis=hide]').onclick=()=>{const n=d3.hideSelected?d3.hideSelected():0;if(n){selIds.clear();render();toast(n+' object'+(n===1?'':'s')+' hidden');}isoMenuClose(true);};
|
|
12160
|
+
isoMenu.querySelector('[data-vis=hide]').onclick=()=>{const n=d3.hideSelected?d3.hideSelected():0;if(n){selIds.clear();selGridIds.clear();render();toast(n+' object'+(n===1?'':'s')+' hidden');}isoMenuClose(true);};
|
|
12137
12161
|
isoBtn.addEventListener('keydown',e=>{if(e.key==='Escape'&&isoMenu.classList.contains('open')){e.preventDefault();e.stopPropagation();isoMenuClose(true);}else if((e.key==='ArrowDown'||e.key==='Enter'||e.key===' ')&&!isoMenu.classList.contains('open')){e.preventDefault();e.stopPropagation();isoBtn.click();}});
|
|
12138
12162
|
isoMenu.addEventListener('keydown',e=>menuKeys(e,isoMenu,isoBtn,isoMenuClose));
|
|
12139
12163
|
// Views toolbar button: open the panel on the Views tab (or, if it's already open on Views, toggle it closed — a natural toolbar toggle).
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
*
|
|
5
5
|
* The filter pre-stage isolates the real steel linework on a drawing before the takeoff reader binds
|
|
6
6
|
* profile labels to it. The host AI runs ONE PyMuPDF pass at compose time and writes a `filter` block
|
|
7
|
-
* onto the steel.
|
|
7
|
+
* onto the steel.model/v2 contract; this module is the pure match/selection logic the view and the
|
|
8
8
|
* reader both reason about. Lifted from the steel-parts-from-pdf.flo spike (`matchesActive`), extended
|
|
9
9
|
* with persistence (`on` flags) and the eyedropper add.
|
|
10
10
|
*
|
|
11
11
|
* Shapes:
|
|
12
12
|
* element : { kind:'line'|'text', layer:string, w:number, color:string, d?:string, text?:string, bbox?:number[], dashed?:boolean }
|
|
13
13
|
* mode : any '+'-joined combo of 'layer'/'thickness'/'color', AND-ed (e.g. 'thickness+layer').
|
|
14
|
-
* '' = match nothing. Canonical order = MODE_ORDER
|
|
14
|
+
* '' = match nothing. Canonical order = MODE_ORDER.
|
|
15
15
|
* sel : { layers:Set<string>, thicknesses:Set<number>, colors:Set<string> }
|
|
16
16
|
* filter : { mode, layers:[{name,count,steel?,drawable?,on?}], thicknesses:[{w,count,on?}], colors:[{hex,count,on?}], elements:[…] }
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
/** Canonical dimension order for a mode string
|
|
19
|
+
/** Canonical dimension order for a mode string. */
|
|
20
20
|
const MODE_ORDER = ['thickness', 'layer', 'color'];
|
|
21
21
|
|
|
22
22
|
/** The dimensions a mode activates, order-agnostic: 'thickness+layer' -> ['thickness','layer']. */
|
|
@@ -182,31 +182,11 @@ export function applySelToFilter(filter, sel, mode) {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
|
-
*
|
|
186
|
-
* at the top level; the multi-sheet shape carries `sheets:[{sheet,title?,page,steelBbox,elements}]`
|
|
187
|
-
* + `active`. This returns `{ sheets, active }` for both, wrapping a legacy filter into one sheet so
|
|
188
|
-
* the view has a single code path. Facets (layers/thicknesses/colors) are GLOBAL and stay on the
|
|
189
|
-
* filter object — they are not touched here.
|
|
190
|
-
*
|
|
191
|
-
* ponytail: back-compat bridge for pre-multisheet contracts. Upgrade path: drop the legacy branch
|
|
192
|
-
* once no single-sheet contracts remain in the wild (the view migrates them forward on Save).
|
|
185
|
+
* Normalize the native multi-sheet Drawing Filter shape. Facets remain global on the filter object.
|
|
193
186
|
*/
|
|
194
187
|
export function normalizeFilter(filter) {
|
|
195
188
|
if (!filter || typeof filter !== 'object') return { sheets: [], active: 0 };
|
|
196
|
-
|
|
197
|
-
if (Array.isArray(filter.sheets)) {
|
|
198
|
-
sheets = filter.sheets;
|
|
199
|
-
} else if (Array.isArray(filter.elements) && filter.elements.length) {
|
|
200
|
-
sheets = [{
|
|
201
|
-
sheet: filter.sheet || '',
|
|
202
|
-
title: filter.title,
|
|
203
|
-
page: filter.page,
|
|
204
|
-
steelBbox: filter.steelBbox,
|
|
205
|
-
elements: filter.elements,
|
|
206
|
-
}];
|
|
207
|
-
} else {
|
|
208
|
-
sheets = [];
|
|
209
|
-
}
|
|
189
|
+
const sheets = Array.isArray(filter.sheets) ? filter.sheets : [];
|
|
210
190
|
const n = sheets.length;
|
|
211
191
|
const a = Number.isInteger(filter.active) ? filter.active : 0;
|
|
212
192
|
const active = (n === 0 || a < 0 || a >= n) ? 0 : a;
|
|
@@ -254,7 +234,8 @@ export const NOTE_TEXT = 'Updated externally';
|
|
|
254
234
|
export function statChip(state) {
|
|
255
235
|
switch (state) {
|
|
256
236
|
case 'dirty': return { cls: 'dirty', text: 'Unsaved ', badge: '●' };
|
|
257
|
-
case '
|
|
237
|
+
case 'saving': return { cls: '', text: 'Saving filter…', badge: null };
|
|
238
|
+
case 'saved': return { cls: 'saved', text: 'Filter saved ', badge: '✓' };
|
|
258
239
|
case 'err': return { cls: 'err', text: 'Save failed ', badge: '✕' };
|
|
259
240
|
// Not an error: the user's selection is fine, the model simply moved under them.
|
|
260
241
|
case 'conflict': return { cls: 'conflict', text: 'Save conflict', badge: null };
|
|
@@ -190,7 +190,7 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
190
190
|
</head>
|
|
191
191
|
<body>
|
|
192
192
|
<header>
|
|
193
|
-
<b>
|
|
193
|
+
<b>Drawing Filter</b>
|
|
194
194
|
<!-- Ships hidden: a single-sheet set is not a choice, and buildSheetSwitcher() reveals it only when
|
|
195
195
|
there is more than one sheet. See the .sheet-* rules for why this is not a <select>. -->
|
|
196
196
|
<div class="sheet-combo" id="sheetCombo" hidden>
|
|
@@ -215,7 +215,7 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
215
215
|
<span id="src" class="stat"></span>
|
|
216
216
|
<span class="sp"></span>
|
|
217
217
|
<span id="saved" class="stat"></span>
|
|
218
|
-
<button id="save" class="primary" disabled>Save</button>
|
|
218
|
+
<button id="save" class="primary" disabled>Save filter</button>
|
|
219
219
|
</header>
|
|
220
220
|
<div id="app">
|
|
221
221
|
<aside id="panel">
|
|
@@ -256,7 +256,7 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
256
256
|
</svg>
|
|
257
257
|
<div id="empty" role="status" aria-live="polite">
|
|
258
258
|
<div>
|
|
259
|
-
<h1>
|
|
259
|
+
<h1>Drawing Filter isn’t ready yet.</h1>
|
|
260
260
|
<p class="empty-body" hidden></p>
|
|
261
261
|
<!-- "then reload" is GONE, and #441 is what earned that: until it landed, the pre-read verb
|
|
262
262
|
(server/steel-prepass-route.ts) broadcast nothing at all, so this hint could only tell the user
|
|
@@ -271,7 +271,7 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
271
271
|
which broadcast) — that failure is the AI's to report, in the terminal where the user asked
|
|
272
272
|
for it — and a re-bake whose result is canonically equal to what is already stored, where
|
|
273
273
|
there is nothing new to show. -->
|
|
274
|
-
<p class="hint" style="margin-top:8px;max-width:340px">
|
|
274
|
+
<p class="hint" style="margin-top:8px;max-width:340px">Ask your terminal AI to prepare the Drawing Filter. Its layers, line weights and colours will appear here automatically when ready.</p>
|
|
275
275
|
</div>
|
|
276
276
|
</div>
|
|
277
277
|
<!-- The ONLY fit/zoom controls. Labels stay terse so both stay fully legible before the bar's
|
|
@@ -292,7 +292,7 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
292
292
|
import { matchesActive, modeDims, canonicalMode, selFromFilter, eyedropperAdd, countShown, liveOverlayElements, bgRect, textFontSize, applySelToFilter, normalizeFilter, liveUpdateAction, statChip, newMutationId, sheetLabel, NOTE_TEXT } from './steel-filter-core.js';
|
|
293
293
|
|
|
294
294
|
const APP_ID = new URLSearchParams(location.search).get('app') || '';
|
|
295
|
-
// Workspaces
|
|
295
|
+
// Workspaces use a project-keyed contract; an empty project id is the app-keyed workflow surface.
|
|
296
296
|
const PROJECT = new URLSearchParams(location.search).get('project') || '';
|
|
297
297
|
let revisionRequest = new URLSearchParams(location.search).get('revisionRequest') || '';
|
|
298
298
|
const PROJECT_QS = PROJECT ? ('?project=' + encodeURIComponent(PROJECT)) : '';
|
|
@@ -500,7 +500,6 @@ const CHANGE_LEAD = Object.assign(Object.create(null), {
|
|
|
500
500
|
// flattering "one small block" description this comment previously repeated.
|
|
501
501
|
'pre-read': 'The AI started reading a drawing set into this model',
|
|
502
502
|
'revision-read': 'The AI read a revised drawing set into this model',
|
|
503
|
-
'migration': 'This project was converted to the 3D model',
|
|
504
503
|
});
|
|
505
504
|
|
|
506
505
|
// A one-shot note handed to the NEXT load, so a populated view repainting under the user is explained
|
|
@@ -1102,7 +1101,7 @@ async function saveNow(){
|
|
|
1102
1101
|
// A second click while already conflicted must NOT silently re-fire a request we know will fail —
|
|
1103
1102
|
// just re-surface the explanation.
|
|
1104
1103
|
if(conflicted){ showChangedBanner(); return; }
|
|
1105
|
-
saveBtn.disabled = true; setSaved('');
|
|
1104
|
+
saveBtn.disabled = true; setSaved('saving');
|
|
1106
1105
|
// Name this write BEFORE sending it, deliberately: the server broadcasts before it replies, so the echo
|
|
1107
1106
|
// can reach our own listener while this `await` is still pending — and an id we did not yet know would
|
|
1108
1107
|
// read as somebody else's write. NOT a self-reload, as an earlier version of this comment claimed: save()
|
|
@@ -1115,6 +1114,7 @@ async function saveNow(){
|
|
|
1115
1114
|
// BAKED fallback (the GET tags only store-backed documents) — this app has no draft yet — so the
|
|
1116
1115
|
// honest precondition is `If-None-Match: *`, "I believe this store is empty".
|
|
1117
1116
|
if(serverEtag) headers['if-match'] = serverEtag; else headers['if-none-match'] = '*';
|
|
1117
|
+
if(revisionRequest) headers['x-floless-filter-request'] = revisionRequest;
|
|
1118
1118
|
const res = await fetch('/api/contract/' + encodeURIComponent(APP_ID) + PROJECT_QS, { method: 'PUT', headers, body: JSON.stringify(C) });
|
|
1119
1119
|
if(res.status === 428){ // a writer here sent no precondition — a bug in our code, not a user error.
|
|
1120
1120
|
// NOT the conflict copy: nothing else wrote, so "changed somewhere else" would be a lie. This bar
|