@floless/app 0.96.1 → 0.97.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 +20 -6
- package/dist/web/app.css +1 -1
- package/dist/web/steel-editor.html +94 -30
- package/dist/web/workspaces.js +9 -1
- package/package.json +1 -1
package/dist/floless-server.cjs
CHANGED
|
@@ -53106,7 +53106,7 @@ function appVersion() {
|
|
|
53106
53106
|
return resolveVersion({
|
|
53107
53107
|
isSea: isSea2(),
|
|
53108
53108
|
sqVersionXml: readSqVersionXml(),
|
|
53109
|
-
define: true ? "0.
|
|
53109
|
+
define: true ? "0.97.1" : void 0,
|
|
53110
53110
|
pkgVersion: readPkgVersion()
|
|
53111
53111
|
});
|
|
53112
53112
|
}
|
|
@@ -53116,7 +53116,7 @@ function resolveChannel(s) {
|
|
|
53116
53116
|
return "dev";
|
|
53117
53117
|
}
|
|
53118
53118
|
function appChannel() {
|
|
53119
|
-
return resolveChannel({ isSea: isSea2(), define: true ? "0.
|
|
53119
|
+
return resolveChannel({ isSea: isSea2(), define: true ? "0.97.1" : void 0 });
|
|
53120
53120
|
}
|
|
53121
53121
|
|
|
53122
53122
|
// workflow-update.ts
|
|
@@ -56824,6 +56824,8 @@ var GROUPS = {
|
|
|
56824
56824
|
"base-plate": { key: "base-plate", label: "Base plates", color: "#6b7a8d" },
|
|
56825
56825
|
// darkest plate grey
|
|
56826
56826
|
"washer-plate": { key: "washer-plate", label: "Washer plates", color: "#9aafc3" },
|
|
56827
|
+
"anchor-plate": { key: "anchor-plate", label: "Anchor plates", color: "#8293a6" },
|
|
56828
|
+
// embedded bearing plate at the rod's anchored end — mid steel-grey, between base + washer plate
|
|
56827
56829
|
anchor: { key: "anchor", label: "Anchor rods", color: "#b0c4d8" },
|
|
56828
56830
|
// cool zinc-grey
|
|
56829
56831
|
nut: { key: "nut", label: "Nuts", color: "#7a8a9e" },
|
|
@@ -56918,10 +56920,9 @@ function expandBasePlate(joint, col) {
|
|
|
56918
56920
|
const cols = intMin1(p, "boltCols", 2);
|
|
56919
56921
|
const rows = intMin1(p, "boltRows", 2);
|
|
56920
56922
|
const weldLeg = num3(p, "weldLeg", 8);
|
|
56921
|
-
const projBelow = num3(p, "projBelow",
|
|
56923
|
+
const projBelow = num3(p, "projBelow", Math.max(220, 9 * boltDia));
|
|
56922
56924
|
const embedment = Math.max(0, num3(p, "embedment", 0));
|
|
56923
56925
|
const grout = Math.max(0, num3(p, "grout", 0));
|
|
56924
|
-
const rodBelow = embedment > 0 ? grout + embedment : projBelow;
|
|
56925
56926
|
const nutH = pos(p, "nutHeight", 0.8 * boltDia);
|
|
56926
56927
|
const nutAF = pos(p, "nutAcrossFlats", 1.6 * boltDia);
|
|
56927
56928
|
const wpSide = pos(p, "washerPlateSide", 2.5 * boltDia);
|
|
@@ -56930,7 +56931,13 @@ function expandBasePlate(joint, col) {
|
|
|
56930
56931
|
const washerID = boltDia + 3;
|
|
56931
56932
|
const washerH = pos(p, "washerThickness", Math.max(0.25 * boltDia, 4));
|
|
56932
56933
|
const levelingNut = p?.["levelingNut"] !== false;
|
|
56934
|
+
const anchorPlate = p?.["anchorPlate"] !== false;
|
|
56935
|
+
const apSide = pos(p, "anchorPlateSide", 3.3 * boltDia);
|
|
56936
|
+
const apThick = pos(p, "anchorPlateThickness", Math.max(0.6 * boltDia, 20));
|
|
56937
|
+
const bottomNut = p?.["bottomNut"] !== false;
|
|
56938
|
+
const rodProj = pos(p, "anchorRodProjection", 25.4 / 4);
|
|
56933
56939
|
const SEAT = 0.5;
|
|
56940
|
+
const rodBelow = Math.max(embedment > 0 ? grout + embedment : projBelow, rodProj + nutH + apThick + SEAT);
|
|
56934
56941
|
const plateTop = bz + EMBED, plateBottom = plateTop - thickness;
|
|
56935
56942
|
const us = spread(cols, Math.max(0, width / 2 - edge));
|
|
56936
56943
|
const vs = spread(rows, Math.max(0, depth / 2 - edge));
|
|
@@ -56951,6 +56958,10 @@ function expandBasePlate(joint, col) {
|
|
|
56951
56958
|
{ id: `${jid}:fn${k}`, group: "nut", kind: "nut", from: [ax, ay, washerTop], to: [ax, ay, fnTop], acrossFlats: nutAF, meta: { label: `Nut M${boltDia}` } }
|
|
56952
56959
|
);
|
|
56953
56960
|
if (levelingNut) kit.push({ id: `${jid}:ln${k}`, group: "nut", kind: "nut", from: [ax, ay, plateBottom - SEAT - nutH], to: [ax, ay, plateBottom - SEAT], acrossFlats: nutAF, meta: { label: `Leveling nut M${boltDia}` } });
|
|
56961
|
+
const nutBotZ = rodBotZ + rodProj;
|
|
56962
|
+
if (bottomNut) kit.push({ id: `${jid}:fnb${k}`, group: "nut", kind: "nut", from: [ax, ay, nutBotZ], to: [ax, ay, nutBotZ + nutH], acrossFlats: nutAF, meta: { label: `Anchor nut M${boltDia}` } });
|
|
56963
|
+
const apBotZ = nutBotZ + (bottomNut ? nutH : 0);
|
|
56964
|
+
if (anchorPlate) kit.push({ id: `${jid}:ap${k}`, group: "anchor-plate", kind: "plate", center: [ax, ay, apBotZ + apThick / 2], uDir: [1, 0, 0], vDir: [0, 1, 0], width: apSide, depth: apSide, thickness: apThick, holes: [{ u: 0, v: 0, d: boltDia + 2 }], meta: { label: `Anchor plate ${Math.round(apSide)}\xD7${Math.round(apSide)}\xD7${Math.round(apThick)}` } });
|
|
56954
56965
|
k++;
|
|
56955
56966
|
}
|
|
56956
56967
|
}
|
|
@@ -56973,11 +56984,14 @@ function expandBasePlate(joint, col) {
|
|
|
56973
56984
|
anchor: { rodTopZ, rodBotZ, plateBotZ: plateBottom, concreteTopZ, projMm: rodTopZ - plateBottom, groutMm: plateBottom - concreteTopZ, embedMm: concreteTopZ - rodBotZ, embedSet: embedment > 0 }
|
|
56974
56985
|
}
|
|
56975
56986
|
};
|
|
56987
|
+
const axisSign = col.to[2] < col.from[2] ? -1 : 1;
|
|
56988
|
+
const rollRad = (col.rot || 0) * Math.PI * axisSign / 180;
|
|
56989
|
+
const cosR = Math.cos(rollRad), sinR = Math.sin(rollRad);
|
|
56976
56990
|
const weld = {
|
|
56977
56991
|
id: `${joint.id}:weld`,
|
|
56978
56992
|
group: "weld",
|
|
56979
56993
|
kind: "weld",
|
|
56980
|
-
path: profileOutline(col.profile, w, d).map(([u, vv]) => [bx + u, by + vv, bz]),
|
|
56994
|
+
path: profileOutline(col.profile, w, d).map(([u, vv]) => [bx + (u * cosR - vv * sinR), by + (u * sinR + vv * cosR), bz]),
|
|
56981
56995
|
leg: weldLeg,
|
|
56982
56996
|
meta: { label: `Fillet ${weldLeg}` }
|
|
56983
56997
|
};
|
|
@@ -57407,7 +57421,7 @@ function contractToScene(contractInput) {
|
|
|
57407
57421
|
skipped.push(m.id);
|
|
57408
57422
|
continue;
|
|
57409
57423
|
}
|
|
57410
|
-
memberGeo.set(m.id, { id: m.id, role: m.role === "column" ? "column" : "beam", from: workFrom, to: workTo, dims: { w: dims.w, d: dims.d }, profile, posOffset, isBrace: mIsBrace });
|
|
57424
|
+
memberGeo.set(m.id, { id: m.id, role: m.role === "column" ? "column" : "beam", from: workFrom, to: workTo, dims: { w: dims.w, d: dims.d }, profile, posOffset, isBrace: mIsBrace, ...typeof m.rot === "number" ? { rot: -m.rot } : {} });
|
|
57411
57425
|
const clr = beamClear.get(m.id);
|
|
57412
57426
|
if (clr && m.role !== "column" && !mIsBrace) {
|
|
57413
57427
|
const dx = to[0] - from[0], dy = to[1] - from[1], dz = to[2] - from[2];
|
package/dist/web/app.css
CHANGED
|
@@ -3984,7 +3984,7 @@ tr.hist-diff-row[hidden] { display:none; }
|
|
|
3984
3984
|
.kb-g-fit { position: absolute; top: 10px; right: 10px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-muted); border-radius: 6px; padding: 3px 9px; font-size: 12px; cursor: pointer; font: inherit; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); }
|
|
3985
3985
|
.kb-g-fit:hover { color: var(--text); border-color: var(--accent); }
|
|
3986
3986
|
.kb-g-fit[hidden] { display: none; }
|
|
3987
|
-
.kb-g-edge { stroke: color-mix(in srgb, var(--border-strong) 90%, transparent); stroke-width: 1.5; }
|
|
3987
|
+
.kb-g-edge { stroke: color-mix(in srgb, var(--border-strong) 90%, transparent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
|
|
3988
3988
|
.kb-g-node { cursor: pointer; }
|
|
3989
3989
|
.kb-g-hit { fill: transparent; } /* wider click/focus target */
|
|
3990
3990
|
.kb-g-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
|
|
@@ -2242,6 +2242,7 @@ function render(){
|
|
|
2242
2242
|
s+=renderSelLenLabels(); // on-select member-length chips (2D), gated by the ⋯ Display "Show member length" toggle
|
|
2243
2243
|
if(P.frame)s+=axisGlyphSvg(P.frame.o,P.frame.u,false); // local-axes glyph at the origin (only when a frame is set; removed on reset)
|
|
2244
2244
|
svg.innerHTML=s; document.getElementById('profiles').innerHTML=profs.map(p=>`<option value="${esc(p)}">`).join(''); document.getElementById('details').innerHTML=(P.details||[]).map(d=>`<option value="${esc(d.text)}">`).join(''); stats(); panel(); updUR(); updDup(); updConf(); updCS(); updConnBtn(); updBpBtn(); updSpBtn(); updGridToggle(); updLenToggle(); updDimToggle(); updCalloutToggle(); updPlToggle();
|
|
2245
|
+
if(selFilterReady)reflectSelFilter(); // keep the Select-bar Members/Connections buttons in sync with the model — a new/removed connection kind (e.g. the first auto-detailed base plate) flips their on/off without a manual toggle. Gated on selFilterReady so it doesn't run until the deferred first reflect has armed it (that reflect needs BASE_MEMBER_TYPES, initialised later in main()).
|
|
2245
2246
|
if(view3d&&window.Steel3DView){window.Steel3DView.setSelection(selIds);updateIsolateBtn();if(selIds.size&&window.Steel3DView.selectedClips&&window.Steel3DView.selectedClips().length)window.Steel3DView.setSelectedClips([]);refreshLegendSel();} // keep the 3D highlight + legend selection in sync; selecting a member clears any clip selection (exclusive)
|
|
2246
2247
|
try{updateConnCrumb();}catch(_){} // Connection Component breadcrumb follows the selection (3D-only; hidden at root)
|
|
2247
2248
|
syncPropLabelsAfterRender(); // corner-note + push labels to 3D + refresh the popup rows against the (possibly changed) selection
|
|
@@ -2306,6 +2307,12 @@ function connSelInfo(){
|
|
|
2306
2307
|
const whole=childIds.length>0&&childIds.every(id=>selIds.has(id));
|
|
2307
2308
|
return {conn,kind:j.kind,main:j.main,joint:j,childIds,whole,mode:whole?'whole':'part'};
|
|
2308
2309
|
}
|
|
2310
|
+
// Connection selection → the joint ids it references (parts carry a `conn` tag) + whether the selection is
|
|
2311
|
+
// connections-only. Drives multi-connection delete: the Del key and the side-pane button both remove exactly
|
|
2312
|
+
// these joints (remove for the selection, not the whole model).
|
|
2313
|
+
function selJointIds(){const s=new Set();for(const id of selIds){const el=(partsById||{})[id];if(el&&el.conn)s.add(el.conn);}return s;}
|
|
2314
|
+
function selIsConnOnly(){if(!selIds.size)return false;for(const id of selIds){const el=(partsById||{})[id];if(!el||!el.conn)return false;}return true;}
|
|
2315
|
+
function deleteSelConns(){const jids=selJointIds();if(!jids.size)return;edit(()=>{C.joints=(C.joints||[]).filter(j=>!(j&&jids.has(j.id)));selIds.clear();});}
|
|
2309
2316
|
// ── Selection as a browsable tree (Properties popup): group the flat selIds into connections (each with
|
|
2310
2317
|
// its parts) + loose members, so a MIXED selection (a connection + members, several connections) renders
|
|
2311
2318
|
// as one tree instead of falling back to member-only. connChildIdsEditor = a connection's selectable parts
|
|
@@ -2556,6 +2563,23 @@ function panel(){
|
|
|
2556
2563
|
{const b=document.getElementById('cmpFav');if(b)b.onclick=()=>openFavModalFor(j);}
|
|
2557
2564
|
return;
|
|
2558
2565
|
}}
|
|
2566
|
+
// Several connections selected at once — a compact multi-select pane whose one destructive action removes
|
|
2567
|
+
// every selected connection (the single-connection inspector above owns the one-selected case). Del does the
|
|
2568
|
+
// same. Only fires for a connections-only selection spanning ≥2 joints, so the drilled single-part case below
|
|
2569
|
+
// is untouched.
|
|
2570
|
+
{const jids=selJointIds();
|
|
2571
|
+
if(jids.size>=2&&selIsConnOnly()){
|
|
2572
|
+
const js=(C.joints||[]).filter(j=>j&&jids.has(j.id));
|
|
2573
|
+
const kinds=new Set(js.map(j=>j.kind==='base-plate'?'base plate':j.kind==='shear-plate'?'shear plate':j.kind==='custom'?'imported connection':'connection'));
|
|
2574
|
+
const noun=kinds.size===1?[...kinds][0]+'s':'connections';
|
|
2575
|
+
const nMem=new Set(js.map(j=>j.main)).size;
|
|
2576
|
+
p.innerHTML=`<h3>${js.length} connections selected</h3>
|
|
2577
|
+
<div class="row hint" style="margin-top:2px">${js.length} ${esc(noun)} across ${nMem} member${nMem>1?'s':''}. <b>Del</b> removes them all.</div>
|
|
2578
|
+
<div class=divrow><hr></div>
|
|
2579
|
+
<div class="row f"><button class=danger id=connMultiDel data-tip="Remove every selected connection (Del)">Delete connections (${js.length})</button></div>`;
|
|
2580
|
+
{const b=document.getElementById('connMultiDel');if(b)b.onclick=deleteSelConns;}
|
|
2581
|
+
return;
|
|
2582
|
+
}}
|
|
2559
2583
|
// A derived CONNECTION PART selected in 3D (plate / bolt / weld / cope / stiffener) — show its details
|
|
2560
2584
|
// read-only (parts have no own state; their params live on the parent joint) + a jump to that member.
|
|
2561
2585
|
{const selList=[...selIds];
|
|
@@ -2566,9 +2590,9 @@ function panel(){
|
|
|
2566
2590
|
if(selPart&&j){
|
|
2567
2591
|
const suf=ci>=0?selPart.slice(ci+1):'';const pp=j.params||{};const multi=selList.length>1;
|
|
2568
2592
|
const loc=j.at==='base'?'Base':j.at==='end1'?'End end':'Start end';
|
|
2569
|
-
const pk=/^(bolt|head)/.test(suf)?'bolt':/^(fn|ln|nut)/.test(suf)?'nut':/^weld/.test(suf)?'weld':/^cope/.test(suf)?'cope':/^stiff/.test(suf)?'stiff':/^(rod|anchor)/.test(suf)?'rod':/^wsh/.test(suf)?'washer':/^wp/.test(suf)?'wplate':'plate';
|
|
2593
|
+
const pk=/^(bolt|head)/.test(suf)?'bolt':/^(fn|ln|nut)/.test(suf)?'nut':/^weld/.test(suf)?'weld':/^cope/.test(suf)?'cope':/^stiff/.test(suf)?'stiff':/^(rod|anchor)/.test(suf)?'rod':(((partsById||{})[selPart]||{}).group==='anchor-plate')?'aplate':/^wsh/.test(suf)?'washer':/^wp/.test(suf)?'wplate':'plate'; // the embedded bearing plate → keyed on its 'anchor-plate' GROUP, not an id prefix, so an imported custom-mesh part whose id happens to start "ap" isn't misread as one
|
|
2570
2594
|
const kindName=j.kind==='base-plate'?'Base plate':'Shear plate';
|
|
2571
|
-
const head=({bolt:(multi?'Bolts':'Bolt'),nut:(multi?'Nuts':'Nut'),weld:'Weld',cope:'Cope',stiff:'Stiffener',rod:(multi?'Anchor rods':'Anchor rod'),washer:'Washer',wplate:'Washer plate'})[pk]||kindName;
|
|
2595
|
+
const head=({bolt:(multi?'Bolts':'Bolt'),nut:(multi?'Nuts':'Nut'),weld:'Weld',cope:'Cope',stiff:'Stiffener',rod:(multi?'Anchor rods':'Anchor rod'),washer:'Washer',wplate:'Washer plate',aplate:'Anchor plate'})[pk]||kindName;
|
|
2572
2596
|
const el=(partsById||{})[selPart]||null;const lbl=el&&el.meta&&el.meta.label;
|
|
2573
2597
|
const DEF={plateThickness:10,weldLeg:6,clearance:13,boltDia:20,boltPitch:70,copeRadius:12.7}; // engine defaults (mirror the member panel's spF defaults)
|
|
2574
2598
|
const auto='<span style="color:var(--mut)">auto</span>',dft=' <span style="color:var(--mut);font-size:11px">· default</span>';
|
|
@@ -2589,6 +2613,7 @@ function panel(){
|
|
|
2589
2613
|
else if(pk==='nut')body=sec('Nut')+kv('Wrench size',dim(el&&el.acrossFlats))+kv('Height',dim(plen(el)));
|
|
2590
2614
|
else if(pk==='washer')body=sec('Washer')+kv('Outer ⌀',dim(el&&el.dOuter))+kv('Inner ⌀',dim(el&&el.dInner))+kv('Thickness',dim(plen(el)));
|
|
2591
2615
|
else if(pk==='wplate')body=sec('Washer plate')+kv('Width',dim(el&&el.width))+kv('Height',dim(el&&el.depth))+kv('Thickness',dim(el&&el.thickness));
|
|
2616
|
+
else if(pk==='aplate')body=sec('Anchor plate')+kv('Width',dim(el&&el.width))+kv('Height',dim(el&&el.depth))+kv('Thickness',dim(el&&el.thickness));
|
|
2592
2617
|
else body=sec(kindName+'')+kv('Width',dim(el&&el.width))+kv('Height',dim(el&&el.depth))+kv('Thickness',dim(el&&el.thickness));
|
|
2593
2618
|
p.innerHTML=`<h3>${esc(head)} <span style="color:var(--mut);font-weight:400">· ${loc}</span></h3>
|
|
2594
2619
|
<div class="row hint" style="margin-top:2px">Read-only — auto-detailed on <b>${esc(j.main)}</b>; edit its parameters on the member.</div>
|
|
@@ -4190,6 +4215,7 @@ addEventListener('keydown',e=>{
|
|
|
4190
4215
|
if((e.key==='Delete'||e.key==='Backspace')&&view3d&&window.Steel3DView.selectedClips&&window.Steel3DView.selectedClips().length&&!selIds.size&&!sel3dDimIds.size&&!selDimIds.size&&!inForm){e.preventDefault();window.Steel3DView.deleteSelectedClips();return;} // 3D: Del removes the selected clip plane(s)/box(es) — only when nothing else is selected (clip selection is exclusive)
|
|
4191
4216
|
if((e.key==='Delete'||e.key==='Backspace')&&view3d&&sel3dDimIds.size&&!selIds.size&&!inForm){e.preventDefault();[...sel3dDimIds].forEach(id=>view3dApi.onDeleteDim3d(id));return;} // 3D: Delete removes ALL selected 3D dims — only when no member is selected
|
|
4192
4217
|
if((e.key==='Delete'||e.key==='Backspace')&&selIds.size&&!selDimIds.size&&[...selIds].every(id=>/^det:/.test(id))&&!inForm){e.preventDefault();edit(()=>{const rm=new Set([...selIds].map(id=>id.slice(4)));C.detail_placements=(C.detail_placements||[]).filter(x=>x&&!rm.has(x.id));selIds.clear();});return;} // a placed-detail-only selection deletes from detail_placements — Delete now matches every other object's remove gesture (not just the inspector button)
|
|
4218
|
+
if((e.key==='Delete'||e.key==='Backspace')&&selIsConnOnly()&&!selDimIds.size&&!selGridIds.size&&!inForm){e.preventDefault();deleteSelConns();return;} // a PURE connection selection (one or many) removes those joints — matches the side-pane Delete. A mix with grids/members falls through to the general branch (which now also strips the selected joints), so nothing co-selected is silently left behind.
|
|
4193
4219
|
if((e.key==='Delete'||e.key==='Backspace')&&(selDimIds.size||selIds.size||selGridIds.size)&&!inForm){e.preventDefault(); // deletes everything selected — dims and/or members and/or (free) grid lines (a marquee can hold all)
|
|
4194
4220
|
const glLids=new Set([...selGridIds].filter(id=>id.startsWith('gl:')).map(id=>id.slice(3))); // selected free-line STABLE ids — delete by identity, not geo index (gridLines() drops degenerate entries so indices can skew)
|
|
4195
4221
|
const freeToDelete=(P.grid&&Array.isArray(P.grid.lines))?P.grid.lines.filter(l=>glLids.has(String(l.id))):[]; // only lines that actually still exist → also guards the phantom-undo case (list cleared out from under the selection)
|
|
@@ -4197,7 +4223,8 @@ addEventListener('keydown',e=>{
|
|
|
4197
4223
|
const willMutate=selDimIds.size||selIds.size||freeToDelete.length;
|
|
4198
4224
|
if(willMutate)edit(()=>{
|
|
4199
4225
|
if(selDimIds.size){P.dims=P.dims.filter(d=>!selDimIds.has(d.id));selDimIds.clear();}
|
|
4200
|
-
if(selIds.size){
|
|
4226
|
+
if(selIds.size){const jids=selJointIds();if(jids.size)C.joints=(C.joints||[]).filter(j=>!(j&&jids.has(j.id))); // any selected connection parts → remove their joints too (a mixed member+connection or connection+grid Delete)
|
|
4227
|
+
for(const pl of C.plans)pl.members=(pl.members||[]).filter(m=>!selIds.has(m.id));selIds.clear();} // selection spans sheets → remove from every plane, not just the active one
|
|
4201
4228
|
if(freeToDelete.length&&P.grid&&Array.isArray(P.grid.lines))P.grid.lines=P.grid.lines.filter(l=>!glLids.has(String(l.id)));
|
|
4202
4229
|
selGridIds.clear();});
|
|
4203
4230
|
else{selGridIds.clear();render();} // only regular grid lines were selected → nothing to delete (no phantom undo step); repaint to drop the highlight
|
|
@@ -4316,6 +4343,7 @@ reflectOriginGrid();
|
|
|
4316
4343
|
// toggle persists + re-renders. Tekla-style: a switch gates what future picks CAN select — it does NOT
|
|
4317
4344
|
// retroactively deselect an already-selected object (render() paints from selIds as-is). Type lists are dynamic. ---
|
|
4318
4345
|
const selBar=document.getElementById('selBar'),selFly=document.getElementById('selFly');
|
|
4346
|
+
var selFilterReady=false; // armed by the deferred first reflect below; render() checks it so its per-edit reflect only runs once the Select-bar is initialised. In the current flow the first paint runs after this line (reads false); `var` (not let/const) is defensive — render() is defined earlier, so if it ever ran before this line it would read undefined (falsy), not throw a TDZ error.
|
|
4319
4347
|
const CONN_KIND_LABEL={'base-plate':'Base plate','shear-plate':'Shear plate','custom':'Imported'};
|
|
4320
4348
|
function connKindRecords(){const seen=new Map();for(const j of ((typeof C!=='undefined'&&C&&C.joints)||[])){const k=normConnKind(j&&j.kind);if(k&&!seen.has(k))seen.set(k,CONN_KIND_LABEL[k]||labelFromMemberTypeKey(k));}return [...seen].map(([k,label])=>({k,label}));}
|
|
4321
4349
|
function selGroupDef(grp){return grp==='members'
|
|
@@ -4350,7 +4378,7 @@ selFly.addEventListener('click',e=>{const row=e.target.closest('.frow');if(!row)
|
|
|
4350
4378
|
else{const k=row.dataset.k;def.store[k]=!(def.store[k]!==false);}
|
|
4351
4379
|
saveSelFilter();reflectSelFilter();render();});
|
|
4352
4380
|
document.addEventListener('click',e=>{if(selFly.classList.contains('open')&&!selFly.contains(e.target)&&!selBar.contains(e.target))closeSelFly();});
|
|
4353
|
-
Promise.resolve().then(reflectSelFilter).catch(e=>console.warn('selFilter: initial reflect failed',e)); // defer the first paint: memberTypeRecords() reads BASE_MEMBER_TYPES, a const declared later in main() — run once main() has fully initialized (microtask flushes before paint, so no flash). Log a throw rather than swallow it: a silent failure leaves the bar in its inert default HTML state
|
|
4381
|
+
Promise.resolve().then(()=>{selFilterReady=true;reflectSelFilter();}).catch(e=>console.warn('selFilter: initial reflect failed',e)); // defer the first paint: memberTypeRecords() reads BASE_MEMBER_TYPES, a const declared later in main() — run once main() has fully initialized (microtask flushes before paint, so no flash). Arm selFilterReady BEFORE the first reflect so a throw here can't permanently disable render()'s per-edit sync (reflectSelFilter is idempotent — arm-then-run is safe). Log a throw rather than swallow it: a silent failure leaves the bar in its inert default HTML state while selFilter is still active.
|
|
4354
4382
|
// --- Move/Copy split-button dropdowns: same open/close discipline as the ⋯ menu ---
|
|
4355
4383
|
function wireCmMenu(caretId,menuId){const b=document.getElementById(caretId),m=document.getElementById(menuId);
|
|
4356
4384
|
const close=()=>{m.classList.remove('open');b.setAttribute('aria-expanded','false');document.removeEventListener('mousedown',out,true);};
|
|
@@ -4681,7 +4709,7 @@ function startClipRename(c,labEl){
|
|
|
4681
4709
|
}
|
|
4682
4710
|
// Connection-part group keys, in assembly reading order (plate → fasteners → weld). Used to split the
|
|
4683
4711
|
// legend into a MEMBERS list and a CONNECTIONS section so the steel parts don't blur into one long list.
|
|
4684
|
-
const CONN_ORDER=['base-plate','shear-plate','washer-plate','stiffener','anchor','bolt','nut','washer','weld']; // plates → secondary plates → fastener rods → hardware → weld (so shear-plate parts file under Connections, not Members)
|
|
4712
|
+
const CONN_ORDER=['base-plate','shear-plate','washer-plate','anchor-plate','stiffener','anchor','bolt','nut','washer','weld']; // plates → secondary plates → fastener rods → hardware → weld (so shear-plate parts file under Connections, not Members)
|
|
4685
4713
|
// Member-type categories: the inspector uses this single field for both legend grouping and the structural
|
|
4686
4714
|
// Column vs beam-style geometry choice. Custom types group in the legend and use beam-style geometry.
|
|
4687
4715
|
const BASE_MEMBER_TYPES=[{k:'column',label:'Column'},{k:'beam',label:'Beam'},{k:'brace',label:'Brace'},{k:'ledger',label:'Ledger'},{k:'frame',label:'Frame'}];
|
|
@@ -5824,25 +5852,32 @@ function updConnBtn(){const b=document.getElementById('connBtn');if(b)b.textCont
|
|
|
5824
5852
|
// that lacks one; once all columns are detailed, clicking again clears the AUTO ones (user-placed/
|
|
5825
5853
|
// AI-tuned base plates are kept). The engine renders the plate + anchor kit + weld in 3D. ---
|
|
5826
5854
|
function colMemberIds(){const ids=[];for(const m of (P.members||[]))if(m&&m.role==='column'&&m.id)ids.push(m.id);return ids;} // ACTIVE plan's columns — auto-detail + its undo are per-plan (a joint belongs to its column's sheet). Base-plate columns sit on one foundation sheet, so in practice this still reads as "every column".
|
|
5827
|
-
function
|
|
5855
|
+
function bpTargetIds(){const all=colMemberIds();return selIds.size?all.filter(id=>selIds.has(id)):all;} // selected columns scope the auto-detail; empty selection = every column (issue: create for selection, still supports all)
|
|
5828
5856
|
function bpJointId(mid){const ids=new Set((C.joints||[]).map(j=>j&&j.id));let id='bp-'+mid,k=2;while(ids.has(id))id='bp-'+mid+'-'+(k++);return id;} // unique vs ANY existing joint id (no collision with a user-placed joint)
|
|
5829
5857
|
function updBpBtn(){const b=document.getElementById('bpBtn');if(!b)return;
|
|
5830
|
-
const
|
|
5831
|
-
const
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
b.
|
|
5858
|
+
const allCols=colMemberIds(), tgt=bpTargetIds(), tset=new Set(tgt);
|
|
5859
|
+
const scoped=selIds.size>0&&tgt.length>0&&tgt.length<allCols.length; // acting on a selected subset, not every column
|
|
5860
|
+
const n=(C.joints||[]).filter(j=>j&&j.kind==='base-plate'&&j.source==='auto'&&tset.has(j.main)).length; // auto plates within the target set
|
|
5861
|
+
const covered=new Set((C.joints||[]).filter(j=>j&&j.kind==='base-plate'&&tset.has(j.main)).map(j=>j.main)).size; // target columns already detailed (auto OR user)
|
|
5862
|
+
b.disabled=allCols.length===0||(selIds.size>0&&tgt.length===0); // no columns at all, or a selection with no columns in it → nothing to do (empty-state)
|
|
5863
|
+
b.dataset.tip=allCols.length===0?'No columns in this model to detail base plates.'
|
|
5864
|
+
:(selIds.size>0&&tgt.length===0)?'Select one or more columns to detail base plates, or clear the selection to do every column.'
|
|
5865
|
+
:selIds.size?'Auto-detail base plates on the selected column(s) — a plate + anchor kit + weld, shown in 3D. Clear the selection to detail every column.'
|
|
5866
|
+
:'Auto-detail base plates on every column (a plate + anchor kit + weld, shown in 3D). Select columns first to scope it. Tune sizes per the schedule via the AI or per-column params.';
|
|
5867
|
+
b.textContent=((tgt.length>0&&covered>=tgt.length&&n>0)?'Clear base plates':'Base plates')+(scoped?' · '+tgt.length+' sel':'')+(n?' ('+n+')':'');} // label flips to Clear once every TARGET column is covered; " · N sel" shows the scope
|
|
5835
5868
|
// C.joints is model-global but now rides the snapshot (snapshot()/apply() carry it), so every joint
|
|
5836
5869
|
// mutation goes through edit() — auto-detail, the inspector, and Remove are all undoable (Ctrl+Z/Y).
|
|
5837
5870
|
function toggleBasePlates(){
|
|
5871
|
+
const tgt=bpTargetIds();if(!tgt.length)return; // guarded by the disabled state above (selection with no columns) — belt-and-suspenders
|
|
5838
5872
|
const have=new Set((C.joints||[]).filter(j=>j&&j.kind==='base-plate').map(j=>j.main));
|
|
5839
|
-
const missing=
|
|
5840
|
-
if(missing.length){ // detail the columns that don't have a base plate yet
|
|
5873
|
+
const missing=tgt.filter(id=>!have.has(id));
|
|
5874
|
+
if(missing.length){ // detail the target columns that don't have a base plate yet
|
|
5841
5875
|
edit(()=>{if(!Array.isArray(C.joints))C.joints=[];for(const id of missing)C.joints.push({id:bpJointId(id),kind:'base-plate',main:id,at:'base',source:'auto',params:{}});});
|
|
5842
|
-
}else
|
|
5843
|
-
const cs=new Set(
|
|
5844
|
-
edit(()=>{C.joints=(C.joints||[]).filter(j=>!(j&&j.kind==='base-plate'&&j.source==='auto'&&cs.has(j.main)));});
|
|
5845
|
-
|
|
5876
|
+
}else{ // every target column detailed → clear the AUTO ones on those columns (keep user/AI + unselected columns)
|
|
5877
|
+
const cs=new Set(tgt), rm=(C.joints||[]).filter(j=>j&&j.kind==='base-plate'&&j.source==='auto'&&cs.has(j.main));
|
|
5878
|
+
if(rm.length)edit(()=>{C.joints=(C.joints||[]).filter(j=>!(j&&j.kind==='base-plate'&&j.source==='auto'&&cs.has(j.main)));});
|
|
5879
|
+
else toast(selIds.size?'The selected column(s) already have base plates placed by hand or the AI — none auto-detailed here to clear.':'Every column already has a base plate placed by hand or the AI — none auto-detailed to clear.'); // nothing to add and no auto plate to clear → say so instead of a silent dead click
|
|
5880
|
+
}
|
|
5846
5881
|
}
|
|
5847
5882
|
{const _b=document.getElementById('bpBtn');if(_b)_b.onclick=toggleBasePlates;}
|
|
5848
5883
|
// --- Auto-detail shear plates: one click adds a shear-plate joint to every ELIGIBLE beam end that lacks
|
|
@@ -5869,24 +5904,34 @@ function spEndEligible(beam,endIdx){if(!beam||beam.role==='column'||isBrace(beam
|
|
|
5869
5904
|
function spEligibleEnds(){const out=[];for(const m of (P.members||[])){if(!m||m.role==='column'||isBrace(m))continue;for(const e of [0,1])if(spEndEligible(m,e))out.push({beam:m,endIdx:e});}return out;}
|
|
5870
5905
|
function spBeamIds(){const s=new Set();for(const m of (P.members||[]))if(m&&m.role!=='column'&&!isBrace(m)&&m.id)s.add(m.id);return s;} // ACTIVE plan's beams (never braces) — auto-detail + its undo are per-plan
|
|
5871
5906
|
function spJointOf(beamId,endIdx){return (C.joints||[]).find(j=>j&&j.kind==='shear-plate'&&j.main===beamId&&j.at==='end'+endIdx);}
|
|
5872
|
-
function
|
|
5907
|
+
function spTargetEnds(){const e=spEligibleEnds();return selIds.size?e.filter(({beam})=>selIds.has(beam.id)):e;} // eligible ends of the SELECTED beams; empty selection = every eligible end (issue: create for selection, still supports all)
|
|
5873
5908
|
function spJointId(beamId,endIdx){const ids=new Set((C.joints||[]).map(j=>j&&j.id));let id='sp-'+beamId+'-e'+endIdx,k=2;while(ids.has(id))id='sp-'+beamId+'-e'+endIdx+'-'+(k++);return id;} // unique vs ANY existing joint id
|
|
5874
5909
|
function updSpBtn(){const b=document.getElementById('spBtn');if(!b)return;
|
|
5875
|
-
const
|
|
5876
|
-
const
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5910
|
+
const eligAll=spEligibleEnds(), tgt=spTargetEnds();
|
|
5911
|
+
const scoped=selIds.size>0&&tgt.length>0&&tgt.length<eligAll.length; // acting on a selected subset of the eligible ends
|
|
5912
|
+
const tbeams=new Set([...spBeamIds()].filter(id=>!selIds.size||selIds.has(id))); // the target beams — the SAME set the Clear path removes from, so the (N) count matches exactly what Clear will remove (incl. an auto plate on a since-ineligible end)
|
|
5913
|
+
const n=(C.joints||[]).filter(j=>j&&j.kind==='shear-plate'&&j.source==='auto'&&tbeams.has(j.main)).length;
|
|
5914
|
+
const covered=tgt.filter(({beam,endIdx})=>spJointOf(beam.id,endIdx)).length; // target ends already detailed (auto OR user)
|
|
5915
|
+
b.disabled=eligAll.length===0||(selIds.size>0&&tgt.length===0); // no eligible ends at all, or a selection with no eligible ends in it (empty-state)
|
|
5916
|
+
b.dataset.tip=eligAll.length===0?'No eligible beam ends in this model to detail shear plates.'
|
|
5917
|
+
:(selIds.size>0&&tgt.length===0)?'Select one or more eligible beams to detail shear plates, or clear the selection to do every eligible end.'
|
|
5918
|
+
:selIds.size?'Auto-detail shear plates on the selected beams’ eligible ends. Clear the selection to detail every eligible end.'
|
|
5919
|
+
:'Auto-detail bolted shear (fin) plates on eligible beam ends (a fin plate + bolt group + weld, shown in 3D). Select beams first to scope it. Tune sizes per the schedule via the AI or per-end params.';
|
|
5920
|
+
b.textContent=((tgt.length>0&&covered>=tgt.length&&n>0)?'Clear shear plates':'Shear plates')+(scoped?' · '+tgt.length+' end'+(tgt.length>1?'s':''):'')+(n?' ('+n+')':'');} // label flips to Clear once every TARGET end is covered; " · N ends" shows the scope (a beam has up to 2 eligible ends, so this counts ENDS not selected beams — clearer than a bare "sel")
|
|
5880
5921
|
function toggleShearPlates(){
|
|
5881
|
-
const
|
|
5882
|
-
const missing=
|
|
5883
|
-
if(missing.length){ // detail the
|
|
5922
|
+
const tgt=spTargetEnds();if(!tgt.length)return; // guarded by the disabled state above (selection with no eligible ends)
|
|
5923
|
+
const missing=tgt.filter(({beam,endIdx})=>!spJointOf(beam.id,endIdx));
|
|
5924
|
+
if(missing.length){ // detail the target ends that don't have a shear plate yet
|
|
5884
5925
|
edit(()=>{if(!Array.isArray(C.joints))C.joints=[];for(const {beam,endIdx} of missing){const sup=spInferSupport(beam,endIdx);
|
|
5885
5926
|
C.joints.push({id:spJointId(beam.id,endIdx),kind:'shear-plate',main:beam.id,at:'end'+endIdx,source:'auto',secondaries:sup?[sup.id]:[],params:{}});}});
|
|
5886
|
-
}else
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5927
|
+
}else{ // every target end detailed → clear the AUTO ones on the target BEAMS — all their ends,
|
|
5928
|
+
// incl. an end that later became ineligible (so its auto joint stays clearable from the
|
|
5929
|
+
// toolbar), keeping user/AI plates + untargeted beams
|
|
5930
|
+
const tbeams=new Set([...spBeamIds()].filter(id=>!selIds.size||selIds.has(id)));
|
|
5931
|
+
const rm=(C.joints||[]).filter(j=>j&&j.kind==='shear-plate'&&j.source==='auto'&&tbeams.has(j.main));
|
|
5932
|
+
if(rm.length)edit(()=>{C.joints=(C.joints||[]).filter(j=>!(j&&j.kind==='shear-plate'&&j.source==='auto'&&tbeams.has(j.main)));});
|
|
5933
|
+
else toast(selIds.size?'The selected beam(s) already have shear plates placed by hand or the AI — none auto-detailed here to clear.':'Every eligible end already has a shear plate placed by hand or the AI — none auto-detailed to clear.'); // nothing to add and no auto plate to clear → say so instead of a silent dead click
|
|
5934
|
+
}
|
|
5890
5935
|
}
|
|
5891
5936
|
{const _s=document.getElementById('spBtn');if(_s)_s.onclick=toggleShearPlates;}
|
|
5892
5937
|
function renderConnTable(){const tb=document.getElementById('connBody');if(!tb)return;
|
|
@@ -6701,6 +6746,25 @@ if(new URLSearchParams(location.search).get('selftest')==='1'){(function(){
|
|
|
6701
6746
|
ok(!(C.joints.find(j=>j.id==='j2')||{secondaries:[]}).secondaries.includes('bJ'),'…and drops it from any other joint’s supports');
|
|
6702
6747
|
C.joints=sj;}
|
|
6703
6748
|
|
|
6749
|
+
// Detailing scoping + selected-connection delete (issue: create/remove for the selection, not the whole model)
|
|
6750
|
+
{const sj=C.joints,ss=selIds,sPb=partsById;
|
|
6751
|
+
// base plates: selection scopes the target columns; empty selection = every column
|
|
6752
|
+
P.members=[{id:'C1',role:'column',wp:[[0,0]]},{id:'C2',role:'column',wp:[[100,0]]}];
|
|
6753
|
+
selIds=new Set();ok(bpTargetIds().length===2,'bpTargetIds → every column when nothing is selected');
|
|
6754
|
+
selIds=new Set(['C1']);ok(bpTargetIds().length===1&&bpTargetIds()[0]==='C1','bpTargetIds → only the selected column');
|
|
6755
|
+
// shear plates: selection scopes the eligible ends to the selected beam
|
|
6756
|
+
P.members=[{id:'B1',role:'beam',profile:'W16X26',wp:[[0,0],[100,0]],ends:[{note:'shear'},{note:'shear'}]},
|
|
6757
|
+
{id:'B2',role:'beam',profile:'W16X26',wp:[[0,50],[100,50]],ends:[{note:'shear'},{note:'shear'}]}];
|
|
6758
|
+
selIds=new Set();const nAll=spTargetEnds().length;
|
|
6759
|
+
selIds=new Set(['B1']);ok(spTargetEnds().length>0&&spTargetEnds().length<nAll&&spTargetEnds().every(e=>e.beam.id==='B1'),'spTargetEnds → only the selected beam’s eligible ends');
|
|
6760
|
+
// selected-connection delete removes exactly the joints the selected parts belong to
|
|
6761
|
+
C.joints=[{id:'jA',kind:'shear-plate',main:'B1',at:'end0'},{id:'jB',kind:'shear-plate',main:'B2',at:'end0'}];
|
|
6762
|
+
partsById={'jA:plate':{conn:'jA'},'jA:bolt0':{conn:'jA'},'jB:plate':{conn:'jB'}};
|
|
6763
|
+
selIds=new Set(['jA:plate','jA:bolt0']);
|
|
6764
|
+
ok(selIsConnOnly()&&selJointIds().size===1&&selJointIds().has('jA'),'selJointIds/selIsConnOnly → the one joint of the selected parts');
|
|
6765
|
+
selIds=new Set(['jA:plate','C1']);ok(!selIsConnOnly(),'selIsConnOnly false when a member is mixed in');
|
|
6766
|
+
C.joints=sj;selIds=ss;partsById=sPb;}
|
|
6767
|
+
|
|
6704
6768
|
// the editor's confidence mirror: brace ends are not scored as beam connections
|
|
6705
6769
|
{const spl=C.plans,sa=C.active;
|
|
6706
6770
|
C.plans=[{sheet:'T',members:[normBrace(mk({id:'brC',wp:[[0,0],[100,0]]})),{id:'bC',role:'beam',profile:'W16X26',wp:[[0,50],[100,50]],ends:[{},{}]}]}];
|
package/dist/web/workspaces.js
CHANGED
|
@@ -962,7 +962,7 @@
|
|
|
962
962
|
const lines = graph.edges.map((e) => { const a = pos[idx.get(e.a)], b = pos[idx.get(e.b)];
|
|
963
963
|
return (a && b) ? `<line class="kb-g-edge" x1="${a.x.toFixed(1)}" y1="${a.y.toFixed(1)}" x2="${b.x.toFixed(1)}" y2="${b.y.toFixed(1)}"/>` : ''; }).join('');
|
|
964
964
|
const dots = graph.nodes.map((n, i) => { const p = pos[i];
|
|
965
|
-
return `<g class="kb-g-node kb-g-${escapeAttr(n.type)}" tabindex="0" role="button" aria-label="${escapeAttr(n.title + ', ' + n.type)}" data-kb-node="${escapeAttr(n.slug)}" data-tip="${escapeAttr(n.title + ' · ' + n.type)}" transform="translate(${p.x.toFixed(1)},${p.y.toFixed(1)})">` +
|
|
965
|
+
return `<g class="kb-g-node kb-g-${escapeAttr(n.type)}" tabindex="0" role="button" aria-label="${escapeAttr(n.title + ', ' + n.type)}" data-kb-node="${escapeAttr(n.slug)}" data-tip="${escapeAttr(n.title + ' · ' + n.type)}" data-pos="${p.x.toFixed(1)},${p.y.toFixed(1)}" transform="translate(${p.x.toFixed(1)},${p.y.toFixed(1)})">` +
|
|
966
966
|
`<circle class="kb-g-hit" r="16"/><circle class="kb-g-dot" r="9"/><text x="13" y="4">${escapeHtml(n.title)}</text></g>`; }).join('');
|
|
967
967
|
const overview = graph.index ? `<button type="button" class="kb-g-overview" data-kb-node="${escapeAttr(graph.index.slug)}" data-tip="Open the overview">✦ Overview</button>` : '';
|
|
968
968
|
const legend = '<div class="kb-g-legend"><span class="kb-gleg src">Source</span><span class="kb-gleg con">Concept</span><span class="kb-gleg per">Person</span></div>';
|
|
@@ -979,6 +979,14 @@
|
|
|
979
979
|
function kbSetVb(svg, x, y, w, h) {
|
|
980
980
|
svg.setAttribute('viewBox', `${x} ${y} ${w} ${h}`);
|
|
981
981
|
const [bx, by, bw] = svg.dataset.vbBase.split(' ').map(Number);
|
|
982
|
+
// Shrinking the viewBox to zoom magnifies everything inside it — dots and labels would balloon and
|
|
983
|
+
// overlap. Counter-scale each node by k = shown-fraction-of-base so its dot + label keep a constant
|
|
984
|
+
// on-screen size (map-label behaviour). scale() is around the group's local origin, where the dot
|
|
985
|
+
// sits, so the dot stays pinned to its graph coord. (Edge stroke stays constant via non-scaling-stroke.)
|
|
986
|
+
const k = w / bw;
|
|
987
|
+
svg.querySelectorAll('.kb-g-node').forEach((n) => {
|
|
988
|
+
if (n.dataset.pos) n.setAttribute('transform', `translate(${n.dataset.pos}) scale(${k})`);
|
|
989
|
+
});
|
|
982
990
|
const off = Math.abs(w - bw) > 0.5 || Math.abs(x - bx) > 0.5 || Math.abs(y - by) > 0.5;
|
|
983
991
|
const fit = svg.parentElement.querySelector('[data-kb-fit]');
|
|
984
992
|
if (fit) fit.hidden = !off;
|