@floless/app 0.90.0 → 0.90.2
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 +2 -2
- package/dist/web/steel-3d-view.js +7 -2
- package/dist/web/steel-editor.html +217 -42
- 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.90.
|
|
53109
|
+
define: true ? "0.90.2" : 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.90.
|
|
53119
|
+
return resolveChannel({ isSea: isSea2(), define: true ? "0.90.2" : void 0 });
|
|
53120
53120
|
}
|
|
53121
53121
|
|
|
53122
53122
|
// workflow-update.ts
|
|
@@ -2139,10 +2139,15 @@ function renderConnEnvelope(conn) {
|
|
|
2139
2139
|
function resetConnState() { selConn = null; ctxConn = null; clearConnEnvelope(); } // internal reset, no callbacks
|
|
2140
2140
|
// Select the WHOLE connection at root (single-click a part, or a breadcrumb click). Clears any drill context.
|
|
2141
2141
|
function selectWholeConn(conn) {
|
|
2142
|
-
|
|
2142
|
+
const kids = conn ? connChildIds(conn) : [];
|
|
2143
|
+
if (!conn || !kids.length) return clearConnSel();
|
|
2144
|
+
// Host Select-filter: if this connection's kind is switched off, none of its parts are selectable —
|
|
2145
|
+
// stay INERT (leave the current selection + draw NO envelope) instead of a phantom envelope with an
|
|
2146
|
+
// empty selection. onSelectMany also filters, but the envelope + selConn are installed here first.
|
|
2147
|
+
if (api && api.canSelectId && !kids.some(api.canSelectId)) return;
|
|
2143
2148
|
selConn = conn; ctxConn = null;
|
|
2144
2149
|
renderConnEnvelope(conn);
|
|
2145
|
-
if (api && api.onSelectMany) api.onSelectMany(
|
|
2150
|
+
if (api && api.onSelectMany) api.onSelectMany(kids);
|
|
2146
2151
|
}
|
|
2147
2152
|
// Clear any connection selection/drill (back to bare Model root — deselects).
|
|
2148
2153
|
function clearConnSel() { resetConnState(); if (api && api.onSelect) api.onSelect(null, false); }
|
|
@@ -183,9 +183,43 @@
|
|
|
183
183
|
.m3dmenu button.wtog.on{color:var(--text)} /* the slider carries the on-state — don't also brand the label text */
|
|
184
184
|
#moreMenu button.msnap .sg{display:inline-block;width:17px;color:#22d3ee;opacity:.5;flex:none;transition:opacity .15s}
|
|
185
185
|
#moreMenu button.msnap.on .sg{opacity:1}
|
|
186
|
-
/*
|
|
187
|
-
#
|
|
188
|
-
#
|
|
186
|
+
/* Pointer-behaviour bars, bottom-right of the canvas (both views): [ Select filter ] [ Snap ]. Both reuse the brand-fill "on" toolbar language. */
|
|
187
|
+
#ptrBars{position:absolute;right:12px;bottom:12px;z-index:8;display:flex;align-items:flex-end;gap:8px}
|
|
188
|
+
#ptrBars.s3d{right:104px} /* in 3D, sit just LEFT of the bottom-right world-axis triad (#m3dAxes, right 15 + 78 wide) — same bottom edge (the ViewCube is top-right) */
|
|
189
|
+
#snapBar,#selBar{display:flex;align-items:center;gap:2px;padding:3px;background:var(--panel);border:1px solid var(--line);border-radius:8px;box-shadow:0 4px 14px rgba(0,0,0,.45)}
|
|
190
|
+
#snapBar .lbl,#selBar .lbl{font-size:10px;text-transform:uppercase;letter-spacing:.07em;color:var(--mut);padding:0 4px;user-select:none;align-self:center}
|
|
191
|
+
/* Select bar: brand-blue "on"; neutral idle (cyan stays reserved for snapping). A flyout class shows partial (blue outline + dot) when only some of its types are on. */
|
|
192
|
+
#selBar button{width:28px;height:28px;display:grid;place-items:center;border:0;border-radius:5px;background:transparent;color:var(--text);opacity:.55;font-size:15px;line-height:1;cursor:pointer;padding:0;position:relative;transition:background-color .12s,opacity .12s,color .12s,box-shadow .12s}
|
|
193
|
+
#selBar button svg{width:17px;height:17px;display:block}
|
|
194
|
+
#selBar button:hover{background:rgba(148,163,184,.12);opacity:.9}
|
|
195
|
+
#selBar button.on{background:var(--brand);color:#0f172a;opacity:1}
|
|
196
|
+
#selBar button.partial{opacity:1;color:var(--brand);box-shadow:inset 0 0 0 1.5px var(--brand)}
|
|
197
|
+
#selBar button.off{opacity:.4;color:var(--mut)}
|
|
198
|
+
#selBar button:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
|
|
199
|
+
#selBar button .car{position:absolute;right:1px;bottom:0;font-size:8px;opacity:.7;pointer-events:none}
|
|
200
|
+
#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)}
|
|
201
|
+
/* shared type flyout (Members / Connections) — opens upward from the bar */
|
|
202
|
+
#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}
|
|
203
|
+
#selFly.open{display:block}
|
|
204
|
+
#selFly .fhdr{display:flex;align-items:baseline;justify-content:space-between;padding:4px 8px 6px}
|
|
205
|
+
#selFly .fhdr b{font-size:12px;font-weight:600;letter-spacing:.02em}
|
|
206
|
+
#selFly .fhdr .cnt{font-size:11px;color:var(--mut);font-variant-numeric:tabular-nums}
|
|
207
|
+
#selFly .frow{display:flex;align-items:center;gap:9px;width:100%;padding:6px 8px;border:0;border-radius:6px;background:transparent;color:var(--text);cursor:pointer;font:13px system-ui;text-align:left}
|
|
208
|
+
#selFly .frow:hover{background:rgba(148,163,184,.12)}
|
|
209
|
+
#selFly .frow .nm{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
210
|
+
#selFly .frow.all{font-weight:600}
|
|
211
|
+
#selFly .fsep{height:1px;background:var(--line);margin:4px 6px}
|
|
212
|
+
#selFly .fempty{padding:6px 8px;color:var(--mut);font-size:12px}
|
|
213
|
+
#selFly .fck{width:15px;height:15px;flex:none;border-radius:4px;border:1.5px solid #475569;background:#0f172a;display:grid;place-items:center;transition:background .12s,border-color .12s}
|
|
214
|
+
#selFly .fck::after{content:"";width:4px;height:8px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg);margin-top:-2px;opacity:0;transition:opacity .1s}
|
|
215
|
+
#selFly .frow.checked .fck{background:var(--brand);border-color:var(--brand)}
|
|
216
|
+
#selFly .frow.checked .fck::after{opacity:1}
|
|
217
|
+
#selFly .frow.mixed .fck{background:linear-gradient(var(--brand),var(--brand)) center/9px 2.5px no-repeat,#0f172a;border-color:var(--brand)}
|
|
218
|
+
#selFly .frow.mixed .fck::after{opacity:0}
|
|
219
|
+
#selFly .flist{max-height:230px;overflow:auto;scrollbar-width:thin;scrollbar-color:#475569 transparent}
|
|
220
|
+
#selFly .flist::-webkit-scrollbar{width:8px}
|
|
221
|
+
#selFly .flist::-webkit-scrollbar-thumb{background:#475569;border-radius:4px}
|
|
222
|
+
#selFly .flist::-webkit-scrollbar-track{background:transparent}
|
|
189
223
|
#snapBar button{width:28px;height:28px;display:grid;place-items:center;border:0;border-radius:5px;background:transparent;color:#22d3ee;opacity:.55;font-size:15px;line-height:1;cursor:pointer;padding:0;transition:background-color .12s,opacity .12s,color .12s}
|
|
190
224
|
#snapBar button:hover{background:rgba(148,163,184,.12);opacity:.9}
|
|
191
225
|
#snapBar button.on{background:var(--brand);color:#0f172a;opacity:1}
|
|
@@ -331,6 +365,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
331
365
|
line.gridhit{stroke:transparent;stroke-width:9;vector-effect:non-scaling-stroke;pointer-events:stroke}
|
|
332
366
|
line.gridhit.gv{cursor:ew-resize} line.gridhit.gh{cursor:ns-resize} line.gridhit.gl{cursor:move}
|
|
333
367
|
line.gridln.gdrag{stroke:var(--brand);opacity:1}
|
|
368
|
+
line.gridln.sel{stroke:var(--brand);stroke-width:2;opacity:1;filter:drop-shadow(0 0 3px var(--brand))} /* marquee/Ctrl+A grid selection */
|
|
334
369
|
line.gridprev{stroke:var(--brand);stroke-width:1.2;stroke-dasharray:8 5;vector-effect:non-scaling-stroke;pointer-events:none;opacity:.9}
|
|
335
370
|
circle.gridbub{fill:#0f172a;stroke:#64748b;stroke-width:1.5;vector-effect:non-scaling-stroke;cursor:grab;filter:drop-shadow(0 1px 2px rgba(0,0,0,.45))}
|
|
336
371
|
text.gridtx{fill:#e2e8f0;font-weight:700;font-family:system-ui;text-anchor:middle;dominant-baseline:central;pointer-events:none}
|
|
@@ -834,17 +869,31 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
834
869
|
<span id=zPct>100%</span>
|
|
835
870
|
<button id=zFit data-tip="Zoom to fit (Home)">Fit</button>
|
|
836
871
|
</div>
|
|
837
|
-
<!--
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
<
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
872
|
+
<!-- Pointer-behaviour bars (bottom-right): Select (what may be picked) + Snap (what you snap to). -->
|
|
873
|
+
<div id=ptrBars>
|
|
874
|
+
<!-- Selection filter (Tekla "select switches"): a class off can't be picked by click / area-select / Ctrl+A.
|
|
875
|
+
Members + Connections open a type flyout (All on top). Default: everything on, so nothing is filtered. -->
|
|
876
|
+
<div id=selBar role=group aria-label="Selection filter">
|
|
877
|
+
<span class=lbl>Select</span>
|
|
878
|
+
<button data-cls=member data-fly=members aria-label="Members" data-tip="Members — click to choose which member types can be selected"><svg viewBox="0 0 18 18" fill=none stroke=currentColor stroke-width=1.6 stroke-linecap=round aria-hidden=true><path d="M4 4h10M4 14h10M9 4v10"/></svg><span class=car aria-hidden=true>▾</span></button>
|
|
879
|
+
<button data-cls=connection data-fly=connections aria-label="Connections" data-tip="Connections — click to choose which connection types can be selected"><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>
|
|
880
|
+
<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>
|
|
881
|
+
<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>
|
|
882
|
+
</div>
|
|
883
|
+
<!-- Quick-access snap toggles (same persistent state as the ⋯ menu → Snapping section; keep the two in sync — same 7 items).
|
|
884
|
+
Glyphs mirror SNAP_KINDS_2D — see the endpoint-glyph constraint there before "correcting" ◻ to □. -->
|
|
885
|
+
<div id=snapBar role=group aria-label="Snap settings">
|
|
886
|
+
<span class=lbl>Snap</span>
|
|
887
|
+
<button data-snap=end data-tip="Endpoint snap">◻</button>
|
|
888
|
+
<button data-snap=int data-tip="Intersection snap">✕</button>
|
|
889
|
+
<button data-snap=mid data-tip="Midpoint snap">△</button>
|
|
890
|
+
<button data-snap=line data-tip="Nearest snap">⧗</button>
|
|
891
|
+
<button data-snap=perp data-tip="Perpendicular snap — square (90°) to a target line from your first point">⟂</button>
|
|
892
|
+
<button data-snap=par data-tip="Parallel snap — run parallel to a nearby line">∥</button>
|
|
893
|
+
<button data-snap=ext data-tip="Extension snap">┈</button>
|
|
894
|
+
</div>
|
|
847
895
|
</div>
|
|
896
|
+
<div id=selFly role=menu aria-label="Selectable types"></div>
|
|
848
897
|
</div>
|
|
849
898
|
<aside id=panel></aside>
|
|
850
899
|
</main>
|
|
@@ -1092,6 +1141,7 @@ let csaxisMode=false, csDraft=null; // Local coordinate system "set axes" tool
|
|
|
1092
1141
|
let dimChain=false, dimChainPrev=null, dimSeq=0; // chained "continuous" dimensioning: toggle, the running {point,axis,off,rot}, and a counter for unique ids on rapid clicks
|
|
1093
1142
|
let dimSplitMode=false; // "add split point" mode on a selected dim — each click inserts a point and splits the dim segment under it into two
|
|
1094
1143
|
let sel3dDimIds=new Set(),dim3dAnchor=null; // selected 3D dimension ids (multi-select like parts; 3D view highlights them, Delete removes them)
|
|
1144
|
+
let selGridIds=new Set(); // selected grid-line ids — synthetic keys 'gv:i'/'gh:i' (regular, spacing-generated) or 'gl:i' (free line). Populated by marquee + Ctrl+A (2D); highlighted in gridSvg; free lines are deletable, regular lines aren't (they're a spacing pattern).
|
|
1095
1145
|
let selIds=new Set();
|
|
1096
1146
|
let findHits=new Set(); // Find-in-model highlight (Workspaces Ctrl+F) — kept SEPARATE from selIds so a search never clobbers/drops the user's real selection
|
|
1097
1147
|
let undo=[], redo=[];
|
|
@@ -1357,6 +1407,7 @@ function apply(json){const d=JSON.parse(json);
|
|
|
1357
1407
|
selIds=new Set([...selIds].filter(id=>byId(id)||/^det:/.test(id))); // keep a selected placed-detail id (det:…) — it isn't a member
|
|
1358
1408
|
selDimIds.forEach(id=>{if(!(P.dims||[]).some(x=>x.id===id))selDimIds.delete(id);}); // drop any dim selection the undo removed
|
|
1359
1409
|
if(sel3dDimIds.size){const ok=new Set((C.dims3d||[]).map(x=>x.id));sel3dDimIds=new Set([...sel3dDimIds].filter(id=>ok.has(id)));} // drop stale 3D-dim selections
|
|
1410
|
+
if(selGridIds.size)selGridIds.clear(); // grid ids are index-based synthetics — an undo can reshuffle the grid, so just drop the transient grid selection
|
|
1360
1411
|
dimDraft=null;dimChainPrev=null;dimPrevClear(); // undo/redo changed geometry under the tool → abandon any in-progress dim placement / chain (else the chain head points at a removed segment)
|
|
1361
1412
|
drawDraft=null;drawPrevClear(); // …likewise abandon an in-progress Add-member start point
|
|
1362
1413
|
cmDraft=null;cmPrevClear();cmHudClose(); // same for an in-progress Move/Copy pick — the base may reference removed geometry
|
|
@@ -1704,9 +1755,10 @@ function gridSvg(){
|
|
|
1704
1755
|
const geo=gridGeo();if(!geo||(!geo.v.length&&!geo.h.length&&!(geo.lines&&geo.lines.length)))return '';
|
|
1705
1756
|
const R=11/zoom,F=12/zoom;
|
|
1706
1757
|
let s='<g id=gridG>';
|
|
1707
|
-
|
|
1708
|
-
geo.
|
|
1709
|
-
|
|
1758
|
+
const gsel=i=>selGridIds.has(i)?' sel':''; // marquee/Ctrl+A grid selection → highlight the visible line
|
|
1759
|
+
geo.v.forEach((l,i)=>{s+=`<line class="gridln${gsel('gv:'+i)}" data-gv="${i}" x1="${l.x}" y1="${l.lo}" x2="${l.x}" y2="${l.hi}"/><line class="gridhit gv" data-gv="${i}" x1="${l.x}" y1="${l.lo}" x2="${l.x}" y2="${l.hi}" data-tip="Grid ${esc(l.label)} — drag to move"></line>`;});
|
|
1760
|
+
geo.h.forEach((l,i)=>{s+=`<line class="gridln${gsel('gh:'+i)}" data-gh="${i}" x1="${l.lo}" y1="${l.y}" x2="${l.hi}" y2="${l.y}"/><line class="gridhit gh" data-gh="${i}" x1="${l.lo}" y1="${l.y}" x2="${l.hi}" y2="${l.y}" data-tip="Grid ${esc(l.label)} — drag to move"></line>`;});
|
|
1761
|
+
(geo.lines||[]).forEach((l,i)=>{s+=`<line class="gridln${gsel('gl:'+(l.id!=null?l.id:i))}" data-gl="${i}" x1="${l.a[0]}" y1="${l.a[1]}" x2="${l.b[0]}" y2="${l.b[1]}"/><line class="gridhit gl" data-gl="${i}" x1="${l.a[0]}" y1="${l.a[1]}" x2="${l.b[0]}" y2="${l.b[1]}" data-tip="Grid ${esc(l.label)} — drag to move"></line>`;});
|
|
1710
1762
|
const bub=(x,y,lb,ax,i,end)=>`<g class=gridbubg data-${ax}="${i}" data-end="${end}" data-tip="Grid ${esc(lb)} — drag to move or adjust · dbl-click to rename · click to edit the grid"><circle class=gridbub data-bx="${x}" data-by="${y}" cx="${x}" cy="${y}" r="${R}"/><text class=gridtx data-bx="${x}" data-by="${y}" x="${x}" y="${y}" style="font-size:${F}px">${esc(lb)}</text></g>`;
|
|
1711
1763
|
geo.v.forEach((l,i)=>{s+=bub(l.x,l.lo,l.label,'gv',i,0)+bub(l.x,l.hi,l.label,'gv',i,1);});
|
|
1712
1764
|
geo.h.forEach((l,i)=>{s+=bub(l.lo,l.y,l.label,'gh',i,0)+bub(l.hi,l.y,l.label,'gh',i,1);});
|
|
@@ -1714,6 +1766,29 @@ function gridSvg(){
|
|
|
1714
1766
|
return s+'</g>';}
|
|
1715
1767
|
// live re-render of just the grid layer while a line is being dragged (render() is too heavy per move)
|
|
1716
1768
|
function refreshGridLayer(){const el=document.getElementById('gridG');if(el)el.outerHTML=gridSvg();}
|
|
1769
|
+
// every visible grid line with a synthetic id + endpoints — the source for marquee/Ctrl+A grid selection.
|
|
1770
|
+
// ids: 'gv:i'/'gh:i' = regular (spacing-generated, index into geo.v/geo.h), 'gl:<lineId>' = free line keyed by its
|
|
1771
|
+
// STABLE id (NOT the geo index — gridLines() drops degenerate entries, so the geo index can skew off P.grid.lines).
|
|
1772
|
+
function gridSelectables(){if(!gridOn())return [];const geo=gridGeo();if(!geo)return [];const out=[];
|
|
1773
|
+
(geo.v||[]).forEach((l,i)=>out.push({id:'gv:'+i,p1:[l.x,l.lo],p2:[l.x,l.hi]}));
|
|
1774
|
+
(geo.h||[]).forEach((l,i)=>out.push({id:'gh:'+i,p1:[l.lo,l.y],p2:[l.hi,l.y]}));
|
|
1775
|
+
(geo.lines||[]).forEach((l,i)=>out.push({id:'gl:'+(l.id!=null?l.id:i),p1:l.a.slice(),p2:l.b.slice()}));
|
|
1776
|
+
return out;}
|
|
1777
|
+
// selected grid lines → display rows {label,type} for the inspector (resolves labels/types from gridGeo)
|
|
1778
|
+
function gridSelSummary(){const geo=gridGeo()||{};const out=[];
|
|
1779
|
+
for(const id of selGridIds){
|
|
1780
|
+
if(id.startsWith('gv:')){const l=(geo.v||[])[+id.slice(3)];out.push({label:l?l.label:'?',type:'Vertical'});}
|
|
1781
|
+
else if(id.startsWith('gh:')){const l=(geo.h||[])[+id.slice(3)];out.push({label:l?l.label:'?',type:'Horizontal'});}
|
|
1782
|
+
else if(id.startsWith('gl:')){const lid=id.slice(3),l=(geo.lines||[]).find(x=>String(x.id)===lid);out.push({label:l?l.label:'?',type:'Free'});}}
|
|
1783
|
+
return out;}
|
|
1784
|
+
// delete the selected FREE grid lines by identity (regular spacing lines can't be individually deleted → toast). Shared by the inspector Delete button; the keyboard Delete has its own bundled path (members+dims+grids in one edit()).
|
|
1785
|
+
function deleteSelGrids(){
|
|
1786
|
+
const glLids=new Set([...selGridIds].filter(id=>id.startsWith('gl:')).map(id=>id.slice(3)));
|
|
1787
|
+
const freeToDelete=(P.grid&&Array.isArray(P.grid.lines))?P.grid.lines.filter(l=>glLids.has(String(l.id))):[];
|
|
1788
|
+
const hadReg=[...selGridIds].some(id=>id.startsWith('gv:')||id.startsWith('gh:'));
|
|
1789
|
+
if(freeToDelete.length)edit(()=>{P.grid.lines=P.grid.lines.filter(l=>!glLids.has(String(l.id)));selGridIds.clear();});
|
|
1790
|
+
else{selGridIds.clear();render();}
|
|
1791
|
+
if(hadReg)toast('Regular grid lines come from the grid spacing — remove them in “Grid lines…”. Only free grid lines are deletable here.');}
|
|
1717
1792
|
// cursor-following distance readout for grid drags (same chrome as the 3D drag readout)
|
|
1718
1793
|
let gridRd=null;
|
|
1719
1794
|
function gridReadout(e,main,sub){
|
|
@@ -1804,7 +1879,7 @@ document.addEventListener('gridcore-ready',()=>{try{if(C)render();}catch(_){}});
|
|
|
1804
1879
|
function setGridMode(on){if(!C)return;gridMode=!!on;
|
|
1805
1880
|
if(!gridMode){const ae=document.activeElement,pn=document.getElementById('panel');if(ae&&pn&&pn.contains(ae))ae.blur(); // commit a focused field (change fires on blur) BEFORE the panel is torn down — a canvas click's pointerdown runs before the browser's own focus change
|
|
1806
1881
|
gridPick=false;if(gridLinePick&&gridLinePick.line)gridLinePick.line.remove();gridLinePick=null;gridSetPickClass();snapClear();}
|
|
1807
|
-
else{if(mode==='add'){mode='sel';setMode();}if(dimMode){dimMode=false;setDimMode();}if(csaxisMode){csaxisMode=false;setCsMode();}if(cmTool)disarmCm();dimStyleMode=false;geoMode=null;setGeo();selIds.clear();selDimIds.clear();} // disarm Move/Copy + the Dimension style pane too — grid mode, cmTool and the pane must be mutually exclusive (they own the left-click/Esc or the panel)
|
|
1882
|
+
else{if(mode==='add'){mode='sel';setMode();}if(dimMode){dimMode=false;setDimMode();}if(csaxisMode){csaxisMode=false;setCsMode();}if(cmTool)disarmCm();dimStyleMode=false;geoMode=null;setGeo();selIds.clear();selDimIds.clear();selGridIds.clear();} // disarm Move/Copy + the Dimension style pane too — grid mode, cmTool and the pane must be mutually exclusive (they own the left-click/Esc or the panel). Drop the grid selection too — editing/re-inferring the grid invalidates its index-based ids.
|
|
1808
1883
|
panel();}
|
|
1809
1884
|
// The Dimension style pane — a panel takeover like the grid panel. It edits the MODEL-GLOBAL defaults
|
|
1810
1885
|
// (C.dim_style), so every dim that doesn't carry its own style repaints as you click. Each change rides
|
|
@@ -2445,6 +2520,19 @@ function panel(){
|
|
|
2445
2520
|
const eb=document.getElementById('partEdit');if(eb)eb.onclick=()=>{if(window.Steel3DView&&window.Steel3DView.clearConnSel)window.Steel3DView.clearConnSel();selIds=new Set([j.main]);selDimIds.clear();sel3dDimIds.clear();render();};
|
|
2446
2521
|
return;
|
|
2447
2522
|
}}
|
|
2523
|
+
if(selGridIds.size&&!selIds.size&&!selDimIds.size&&!view3d&&mode==='sel'){ // grid-only selection → a grid inspector (was falling through to the Legend)
|
|
2524
|
+
const g=gridSelSummary(),n=g.length,one=n===1?g[0]:null;
|
|
2525
|
+
const nFree=[...selGridIds].filter(id=>id.startsWith('gl:')).length,nReg=n-nFree;
|
|
2526
|
+
const parts=[['Vertical',g.filter(x=>x.type==='Vertical').length],['Horizontal',g.filter(x=>x.type==='Horizontal').length],['Free',nFree]].filter(([,c])=>c>0).map(([t,c])=>c+' '+t.toLowerCase());
|
|
2527
|
+
const regClause=nReg?(nReg===1?` One regular line comes from the grid spacing — respace or rename it in Grid lines…`:` Regular lines come from the grid spacing — respace or rename them in Grid lines…`):''; // scales singular/plural like the free clause
|
|
2528
|
+
const delLbl=(nReg?'Delete free':'Delete')+(nFree>1?` (${nFree})`:''); // count suffix like the multi-member "Delete selected (N)"
|
|
2529
|
+
p.innerHTML=`<span class=badge>Grid line${n>1?'s · '+n:''}</span>
|
|
2530
|
+
${one?`<div class=hint style="margin-top:8px">Grid <b>${esc(one.label)}</b> · ${one.type} line</div>`:`<div class=hint style="margin-top:8px">${esc(parts.join(' · '))}</div>`}
|
|
2531
|
+
<div class=hint style="margin-top:8px">Grid lines are the plan's structural reference.${nFree?` <b>Del</b> removes the free line${nFree>1?'s':''}.`:''}${regClause}</div>
|
|
2532
|
+
<div class="row f" style="gap:6px;margin-top:12px;flex-wrap:wrap"><button class=ghostw id=gridEditFromSel data-tip="Open the grid editor to rename, respace, or adjust the grid">✎ Grid lines…</button>${nFree?`<button class=danger id=gridDelFree data-tip="Delete the selected free grid line${nFree>1?'s':''} (Del)">${delLbl}</button>`:''}</div>`;
|
|
2533
|
+
{const eb=document.getElementById('gridEditFromSel');if(eb)eb.onclick=()=>{setGridMode(true);render();};}
|
|
2534
|
+
{const db=document.getElementById('gridDelFree');if(db)db.onclick=()=>deleteSelGrids();}
|
|
2535
|
+
return;}
|
|
2448
2536
|
const arr=selArr();
|
|
2449
2537
|
if(arr.length===0){p.innerHTML='<h3 style="display:flex;justify-content:space-between;align-items:center">Legend'+(Object.keys(C.profile_colors).length?'<button class=ghost id=resetCols style="font-size:10px;padding:1px 6px">reset colours</button>':'')+'</h3><div class=legend>'+profs.filter(pr=>P.members.some(mm=>mm.profile===pr)).map(pr=>`<span><input type=color class=swc data-prof="${esc(pr)}" value="${colorFor(pr)}" data-tip="Click to recolour ${esc(pr)}">${esc(pr)}</span>`).join('')+'</div><div class=hint style="margin-top:12px">Click a member to edit; <b>Ctrl</b>/<b>Shift+click</b> to add/remove; drag an empty area to <b>box-select</b> — <b>left→right</b> grabs fully-enclosed, <b>right→left</b> grabs touched (Ctrl/Shift adds). Drag a selected line to move it (all selected move together) — it snaps onto nearby grid/endpoints; drag an end dot to adjust — also snaps (<b>Alt</b> off). Hold <b>Shift</b> to keep it straight (H/V). <b>Ctrl+D</b> duplicate, <b>Ctrl+Z/Y</b> undo/redo, <b>Del</b> delete, <b>Esc</b> deselect. <b>Scroll</b> zoom, <b>middle-drag</b> pan, <b>Home</b> fit. Short even dashes = RFI (size unresolved, e.g. MF). A line with <b>arrowheads</b> is a <b>brace</b> — solid = above the floor, long–short dashes = below; the double arrowhead marks its lower end.</div>'+
|
|
2450
2538
|
'<div style="border-top:1px solid var(--line);margin-top:12px;padding-top:12px"><div class=sect>Project defaults</div>'+
|
|
@@ -2736,6 +2824,27 @@ let snapOnly=null; // Tekla-style TRANSIENT override: one snap kind ('end'|'in
|
|
|
2736
2824
|
const SNAP_PREF_KEY='steel:snapPrefs:v1', SNAP_DEFAULTS={end:true,int:true,mid:true,line:true,ext:false,perp:false,par:false};
|
|
2737
2825
|
let snapEnabled=(()=>{try{return Object.assign({},SNAP_DEFAULTS,JSON.parse(localStorage.getItem(SNAP_PREF_KEY)||'{}'));}catch(_){return {...SNAP_DEFAULTS};}})();
|
|
2738
2826
|
function saveSnapPrefs(){try{localStorage.setItem(SNAP_PREF_KEY,JSON.stringify(snapEnabled));}catch(_){}}
|
|
2827
|
+
// ── Selection filter (Tekla "select switches"): which object CLASSES — and which member types /
|
|
2828
|
+
// connection kinds — may enter a selection. One persisted source of truth, consulted at every pick
|
|
2829
|
+
// sink (2D click/marquee/Ctrl+A, 3D pick/box). Default: everything ON, so nothing is filtered out
|
|
2830
|
+
// (that default is also what fixes the silent Ctrl+A/marquee drops of dims + grids). GLOBAL like snaps.
|
|
2831
|
+
// State: grid/dim are plain on/off; Members & Connections have per-TYPE switches (mtype/ckind, absent===on)
|
|
2832
|
+
// and their class button is DERIVED (all/some/none on) — so "Members off" just means every member type off.
|
|
2833
|
+
const SELF_KEY='steel:selFilter:v1';
|
|
2834
|
+
// Grids default OFF (opt-in) — grid-line selection is a deliberate act, so a plain marquee/Ctrl+A doesn't
|
|
2835
|
+
// sweep the structural grid unless you switch it on. Members/Connections/Dimensions default ON.
|
|
2836
|
+
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:{}};}})();
|
|
2837
|
+
function saveSelFilter(){try{localStorage.setItem(SELF_KEY,JSON.stringify(selFilter));}catch(_){}}
|
|
2838
|
+
const normConnKind=k=>String(k||'').trim().toLowerCase(); // 'base-plate' | 'shear-plate' | 'custom'
|
|
2839
|
+
const selTypeOK=k=>selFilter.mtype[k]!==false; // per-member-type; absent === allowed
|
|
2840
|
+
const selKindOK=k=>selFilter.ckind[k]!==false; // per-connection-kind; absent === allowed
|
|
2841
|
+
function selMemberOK(m){return !m||selTypeOK(memberTypeOf(m));} // a member is selectable iff its type's switch is on
|
|
2842
|
+
function connKindOfPart(id){const p=partsById&&partsById[id];if(!p||!p.conn)return null;const j=(C.joints||[]).find(x=>x.id===p.conn);return j?normConnKind(j.kind):null;}
|
|
2843
|
+
function selConnPartOK(id){return selKindOK(connKindOfPart(id));}
|
|
2844
|
+
const selGridOK=()=>selFilter.grid!==false;
|
|
2845
|
+
const selDimOK=()=>selFilter.dim!==false;
|
|
2846
|
+
// classify any id already in / entering selIds — connection part, placed detail, or plain member — → allowed?
|
|
2847
|
+
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;}
|
|
2739
2848
|
// a type fires when a transient override forces exactly it (override ignores running-snaps, AutoCAD-style), else when its running-snap is on
|
|
2740
2849
|
const snapAllowed=k=>snapOnly?snapOnly===k:snapEnabled[k]!==false;
|
|
2741
2850
|
const _mid=(a,b)=>[(a[0]+b[0])/2,(a[1]+b[1])/2];
|
|
@@ -3581,11 +3690,12 @@ svg.addEventListener('pointerdown',e=>{if(e.button!==0)return;const t=e.target;
|
|
|
3581
3690
|
if(dimStyleMode)setDimStyleMode(false); // …and the Dimension style pane, so clicking a dim hands the panel to its inspector
|
|
3582
3691
|
if(dimSplitMode&&selDimIds.size&&dimsVisible&&mode==='sel'){let q=toSvg(e),x=q.x,y=q.y;if(!e.altKey){buildSnap(null);const sn=snap(x,y);x=sn.x;y=sn.y;}snapClear();dimSplitAt([x,y]);e.preventDefault();return;} // split mode → each click inserts a point into the selected dim under it
|
|
3583
3692
|
if(t.dataset.dimend!=null&&mode==='sel'){const id=t.dataset.dim,end=+t.dataset.dimend;buildSnap(id);drag={type:'dimend',id,end,pre:snapshot()};svg.setPointerCapture(e.pointerId);e.preventDefault();return;} // drag a selected dim's anchor handle → re-measure (snaps; exclude this dim so the end can't snap to its own line/midpoint)
|
|
3584
|
-
if(t.dataset.dim&&mode==='sel'){const did=t.dataset.dim;selIds.clear(); // a dim click is member-exclusive (clears any member selection)
|
|
3693
|
+
if(t.dataset.dim&&mode==='sel'&&selDimOK()){const did=t.dataset.dim;selIds.clear(); // a dim click is member-exclusive (clears any member selection); Dimensions select-switch off → click falls through (inert)
|
|
3585
3694
|
if(e.ctrlKey||e.metaKey){selDimIds.has(did)?selDimIds.delete(did):selDimIds.add(did);render();return;} // Ctrl+click toggles this dim within the dim selection
|
|
3586
3695
|
selDimIds=new Set([did]);const d=P.dims.find(x=>x.id===did); // plain click → exactly this dim (collapses any multi-selection, so Delete removes only it)
|
|
3587
3696
|
if(d){drag={type:'dim',id:d.id,pre:snapshot()};svg.setPointerCapture(e.pointerId);e.preventDefault();}render();return;} // drag the dim line to slide its offset
|
|
3588
3697
|
if(selDimIds.size){selDimIds.clear();render();} // ANY other click (member / handle / empty / marquee-start, incl. Ctrl) is dim-exclusive → drop the dim selection so Delete never hits a stale dim
|
|
3698
|
+
if(selGridIds.size&&!(e.ctrlKey||e.metaKey||e.shiftKey)){selGridIds.clear();render();} // a plain (non-additive) click elsewhere drops the grid selection too; Ctrl/Shift preserves it so grid marquees stay additive
|
|
3589
3699
|
if(geoMode==='split'&&selIds.size===1){const id=[...selIds][0],m=byId(id);
|
|
3590
3700
|
const q=toSvg(e),raw=projPt([q.x,q.y],m.wp[0],m.wp[1]);
|
|
3591
3701
|
const d=Math.hypot(q.x-raw.pt[0],q.y-raw.pt[1]); // clicked on the member?
|
|
@@ -3618,7 +3728,7 @@ svg.addEventListener('pointerdown',e=>{if(e.button!==0)return;const t=e.target;
|
|
|
3618
3728
|
return;}}
|
|
3619
3729
|
if(t.classList.contains('seg')&&mode==='add'&&!drawDraft){addFromSeg(t.dataset.seg);return;} // segment quick-add ONLY when no draw is in progress; mid-draw a seg click falls through to drawClick → places the end ON that segment
|
|
3620
3730
|
if(mode==='add'){drawClick(e);e.preventDefault();return;} // Add-member is click-to-place (like the Dimension tool): every canvas click drops a start/end point (snapped, incl. onto the traced overlay). Runs AFTER the label-pick (lblhot) and detected-segment (seg) branches above, so those still work.
|
|
3621
|
-
if(t.classList.contains('member')&&mode==='sel'){const id=t.dataset.id,ctrl=(e.ctrlKey||e.metaKey),add=(ctrl||e.shiftKey),p=toSvg(e);
|
|
3731
|
+
if(t.classList.contains('member')&&mode==='sel'&&selMemberOK(byId(t.dataset.id))){const id=t.dataset.id,ctrl=(e.ctrlKey||e.metaKey),add=(ctrl||e.shiftKey),p=toSvg(e); // Members select-switch (+ its per-type switch) gates the click; a filtered member is inert to the click
|
|
3622
3732
|
// Plain click selects on down (so a no-drag click still selects even with drag-move off). Ctrl/Shift defer
|
|
3623
3733
|
// their select to up — a Ctrl-DRAG copies, a Shift-DRAG moves (Shift also ortho-locks the move to H/V), and an additive-CLICK toggles selection (Tekla: Ctrl or Shift).
|
|
3624
3734
|
if(!add&&!selIds.has(id)){selIds=new Set([id]);render();}
|
|
@@ -3628,7 +3738,7 @@ svg.addEventListener('pointerdown',e=>{if(e.button!==0)return;const t=e.target;
|
|
|
3628
3738
|
buildSnap(srcIds); // snap the dragged line(s) to OTHER members'/segments' endpoints
|
|
3629
3739
|
drag={type:'grab',copy:ctrl,add,armed:canDrag,start:[p.x,p.y],items,clickId:id,pre:snapshot(),moved:false};
|
|
3630
3740
|
svg.setPointerCapture(e.pointerId);e.preventDefault();return;} // always capture: even an unarmed grab tracks the gesture so a blocked drag can teach the toggle
|
|
3631
|
-
if((t===svg||t.tagName==='image'||t.classList.contains('pdfsheet')||t.classList.contains('seg'))&&mode==='sel'){const p=toSvg(e); // t===svg/pdfsheet → drag on bare/vector canvas still box-selects
|
|
3741
|
+
if((t===svg||t.tagName==='image'||t.classList.contains('pdfsheet')||t.classList.contains('seg')||t.classList.contains('member')||(t.dataset&&t.dataset.dim!=null))&&mode==='sel'){const p=toSvg(e); // t===svg/pdfsheet → drag on bare/vector canvas still box-selects. A FILTERED member/dim also reaches here (its own click branch was skipped by the Select switch), so it's transparent — a box-select can start from atop it (Tekla).
|
|
3632
3742
|
const rc=document.createElementNS('http://www.w3.org/2000/svg','rect');rc.setAttribute('class','marquee window');svg.appendChild(rc);
|
|
3633
3743
|
drag={type:'marquee',x0:p.x,y0:p.y,sx0:e.clientX,window:true,add:(e.ctrlKey||e.metaKey||e.shiftKey),rect:rc};svg.setPointerCapture(e.pointerId);e.preventDefault();}});
|
|
3634
3744
|
svg.addEventListener('pointermove',e=>{
|
|
@@ -3737,7 +3847,7 @@ svg.addEventListener('pointerup',()=>{if(!drag)return;snapClear();epPrevClear();
|
|
|
3737
3847
|
if(!moved){if(wasBubble){setGridMode(true);
|
|
3738
3848
|
svg.querySelectorAll('line.member.sel,polygon.member.sel').forEach(n=>{n.classList.remove('sel');n.style.filter='';});svg.querySelectorAll('g.bracesym').forEach(n=>{n.classList.remove('sel');n.style.filter='';});
|
|
3739
3849
|
svg.querySelectorAll('circle.handle,circle.dimhandle,circle.numbg,text.numtx').forEach(n=>n.remove());
|
|
3740
|
-
svg.querySelectorAll('.dimsel').forEach(n=>n.classList.remove('dimsel'));}
|
|
3850
|
+
svg.querySelectorAll('.dimsel').forEach(n=>n.classList.remove('dimsel'));svg.querySelectorAll('line.gridln.sel').forEach(n=>n.classList.remove('sel'));} // grid mode clears selGridIds (data); drop the highlight VISUAL too since this path does no render()
|
|
3741
3851
|
return;}
|
|
3742
3852
|
if(pre&&snapshot()!==pre)pushUndo(pre);refresh3DGrid();render();return;}
|
|
3743
3853
|
if(drag.type==='gridline'){const wasBubble=drag.bubble,moved=drag.moved,pre=drag.pre;drag=null;gridReadoutHide();
|
|
@@ -3745,19 +3855,20 @@ svg.addEventListener('pointerup',()=>{if(!drag)return;snapClear();epPrevClear();
|
|
|
3745
3855
|
if(!moved){if(wasBubble){setGridMode(true); // opens the panel (clears the logical selection). NO render() — replacing the bubble between the two clicks of a dbl-click would swallow the rename gesture…
|
|
3746
3856
|
svg.querySelectorAll('line.member.sel,polygon.member.sel').forEach(n=>{n.classList.remove('sel');n.style.filter='';});svg.querySelectorAll('g.bracesym').forEach(n=>{n.classList.remove('sel');n.style.filter='';}); // …so drop the stale selection VISUALS surgically instead
|
|
3747
3857
|
svg.querySelectorAll('circle.handle,circle.dimhandle,circle.numbg,text.numtx').forEach(n=>n.remove());
|
|
3748
|
-
svg.querySelectorAll('.dimsel').forEach(n=>n.classList.remove('dimsel'));}
|
|
3858
|
+
svg.querySelectorAll('.dimsel').forEach(n=>n.classList.remove('dimsel'));svg.querySelectorAll('line.gridln.sel').forEach(n=>n.classList.remove('sel'));} // grid mode clears selGridIds (data); drop the highlight VISUAL too since this path does no render()
|
|
3749
3859
|
return;} // a no-move line-body click is a no-op (selection untouched)
|
|
3750
3860
|
if(pre&&snapshot()!==pre)pushUndo(pre);refresh3DGrid();render();return;}
|
|
3751
3861
|
if(drag.type==='marquee'){const r=drag.cur,win=drag.window!==false,add=drag.add;
|
|
3752
3862
|
if(r&&(r[2]-r[0]>2||r[3]-r[1]>2)){
|
|
3753
3863
|
const memHit=m=>{const w=isBrace(m)?braceDisplayLine(m):m.wp;return win?(inRect(w[0],r)&&inRect(w[1],r)):rectHit(w[0],w[1],r);}; // window: both ends enclosed · crossing: touched · brace = its VISIBLE offset line (Codex round-1)
|
|
3754
|
-
const mIds=P.members.filter(memHit).map(m=>m.id), dIds=[];
|
|
3755
|
-
if(dimsVisible)for(const d of P.dims){const g=dimGeo(d.a,d.b,d.axis,d.off,d.rot); // area-select grabs dims by their VISIBLE geometry — the dim line + its two witness lines (not the invisible anchor span)
|
|
3864
|
+
const mIds=P.members.filter(m=>selMemberOK(m)&&memHit(m)).map(m=>m.id), dIds=[], gIds=[]; // every class honours its select-switch (Select bar)
|
|
3865
|
+
if(dimsVisible&&selDimOK())for(const d of P.dims){const g=dimGeo(d.a,d.b,d.axis,d.off,d.rot); // area-select grabs dims by their VISIBLE geometry — the dim line + its two witness lines (not the invisible anchor span)
|
|
3756
3866
|
const hit=win?(inRect(g.p1,r)&&inRect(g.p2,r)):(rectHit(g.p1,g.p2,r)||rectHit(g.w[0][0],g.w[0][1],r)||rectHit(g.w[1][0],g.w[1][1],r));
|
|
3757
3867
|
if(hit)dIds.push(d.id);}
|
|
3758
|
-
if(
|
|
3759
|
-
|
|
3760
|
-
|
|
3868
|
+
if(selGridOK())for(const g of gridSelectables()){const hit=win?(inRect(g.p1,r)&&inRect(g.p2,r)):rectHit(g.p1,g.p2,r);if(hit)gIds.push(g.id);} // grids now join area-select (was silently dropped)
|
|
3869
|
+
if(add){for(const id of mIds)selIds.has(id)?selIds.delete(id):selIds.add(id);for(const id of dIds)selDimIds.has(id)?selDimIds.delete(id):selDimIds.add(id);for(const id of gIds)selGridIds.has(id)?selGridIds.delete(id):selGridIds.add(id);} // Ctrl/Shift → toggle each framed object (add/remove)
|
|
3870
|
+
else{selIds.clear();selDimIds.clear();selGridIds.clear();for(const id of mIds)selIds.add(id);for(const id of dIds)selDimIds.add(id);for(const id of gIds)selGridIds.add(id);}
|
|
3871
|
+
}else if(!add){selIds.clear();selDimIds.clear();selGridIds.clear();} // a click (no drag) on empty space clears — unless a modifier is held
|
|
3761
3872
|
drag.rect.remove();drag=null;render();return;}
|
|
3762
3873
|
if(drag.type==='grab'){
|
|
3763
3874
|
if(!drag.moved){ // no drag past threshold → it was a click
|
|
@@ -3830,6 +3941,7 @@ addEventListener('keydown',e=>{
|
|
|
3830
3941
|
if(e.key==='Escape'&&rfiOpen()){closeRFI();return;}
|
|
3831
3942
|
if(e.key==='Escape'&&confOpen()){closeConf();return;}
|
|
3832
3943
|
if(e.key==='Escape'&&snapMenuOpen()){closeSnapMenu();return;}
|
|
3944
|
+
if(e.key==='Escape'&&selFly.classList.contains('open')){closeSelFly();return;} // close the Select-filter type flyout first
|
|
3833
3945
|
if(e.key==='Escape'&&drag){e.preventDefault();const pre=drag.pre,wasGrid=drag.type==='gridline'||drag.type==='gridfree'; // Esc mid-drag → cancel the command and revert to the pre-drag state (no undo entry committed)
|
|
3834
3946
|
if(drag.type==='marquee'&&drag.rect)drag.rect.remove();
|
|
3835
3947
|
drag=null;snapClear();epPrevClear();gridReadoutHide();if(wasGrid||!anyToolActive())snapOnlyClear2d(); // a gridline drag's single-shot snap override is always cleared (it can run with the grid panel open, so don't gate on anyToolActive) — matches the normal release
|
|
@@ -3852,13 +3964,23 @@ addEventListener('keydown',e=>{
|
|
|
3852
3964
|
if(e.key==='Escape'&&selDimIds.size){if(dimSplitMode){dimSplitMode=false;snapClear();render();}else{selDimIds.clear();render();}return;} // Esc on a selected dim: end split mode → else deselect
|
|
3853
3965
|
if(e.key==='Escape'&&view3d&&mode==='add'&&window.Steel3DView&&window.Steel3DView.drEscape&&window.Steel3DView.drEscape()){return;} // 3D draw: 1st Esc drops the in-progress start pick, 2nd exits add mode (falls through below)
|
|
3854
3966
|
if(e.key==='Escape'&&!view3d&&mode==='add'&&drawDraft){drawDraft=null;drawPrevClear();render();return;} // 2D Add-member: 1st Esc drops the in-progress start point (2nd falls through below → exits the tool), like the Dimension tool
|
|
3855
|
-
if(e.key==='Escape'){if(geoMode){geoMode=null;setGeo();render();return;}if(mode==='add'){mode='sel';setMode();}picking=false;pickKind='profile';pickEnd=null;selIds.clear();render();return;}
|
|
3967
|
+
if(e.key==='Escape'){if(geoMode){geoMode=null;setGeo();render();return;}if(mode==='add'){mode='sel';setMode();}picking=false;pickKind='profile';pickEnd=null;selIds.clear();selGridIds.clear();render();return;}
|
|
3856
3968
|
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)
|
|
3857
3969
|
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
|
|
3858
3970
|
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)
|
|
3859
|
-
if((e.key==='Delete'||e.key==='Backspace')&&(selDimIds.size||selIds.size)&&!inForm){e.preventDefault();
|
|
3860
|
-
|
|
3861
|
-
|
|
3971
|
+
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)
|
|
3972
|
+
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)
|
|
3973
|
+
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)
|
|
3974
|
+
const hadReg=[...selGridIds].some(id=>id.startsWith('gv:')||id.startsWith('gh:')); // regular (spacing-generated) lines can't be individually deleted
|
|
3975
|
+
const willMutate=selDimIds.size||selIds.size||freeToDelete.length;
|
|
3976
|
+
if(willMutate)edit(()=>{
|
|
3977
|
+
if(selDimIds.size){P.dims=P.dims.filter(d=>!selDimIds.has(d.id));selDimIds.clear();}
|
|
3978
|
+
if(selIds.size){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
|
|
3979
|
+
if(freeToDelete.length&&P.grid&&Array.isArray(P.grid.lines))P.grid.lines=P.grid.lines.filter(l=>!glLids.has(String(l.id)));
|
|
3980
|
+
selGridIds.clear();});
|
|
3981
|
+
else{selGridIds.clear();render();} // only regular grid lines were selected → nothing to delete (no phantom undo step); repaint to drop the highlight
|
|
3982
|
+
if(hadReg)toast('Regular grid lines come from the grid spacing — remove them in “Grid lines…”. Only free grid lines are deletable here.');
|
|
3983
|
+
return;}
|
|
3862
3984
|
if(!inForm&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()==='d'&&!view3d){e.preventDefault();dimMode=!dimMode;setDimMode();render();setLastCmd('Dimension',()=>{if(!dimMode){dimMode=true;setDimMode();render();}});return;} // D — toggle the Dimension tool
|
|
3863
3985
|
if(!inForm&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()==='a'&&!view3d){e.preventDefault();document.getElementById('mAdd').click();return;} // A — toggle the Add-member tool (mirrors D=Dimension; plain 'a', Ctrl+A is still select-all). The mAdd click owns the arm/disarm-conflicts + setLastCmd logic.
|
|
3864
3986
|
if(dimMode&&!inForm&&!e.ctrlKey&&!e.metaKey&&!e.altKey){const dk=e.key.toLowerCase();
|
|
@@ -3882,7 +4004,15 @@ addEventListener('keydown',e=>{
|
|
|
3882
4004
|
if(k==='z'&&!e.shiftKey){e.preventDefault();doUndo();}
|
|
3883
4005
|
else if(k==='y'||(k==='z'&&e.shiftKey)){e.preventDefault();doRedo();}
|
|
3884
4006
|
else if(k==='d'&&selIds.size){e.preventDefault();doDup();}
|
|
3885
|
-
else if(k==='a'&&!inForm){e.preventDefault();
|
|
4007
|
+
else if(k==='a'&&!inForm){e.preventDefault(); // Ctrl+A — select all MEMBERS (honouring the Members switch) plus, in 2D, the visible dims + grid lines. Was: active-plan members only, and it CLEARED dims + never grabbed grids.
|
|
4008
|
+
// Scope to what's VISIBLE: 3D shows every sheet → all members model-wide (fixes 3D "Ctrl+A misses other sheets"); 2D shows one sheet → active plan only (matches the 2D marquee, so a following Delete never wipes members you can't see). Connections + 3D dims are picked by click/box, not swept by Ctrl+A (grabbing every bolt/plate would be noise).
|
|
4009
|
+
selIds=new Set((view3d?allMembers():P.members).filter(selMemberOK).map(m=>m.id));
|
|
4010
|
+
selDimIds.clear();sel3dDimIds.clear();selGridIds.clear();
|
|
4011
|
+
if(!view3d){ // the 2D-drawable classes join the sweep (3D dims/grids aren't 2D-marquee objects)
|
|
4012
|
+
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)
|
|
4013
|
+
if(selGridOK())selGridIds=new Set(gridSelectables().map(g=>g.id)); // grids too
|
|
4014
|
+
}
|
|
4015
|
+
render();}
|
|
3886
4016
|
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)
|
|
3887
4017
|
// zoom bar
|
|
3888
4018
|
document.getElementById('zIn').onclick=()=>zoomCentered(zoom*1.25);
|
|
@@ -3913,6 +4043,46 @@ function toggleSnap(k){snapEnabled[k]=!(snapEnabled[k]!==false);saveSnapPrefs();
|
|
|
3913
4043
|
for(const b of moreMenu.querySelectorAll('button.msnap'))b.onclick=e=>{e.stopPropagation();toggleSnap(b.dataset.snap);}; // menu switch (keeps the menu open — settings, not a one-shot action)
|
|
3914
4044
|
for(const b of snapBar.querySelectorAll('button'))b.onclick=()=>toggleSnap(b.dataset.snap); // quick-bar glyph
|
|
3915
4045
|
reflectSnapPrefs();
|
|
4046
|
+
// --- Selection-filter toolbar (Select bar): same discipline as the snap bar — selFilter is the one source
|
|
4047
|
+
// of truth; the 4 class switches + the two type flyouts (Members / Connections) all reflect off it, and every
|
|
4048
|
+
// toggle persists + re-renders. Tekla-style: a switch gates what future picks CAN select — it does NOT
|
|
4049
|
+
// retroactively deselect an already-selected object (render() paints from selIds as-is). Type lists are dynamic. ---
|
|
4050
|
+
const selBar=document.getElementById('selBar'),selFly=document.getElementById('selFly');
|
|
4051
|
+
const CONN_KIND_LABEL={'base-plate':'Base plate','shear-plate':'Shear plate','custom':'Imported'};
|
|
4052
|
+
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}));}
|
|
4053
|
+
function selGroupDef(grp){return grp==='members'
|
|
4054
|
+
? {title:'Members',all:'All member types',store:selFilter.mtype,records:memberTypeRecords(),empty:'No member types'}
|
|
4055
|
+
: {title:'Connections',all:'All connection types',store:selFilter.ckind,records:connKindRecords(),empty:'No connections in this model'};}
|
|
4056
|
+
function reflectSelFilter(){
|
|
4057
|
+
for(const b of selBar.querySelectorAll('button')){const cls=b.dataset.cls;b.classList.remove('on','partial','off');let dot=b.querySelector('.seldot');
|
|
4058
|
+
if(b.dataset.fly){const def=selGroupDef(b.dataset.fly),recs=def.records,onN=recs.filter(r=>def.store[r.k]!==false).length; // class state DERIVED from its per-type switches
|
|
4059
|
+
if(!recs.length){b.classList.add('off');b.setAttribute('aria-pressed','false');if(dot)dot.remove();} // nothing of this class in the model → dim/muted (like a disabled toggle), NOT a solid "on" that implies active filtering
|
|
4060
|
+
else{const allOn=onN===recs.length,noneOn=onN===0,partial=!allOn&&!noneOn;
|
|
4061
|
+
b.classList.add(allOn?'on':noneOn?'off':'partial');b.setAttribute('aria-pressed',String(!noneOn));
|
|
4062
|
+
if(partial){if(!dot){dot=document.createElement('span');dot.className='seldot';b.appendChild(dot);}}else if(dot)dot.remove();}}
|
|
4063
|
+
else{const on=selFilter[cls]!==false;b.classList.add(on?'on':'off');b.setAttribute('aria-pressed',String(on));if(dot)dot.remove();}}
|
|
4064
|
+
if(selFly.classList.contains('open'))renderSelFly(selFly.dataset.grp); // keep an open flyout's rows honest
|
|
4065
|
+
}
|
|
4066
|
+
function toggleSelClass(cls){selFilter[cls]=!(selFilter[cls]!==false);saveSelFilter();reflectSelFilter();render();} // grid/dim direct on/off
|
|
4067
|
+
function renderSelFly(grp){const def=selGroupDef(grp);selFly.dataset.grp=grp;const recs=def.records,onN=recs.filter(r=>def.store[r.k]!==false).length;
|
|
4068
|
+
const allOn=onN===recs.length,mixed=recs.length>0&&onN>0&&onN<recs.length;
|
|
4069
|
+
const rows=recs.map(r=>`<button class="frow${def.store[r.k]!==false?' checked':''}" role=menuitemcheckbox data-k="${esc(r.k)}"><span class=fck></span><span class=nm>${esc(r.label)}</span></button>`).join('')||`<div class=fempty>${esc(def.empty)}</div>`;
|
|
4070
|
+
selFly.innerHTML=`<div class=fhdr><b>${esc(def.title)}</b><span class=cnt>${onN} of ${recs.length}</span></div>`+
|
|
4071
|
+
`<button class="frow all${allOn?' checked':''}${mixed?' mixed':''}" role=menuitemcheckbox data-all=1><span class=fck></span><span class=nm>${esc(def.all)}</span></button>`+
|
|
4072
|
+
`<div class=fsep></div><div class=flist>${rows}</div>`;}
|
|
4073
|
+
function openSelFly(grp,btn){renderSelFly(grp);selFly.classList.add('open');
|
|
4074
|
+
const r=btn.getBoundingClientRect();selFly.style.left=Math.max(8,Math.min(r.left,innerWidth-selFly.offsetWidth-8))+'px';selFly.style.top=(r.top-selFly.offsetHeight-8)+'px';} // bar at bottom → open upward
|
|
4075
|
+
function closeSelFly(){selFly.classList.remove('open');selFly.dataset.grp='';}
|
|
4076
|
+
selBar.querySelectorAll('button').forEach(b=>{b.onclick=e=>{e.stopPropagation();
|
|
4077
|
+
if(b.dataset.fly){if(selFly.classList.contains('open')&&selFly.dataset.grp===b.dataset.fly)closeSelFly();else openSelFly(b.dataset.fly,b);}
|
|
4078
|
+
else toggleSelClass(b.dataset.cls);};});
|
|
4079
|
+
selFly.addEventListener('click',e=>{const row=e.target.closest('.frow');if(!row)return;e.stopPropagation();const def=selGroupDef(selFly.dataset.grp);
|
|
4080
|
+
if(row.dataset.all){const allOn=def.records.length>0&&def.records.every(r=>def.store[r.k]!==false);
|
|
4081
|
+
if(allOn)def.records.forEach(r=>def.store[r.k]=false);else def.records.forEach(r=>{delete def.store[r.k];});} // All: everything off ⇄ everything on (clears per-type overrides → absent===on)
|
|
4082
|
+
else{const k=row.dataset.k;def.store[k]=!(def.store[k]!==false);}
|
|
4083
|
+
saveSelFilter();reflectSelFilter();render();});
|
|
4084
|
+
document.addEventListener('click',e=>{if(selFly.classList.contains('open')&&!selFly.contains(e.target)&&!selBar.contains(e.target))closeSelFly();});
|
|
4085
|
+
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 (looks like "nothing filtered") while selFilter is still active.
|
|
3916
4086
|
// --- Move/Copy split-button dropdowns: same open/close discipline as the ⋯ menu ---
|
|
3917
4087
|
function wireCmMenu(caretId,menuId){const b=document.getElementById(caretId),m=document.getElementById(menuId);
|
|
3918
4088
|
const close=()=>{m.classList.remove('open');b.setAttribute('aria-expanded','false');document.removeEventListener('mousedown',out,true);};
|
|
@@ -3954,26 +4124,29 @@ const view3dApi={
|
|
|
3954
4124
|
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;}
|
|
3955
4125
|
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
|
|
3956
4126
|
|
|
3957
|
-
onSelect:(id,additive)=>{selDimIds.clear();sel3dDimIds.clear();if(!id){selIds=new Set();}else{if(additive){selIds.has(id)?selIds.delete(id):selIds.add(id);}else{selIds=new Set([id]);}}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 2D + 3D dim selection so Delete is unambiguous)
|
|
3958
|
-
onSelectMany:(ids,additive)=>{
|
|
3959
|
-
if(additive
|
|
3960
|
-
|
|
4127
|
+
onSelect:(id,additive)=>{if(id&&!selIdOK(id))return;selDimIds.clear();sel3dDimIds.clear();if(!id){selIds=new Set();}else{if(additive){selIds.has(id)?selIds.delete(id):selIds.add(id);}else{selIds=new Set([id]);}}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 2D + 3D dim selection so Delete is unambiguous). A filtered object (Select switch off) is inert.
|
|
4128
|
+
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)
|
|
4129
|
+
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
|
|
4130
|
+
selDimIds.clear();sel3dDimIds.clear();
|
|
4131
|
+
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
|
|
4132
|
+
else selIds=new Set(ids2);
|
|
3961
4133
|
if(mode==='add'){mode='sel';setMode();}render();if(window.Steel3DView&&window.Steel3DView.refreshDims)window.Steel3DView.refreshDims();}, // 3D box-select → shared selection
|
|
3962
4134
|
getMembers:()=>P.members, // active-sheet members (wp) for snap geometry (one ppf)
|
|
3963
4135
|
allMembers, // EVERY sheet's members — the 3D box-select tests all visible meshes, not just the active sheet's
|
|
3964
4136
|
snapEnabled:()=>snapEnabled, // the persistent running-snaps (⋯ menu → Snapping) — 3D honours the same on/off set
|
|
4137
|
+
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)
|
|
3965
4138
|
ptPerFt:()=>(P&&P.pt_per_ft>0?P.pt_per_ft:1),
|
|
3966
4139
|
defaultTosMm:()=>(defaultTOS!=null?defaultTOS*25.4:0), // editor stores default T.O.S in inches
|
|
3967
4140
|
geoMode:()=>geoMode, // 'el' | 'split' | null — armed Trim/Extend/Split state
|
|
3968
|
-
onMoveMember:(id,newWp)=>{edit(()=>{const m=byId(id);if(m)m.wp=newWp;});}, // 3D drag → write wp (undoable, autosaves, syncs 2D/chip/BOM)
|
|
4141
|
+
onMoveMember:(id,newWp)=>{edit(()=>{const m=byId(id);if(m)m.wp=newWp;});}, // 3D drag → write wp (undoable, autosaves, syncs 2D/chip/BOM). NOTE: the Select filter gates SELECTION (pick/marquee/Ctrl+A), NOT direct 3D drag-manipulation — gating here would strand the renderer's live preview (the mesh is already moved), so a filtered member is still directly draggable in 3D by design.
|
|
3969
4142
|
dragMoveEnabled:()=>dragMoveOn, // the 3D view gates its plain member-drag on this
|
|
3970
4143
|
dragMoveHint:()=>{if(dragHintShown)return;dragHintShown=true;try{localStorage.setItem('steel:dragmovehint:v1','1');}catch(_){}toast('Drag to move/copy is off — turn it on in the Move / Copy menu, or use the Move (M) / Copy (C) tools');},
|
|
3971
|
-
onCopyDrag3d:(ids,dxMm,dyMm)=>{const r6=n=>Math.round(n*1e6)/1e6; // Ctrl+drag copy: mm delta → plan px (Y FLIPPED), clone + translate + select
|
|
4144
|
+
onCopyDrag3d:(ids,dxMm,dyMm)=>{const r6=n=>Math.round(n*1e6)/1e6; // Ctrl+drag copy: mm delta → plan px (Y FLIPPED), clone + translate + select (direct manipulation, not gated by the Select filter — see onMoveMember)
|
|
3972
4145
|
edit(()=>{const ns=new Set();for(const id of (ids||[])){const src=byId(id);if(!src)continue;const pl=planeOf(id);const k=304.8/((pl&&pl.pt_per_ft>0)?pl.pt_per_ft:1); // mm→px in the SOURCE plane's own scale (sheets may differ)
|
|
3973
4146
|
const c=cloneMember(src);translateMembers([c],[r6(dxMm/k),r6(-dyMm/k),0]);pl.members=pl.members||[];pl.members.push(c);ns.add(c.id);}selIds=ns;}); // clone lands on the SOURCE's plane (a cross-sheet selection copies each member onto its own sheet, not the active one)
|
|
3974
4147
|
toast('Copied '+(ids?ids.length:0)+' member'+((ids&&ids.length===1)?'':'s'));},
|
|
3975
|
-
onMoveEndpoint:(id,end,wp)=>{edit(()=>{const m=byId(id);if(m&&Array.isArray(m.wp)&&m.wp.length>=2)m.wp[end]=wp;});}, // 3D end-node drag → write just that endpoint
|
|
3976
|
-
onElevateMember:(id,dIn)=>{edit(()=>{const m=byId(id);if(!m)return;ensureMeta(m); // 3D Alt-drag → raise/lower T.O.S by dIn inches
|
|
4148
|
+
onMoveEndpoint:(id,end,wp)=>{edit(()=>{const m=byId(id);if(m&&Array.isArray(m.wp)&&m.wp.length>=2)m.wp[end]=wp;});}, // 3D end-node drag → write just that endpoint (direct manipulation, not gated by the Select filter — see onMoveMember)
|
|
4149
|
+
onElevateMember:(id,dIn)=>{edit(()=>{const m=byId(id);if(!m)return;ensureMeta(m); // 3D Alt-drag → raise/lower T.O.S by dIn inches (direct manipulation, not gated by the Select filter — see onMoveMember)
|
|
3977
4150
|
if(m.role==='column'){m.col.tos=(m.col.tos!=null?m.col.tos:defaultTOS)+dIn;m.col.bos=(m.col.bos!=null?m.col.bos:0)+dIn;m.col.tosDef=false;} // rigid raise (bos null→0, both shift) so the column isn't stretched
|
|
3978
4151
|
else m.ends.forEach(e=>{e.tos=(e.tos!=null?e.tos:defaultTOS)+dIn;e.tosDef=false;});});},
|
|
3979
4152
|
onTrimExtend:(targetId)=>{const tm=byId(targetId);
|
|
@@ -3988,6 +4161,7 @@ const view3dApi={
|
|
|
3988
4161
|
onSnapOnlyChanged:()=>updSnapStat(), // keep the header snap-override chip honest for every 3D-side clear (tool disarm etc.)
|
|
3989
4162
|
onDeleteDim3d:(id)=>{C.dims3d=(C.dims3d||[]).filter(x=>x.id!==id);sel3dDimIds.delete(id);scheduleSave();refreshDims3d();},
|
|
3990
4163
|
onSelectDim3d:(id,mods)=>{ // Ctrl/Shift multi-select (same as parts); selecting a dim is exclusive with member/2D-dim/clip selection
|
|
4164
|
+
if(id&&!selDimOK())return; // Dimensions select-switch off → a 3D dim is inert too
|
|
3991
4165
|
if(!id){sel3dDimIds.clear();render();return;}
|
|
3992
4166
|
selIds=new Set();selDimIds.clear();if(window.Steel3DView&&window.Steel3DView.setSelectedClips)window.Steel3DView.setSelectedClips([]);
|
|
3993
4167
|
const ids=(C.dims3d||[]).map(d=>d.id),cur=new Set(sel3dDimIds);let next;
|
|
@@ -5257,7 +5431,7 @@ function applyViewState(on){ // flip the toggle + swap the canvases (
|
|
|
5257
5431
|
document.getElementById('dim3dWrap').style.display=on?'inline-flex':'none'; // 3D Dimension cluster (moved to header) — 3D only
|
|
5258
5432
|
document.getElementById('m3dCube').style.display=on?'block':'none';
|
|
5259
5433
|
document.getElementById('m3dAxes').style.display=on?'block':'none';
|
|
5260
|
-
document.getElementById('
|
|
5434
|
+
document.getElementById('ptrBars').classList.toggle('s3d',on); // in 3D the pointer-behaviour bars shift clear of the world-axis triad (bottom-right); see #ptrBars.s3d
|
|
5261
5435
|
if(!on)document.getElementById('m3dLegend').style.display='none'; // panel is shown by setView (showLegendPanel) when entering 3D
|
|
5262
5436
|
}
|
|
5263
5437
|
async function setView(on){
|
|
@@ -5272,6 +5446,7 @@ async function setView(on){
|
|
|
5272
5446
|
if(csaxisMode){csaxisMode=false;setCsMode();} // drops the in-progress origin (csDraft) + the set-axes panel
|
|
5273
5447
|
if(picking){picking=false;pickKind='profile';pickEnd=null;} // an armed inspector ⌖ pick
|
|
5274
5448
|
if(on){
|
|
5449
|
+
if(selGridIds.size){selGridIds.clear();disarmed2d=true;} // grids are 2D-only — a grid selection is invisible in 3D and would be silently removed by a 3D Delete (or a member-Delete), so drop it on entry
|
|
5275
5450
|
if(dimMode||dimChain||dimSplitMode){disarmed2d=true;dimMode=dimChain=dimSplitMode=false;selDimIds.clear();setDimMode();document.body.classList.remove('dimsplit');} // entering 3D disarms the 2D dim/chain/split tools so their X/Y/F/S/Esc keys don't double-fire with the 3D tool
|
|
5276
5451
|
if(dimStyleMode){disarmed2d=true;dimStyleMode=false;} // …and closes the 2D Dimension style pane (it styles the 2D overlay only)
|
|
5277
5452
|
if(disarmed2d)render(); // repaint the 2D SVG + inspector ONCE, now that EVERY 2D-only tool is disarmed and view3d is still false (2D render path): they suppress callouts / draw pick hotspots (:2061,:2069) and take over #panel, and the return-to-2D path never render()s — so a render here (like the Esc paths) un-stales the canvas + panel. Deferred past the dim/dim-style disarm so it can't paint a still-armed Dimension panel (dimMode can coexist with grid/pick) that then goes stale.
|
|
@@ -5824,7 +5999,7 @@ function setPlan(i){C.active=i;P=C.plans[i];
|
|
|
5824
5999
|
profs=[...new Set([...P.members.map(m=>m.profile), ...Object.keys(WT)])].sort();
|
|
5825
6000
|
// undo/redo is one GLOBAL stack (module-level, declared once) — NOT swapped per plane. A plane switch
|
|
5826
6001
|
// must not reset or re-scope undo, since snapshots are whole-model and selection/edits span sheets.
|
|
5827
|
-
selIds=new Set();findHits=new Set();picking=false;pickKind='profile';pickEnd=null;mode='sel';geoMode=null; // findHits
|
|
6002
|
+
selIds=new Set();findHits=new Set();selGridIds=new Set();picking=false;pickKind='profile';pickEnd=null;mode='sel';geoMode=null; // findHits + selGridIds reset per plan like selIds — a stale highlight (or, for grids, an index-based id) must not bleed onto another sheet (grids are per-plan)
|
|
5828
6003
|
dimMode=false;dimChain=false;dimSplitMode=false;selDimIds=new Set();setDimMode(); // Dimension tool resets per plan (incl. chain + split); setDimMode syncs the button/body.dimon classes + clears any draft/preview/chain (dimsVisible persists across plans)
|
|
5829
6004
|
setMode(); // Add-member likewise resets per plan: syncs body.add (crosshair) + the button off, and drops any in-progress start point (a plan-pixel draft is stale on another sheet)
|
|
5830
6005
|
if(gridMode||gridPick||gridLinePick){if(gridLinePick&&gridLinePick.line)gridLinePick.line.remove();gridMode=false;gridPick=false;gridLinePick=null;gridSetPickClass();} // grid panel/pick disarms per plan like the other takeover tools (a leaked pick would set geometry in the WRONG sheet's display space)
|