@floless/app 0.130.0 → 0.130.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 +1353 -647
- package/dist/schemas/steel.model.v2.schema.json +28 -8
- package/dist/web/steel-3d-view.js +328 -32
- package/dist/web/steel-editor.html +142 -8
- package/package.json +1 -1
|
@@ -568,6 +568,18 @@
|
|
|
568
568
|
#moreMenu .msnap-sub input{width:92px;height:24px;background:var(--bg);color:var(--text);border:1px solid var(--line);border-radius:5px;padding:0 7px;font:12px system-ui;box-sizing:border-box}
|
|
569
569
|
#moreMenu .msnap-sub input:focus{outline:none;border-color:var(--brand)}
|
|
570
570
|
#moreMenu .msnap-sub .oghint{flex-basis:100%;color:var(--mut);font-size:11px;line-height:1.4;margin-top:2px} /* nudge shown only when the grid is on but no local frame is set yet */
|
|
571
|
+
/* A settings row under a Display toggle — label, slider, readout. Deliberately NOT .msnap-sub: that one
|
|
572
|
+
is hidden unless its parent toggle is on AND the view is 3D, and grid label size applies always, in
|
|
573
|
+
both views. The slider itself is themed by the global input[type=range] rule; only sizing lives here. */
|
|
574
|
+
/* WRAPPED, label on its own line. The menu is 210px wide and this row is indented 26px with 12px of
|
|
575
|
+
right padding, so it has ~172px to work in — while "Grid label size" + a slider + a readout on ONE
|
|
576
|
+
line needs ~227px. Laid out flat, the readout was pushed past the panel's own right edge and (in 3D
|
|
577
|
+
at a 1600px window) off the screen with it: the DOM value was right, so it read correct to a probe,
|
|
578
|
+
while the user saw "2" of "26 px". */
|
|
579
|
+
#moreMenu .mrow{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;padding:2px 12px 8px 26px;max-width:100%;box-sizing:border-box}
|
|
580
|
+
#moreMenu .mrow .mlbl{color:var(--mut);font-size:11px;flex:0 0 100%}
|
|
581
|
+
#moreMenu .mrow input[type=range]{flex:1 1 60px;min-width:0}
|
|
582
|
+
#moreMenu .mrow .mval{color:var(--mut);font-size:11px;flex:none;min-width:38px;text-align:right;font-variant-numeric:tabular-nums}
|
|
571
583
|
/* Pointer-behaviour bars, bottom-right of the canvas (both views): [ Select filter ] [ Snap ]. Both reuse the brand-fill "on" toolbar language. */
|
|
572
584
|
/* One bottom dock owns both sides of the canvas chrome. The hint may shrink; Select/Snap never do, so
|
|
573
585
|
the two surfaces cannot overlap at narrower widths. In 3D the whole dock stops before the world-axis
|
|
@@ -1571,6 +1583,10 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1571
1583
|
<button id=dimToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide all placed dimensions on the plan"><span class=mck aria-hidden=true></span>Dimensions</button>
|
|
1572
1584
|
<button id=calloutToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide the clickable callout bubbles (section / elevation / detail references) on the plan"><span class=mck aria-hidden=true></span>Callouts</button>
|
|
1573
1585
|
<button id=gridToggleB class=dtog role=menuitemcheckbox aria-checked=false data-tip="Show or hide the grid lines in 2D and 3D"><span class=mck aria-hidden=true></span>Grid lines</button>
|
|
1586
|
+
<!-- step=1, NOT 2: clampGridLabelPx rounds to an integer and the key is user-writable, so a coarser
|
|
1587
|
+
step would let a stored odd value draw at 15 and read "15 px" while the browser snapped the thumb
|
|
1588
|
+
to 16 — then jumped on the first drag. One authority on what a legal size is. -->
|
|
1589
|
+
<div class=mrow><span class=mlbl>Grid label size</span><input id=gridLabelSize type=range min=14 max=48 step=1 aria-label="Grid label size in pixels" data-tip="How big the grid bubbles are drawn, in both 2D and 3D. Like a CAD drawing they hold this size on screen however far you zoom in or out."><span id=gridLabelSizeV class=mval>26 px</span></div>
|
|
1574
1590
|
<button id=lenToggleB class=dtog role=menuitemcheckbox aria-checked=false data-tip="Show the length of each selected member in 2D and 3D"><span class=mck aria-hidden=true></span>Member length</button>
|
|
1575
1591
|
<button id=plToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide property labels in the 2D plan (the property selection is shared with 3D — this hides them here only)"><span class=mck aria-hidden=true></span>Property labels</button>
|
|
1576
1592
|
<button id=refToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide the traced reference sheet (the PDF/SVG drawing under the model). Hidden, it also stops contributing snap points."><span class=mck aria-hidden=true></span>Reference sheet</button>
|
|
@@ -2841,6 +2857,18 @@ let drawDraft=null; // Add-member tool: the first CLICKED start point (or null
|
|
|
2841
2857
|
let calloutsVisible=true; // Workstream B: show/hide the clickable callout bubbles (details + section/elevation/detail-ref) on the plan in select mode
|
|
2842
2858
|
let showSelLen=(()=>{try{return localStorage.getItem('steel:selLen:v1')==='1';}catch(_){return false;}})(); // ⋯ Display → Show member length: paint each selected member's length on the canvas (opt-in, default off)
|
|
2843
2859
|
let refSheetOn=(()=>{try{return localStorage.getItem('steel:refSheet:v1')!=='0';}catch(_){return true;}})(); // ⋯ Display → Reference sheet (F13): show/hide the traced PDF/SVG overlay under the model (default ON; only an explicit '0' hides it)
|
|
2860
|
+
// ⋯ Display → Grid label size: how big a grid bubble is ON SCREEN, in px. Constant on screen in both
|
|
2861
|
+
// views (2D divides by zoom, 3D re-derives a world size per frame), so one grid reads the same in each —
|
|
2862
|
+
// which is why the setting is shared rather than per-view. A VIEW preference, not model data: it lives in
|
|
2863
|
+
// this browser and never enters the contract. steel-3d-view.js reads the SAME key at load, so the two
|
|
2864
|
+
// agree before the first frame; changing it here pushes to the renderer live (setGridLabelPx).
|
|
2865
|
+
const GRID_LABEL_PX_DEFAULT=26,GRID_LABEL_PX_MIN=14,GRID_LABEL_PX_MAX=48;
|
|
2866
|
+
// × gridLabelPx between two bubble centres before the later one drops out. Must be ≥ 1: gridLabelPx IS
|
|
2867
|
+
// the diameter, so centres one diameter apart are exactly touching. Same value as the renderer's
|
|
2868
|
+
// GRID_LABEL_MIN_GAP — the two views must agree about what "too close" means.
|
|
2869
|
+
const GRID_LABEL_MIN_GAP=1.05;
|
|
2870
|
+
const clampGridLabelPx=v=>{const n=Math.round(+v);return Number.isFinite(n)&&n>0?Math.min(GRID_LABEL_PX_MAX,Math.max(GRID_LABEL_PX_MIN,n)):GRID_LABEL_PX_DEFAULT;};
|
|
2871
|
+
let gridLabelPx=(()=>{try{const raw=localStorage.getItem('steel:gridLabelPx:v1');return raw===null?GRID_LABEL_PX_DEFAULT:clampGridLabelPx(raw);}catch(_){return GRID_LABEL_PX_DEFAULT;}})();
|
|
2844
2872
|
let gridMode=false, gridPick=false, gridLinePick=null; // Grid lines: panel-takeover editing mode + armed pick-origin / single-line clicks
|
|
2845
2873
|
let dimStyleMode=false; // Dimension style: panel-takeover pane for the model-global defaults (⋯ → Display → Dimension style…)
|
|
2846
2874
|
let csaxisMode=false, csDraft=null; // Local coordinate system "set axes" tool: armed flag + in-progress origin [x,y] (null until click 1). P.frame={o,u} holds the committed local frame (null = global).
|
|
@@ -4665,21 +4693,101 @@ function gridLineEndpoints(el){const geo=gridGeo();if(!geo||!el||!el.dataset)ret
|
|
|
4665
4693
|
const gi=+(free?el.dataset.gl:(el.dataset.gv!=null?el.dataset.gv:el.dataset.gh));if(!isFinite(gi))return null;
|
|
4666
4694
|
const line=free?(geo.lines||[])[gi]:geo[axis][gi];if(!line)return null;
|
|
4667
4695
|
return free?[line.a.slice(),line.b.slice()]:(axis==='v'?[[line.x,line.lo],[line.x,line.hi]]:[[line.lo,line.y],[line.hi,line.y]]);}
|
|
4696
|
+
// Grid bubble geometry in SCREEN px — shared by the first render and the zoom rescale so the two can
|
|
4697
|
+
// never drift apart. Two CAD habits are encoded here. (1) EVERY bubble is the same diameter, exactly
|
|
4698
|
+
// gridLabelPx, and a long mark shrinks its TEXT to fit — that is how a drawing does it, and it is the
|
|
4699
|
+
// only way "one size, both views" can be literally true (3D's gridBubbleTexture shrinks to fit too, so
|
|
4700
|
+
// growing the circle here instead made 2D 26% bigger than 3D for any 4-character insert like "10.1").
|
|
4701
|
+
// (2) It sits TANGENT to the end of its line, on the far side from the model — the line stops at the
|
|
4702
|
+
// circle instead of running to its centre. That is the same convention gridFromDrawing measures on real
|
|
4703
|
+
// sheets, and it is what keeps a bubble off the perimeter column standing at the grid end.
|
|
4704
|
+
// sizeGridLabels() in steel-3d-view.js does both of these for 3D, from the same gridLabelPx.
|
|
4705
|
+
function gridBubbleRPx(){return gridLabelPx/2;} // ONE diameter for every mark, always
|
|
4706
|
+
// EXACT text width, not an estimate. Measured once per label on a canvas in the same font, at a
|
|
4707
|
+
// reference size, and scaled linearly — advance width is linear in font size, so one measure per
|
|
4708
|
+
// distinct mark for the life of the page. The estimate this replaces (0.58em × character count) is
|
|
4709
|
+
// blind to which glyphs they are: QA measured "D12" reaching 12.01 px into a rim that spans
|
|
4710
|
+
// 11.50–13.00 px, i.e. the D and the 2 sitting ON the stroke, because D is nearer 0.72em than 0.58.
|
|
4711
|
+
// LAZY and guarded, not a module-scope `createElement(...).getContext('2d')`: the characterization
|
|
4712
|
+
// harness evaluates this script over a minimal DOM stub whose canvas has no 2D context, so eager
|
|
4713
|
+
// construction threw during load and took 75 tests with it.
|
|
4714
|
+
let _gridTxCtx=null,_gridTxCtxTried=false;const _gridTxW=new Map();
|
|
4715
|
+
function gridLabelWidthEm(label){const t=String(label==null?'':label)||' ';
|
|
4716
|
+
if(_gridTxW.has(t))return _gridTxW.get(t);
|
|
4717
|
+
if(!_gridTxCtxTried){_gridTxCtxTried=true;try{_gridTxCtx=document.createElement('canvas').getContext('2d');}catch(_){_gridTxCtx=null;}}
|
|
4718
|
+
let w;
|
|
4719
|
+
if(_gridTxCtx&&typeof _gridTxCtx.measureText==='function'){_gridTxCtx.font='bold 100px system-ui';w=_gridTxCtx.measureText(t).width/100;}
|
|
4720
|
+
// No canvas to measure with (headless). A deliberately GENEROUS per-character estimate, so the fallback
|
|
4721
|
+
// can only shrink the text further than a real measurement would — it can never overrun the rim.
|
|
4722
|
+
else w=t.length*0.62;
|
|
4723
|
+
_gridTxW.set(t,w);return w;}
|
|
4724
|
+
// Fit the text to the CIRCLE, not to the diameter. A centred line of text is widest at its own
|
|
4725
|
+
// half-height, where the circle has already narrowed — so the constraint is
|
|
4726
|
+
// (w·fs/2)² + (0.36·fs)² ≤ Ri² (0.36em ≈ half the cap height)
|
|
4727
|
+
// which solves in closed form for fs. Ri is the INNER radius: the rim is a 1.5 px non-scaling stroke, so
|
|
4728
|
+
// text that stops at R still lands on it. 0.95 keeps the ink clearly inside rather than exactly tangent.
|
|
4729
|
+
// The base ratio (26px bubble → 12px text) is the ceiling; a long mark only ever shrinks from there.
|
|
4730
|
+
function gridLabelFontPx(label){
|
|
4731
|
+
const w=gridLabelWidthEm(label),Ri=Math.max(1,gridBubbleRPx()-1.5);
|
|
4732
|
+
return Math.min(gridLabelPx*0.46,0.95*Ri/Math.sqrt(w*w/4+0.1296));}
|
|
4668
4733
|
function gridSvg(){
|
|
4669
4734
|
if(!gridOn())return '';
|
|
4670
4735
|
const geo=gridGeo();if(!geo||(!geo.v.length&&!geo.h.length&&!(geo.lines&&geo.lines.length)))return '';
|
|
4671
|
-
const R=11/zoom,F=12/zoom;
|
|
4672
4736
|
let s='<g id=gridG>';
|
|
4673
4737
|
const gsel=i=>selGridIds.has(i)?' sel':''; // marquee/Ctrl+A grid selection → highlight the visible line
|
|
4674
4738
|
const gTip=geoMode==='el'?'extend/trim target':'drag to move'; // while Extend/Trim is armed, a grid line is a target (drag is disabled) — don't promise "drag to move"
|
|
4675
4739
|
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)} — ${gTip}"></line>`;});
|
|
4676
4740
|
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)} — ${gTip}"></line>`;});
|
|
4677
4741
|
(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)} — ${gTip}"></line>`;});
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4742
|
+
// (ox,oy) is the line's OTHER end — it gives the outward direction the bubble hangs along. Both are
|
|
4743
|
+
// baked onto the group as data-* so sizeGridBubbles() can re-place the circle on zoom without a rebuild
|
|
4744
|
+
// (a rebuild between a dblclick's two clicks would kill the rename gesture — see gridRenameBubble).
|
|
4745
|
+
const bub=(x,y,ox,oy,lb,ax,i,end)=>{
|
|
4746
|
+
// A zero-length line has no outward direction. `|| 1` used to guard the division and yield a ZERO
|
|
4747
|
+
// vector, parking the bubble on the model — the one thing this placement exists to prevent, in code
|
|
4748
|
+
// that read as if the case were handled. +X is arbitrary but it is a real direction. (Same in 3D.)
|
|
4749
|
+
const dx=x-ox,dy=y-oy,len=Math.hypot(dx,dy),ux=len>1e-9?dx/len:1,uy=len>1e-9?dy/len:0;
|
|
4750
|
+
const R=gridBubbleRPx()/zoom,F=gridLabelFontPx(lb)/zoom,cx=x+ux*R,cy=y+uy*R;
|
|
4751
|
+
return `<g class=gridbubg data-${ax}="${i}" data-end="${end}" data-ax="${x}" data-ay="${y}" data-ux="${ux}" data-uy="${uy}" data-label="${esc(lb)}" data-tip="Grid ${esc(lb)} — drag to move or adjust · dbl-click to rename · click to select"><circle class=gridbub cx="${cx}" cy="${cy}" r="${R}"/><text class=gridtx x="${cx}" y="${cy}" style="font-size:${F}px">${esc(lb)}</text></g>`;};
|
|
4752
|
+
geo.v.forEach((l,i)=>{s+=bub(l.x,l.lo,l.x,l.hi,l.label,'gv',i,0)+bub(l.x,l.hi,l.x,l.lo,l.label,'gv',i,1);});
|
|
4753
|
+
geo.h.forEach((l,i)=>{s+=bub(l.lo,l.y,l.hi,l.y,l.label,'gh',i,0)+bub(l.hi,l.y,l.lo,l.y,l.label,'gh',i,1);});
|
|
4754
|
+
(geo.lines||[]).forEach((l,i)=>{s+=bub(l.a[0],l.a[1],l.b[0],l.b[1],l.label,'gl',i,0)+bub(l.b[0],l.b[1],l.a[0],l.a[1],l.label,'gl',i,1);});
|
|
4682
4755
|
return s+'</g>';}
|
|
4756
|
+
// Re-place + re-size every 2D bubble for the current zoom (and for a changed Grid label size), from the
|
|
4757
|
+
// anchor/outward baked above — the screen-constant half of the same two habits gridSvg documents.
|
|
4758
|
+
function sizeGridBubbles(){
|
|
4759
|
+
const placedBubbles=[];
|
|
4760
|
+
svg.querySelectorAll('g.gridbubg').forEach(g=>{
|
|
4761
|
+
const c=g.querySelector('circle.gridbub'),t=g.querySelector('text.gridtx');if(!c||!t)return;
|
|
4762
|
+
const R=gridBubbleRPx()/zoom,F=gridLabelFontPx(g.dataset.label)/zoom;
|
|
4763
|
+
const cx=+g.dataset.ax+(+g.dataset.ux)*R,cy=+g.dataset.ay+(+g.dataset.uy)*R;
|
|
4764
|
+
// A NaN here does NOT leave a missing bubble — it leaves a bubble frozen at the previous zoom's
|
|
4765
|
+
// radius and centre, drifting off its line end as the plan scales under it. That reads as "the
|
|
4766
|
+
// drawing is wrong", not "one element failed to update", so it says so once. Reachable from a
|
|
4767
|
+
// malformed grid coordinate: sanitizePlanGrid only validates `origin`, so a NaN endpoint survives it.
|
|
4768
|
+
if(!isFinite(cx)||!isFinite(cy)||!isFinite(R)){if(!staleBubbleWarned){staleBubbleWarned=true;console.warn('steel-editor: grid bubble "'+(g.dataset.label||'?')+'" has an unusable anchor — it will not follow the zoom (check the grid coordinates)');}return;}
|
|
4769
|
+
c.setAttribute('r',R);c.setAttribute('cx',cx);c.setAttribute('cy',cy);
|
|
4770
|
+
t.setAttribute('x',cx);t.setAttribute('y',cy);t.style.fontSize=F+'px';
|
|
4771
|
+
g.style.removeProperty('display');placedBubbles.push({g,cx,cy});});
|
|
4772
|
+
// DECLUTTER, the same rule 3D applies — a drawing never prints two bubbles on top of each other, and
|
|
4773
|
+
// the plan can pile them up just as readily: zoom out far enough, or take the size up towards 48 px, and
|
|
4774
|
+
// adjacent endpoints come closer than one diameter. (It went unnoticed because at the default 26 px the
|
|
4775
|
+
// 2D zoom bottoms out with the closest centres at ~30 px — just clear.) Distances are compared in USER
|
|
4776
|
+
// units, where the threshold is the screen gap ÷ zoom, exactly as the radius is.
|
|
4777
|
+
// Selection first, then document order: the same stable, selection-aware priority as sizeGridLabels, so
|
|
4778
|
+
// the grid you are working on never loses its label and the survivors don't flicker while zooming.
|
|
4779
|
+
if(selGridIds.size)placedBubbles.sort((a,b)=>(gridIdOfBubble(b.g)&&selGridIds.has(gridIdOfBubble(b.g))?1:0)-(gridIdOfBubble(a.g)&&selGridIds.has(gridIdOfBubble(a.g))?1:0));
|
|
4780
|
+
const minGap=gridLabelPx*GRID_LABEL_MIN_GAP/zoom,kept=[];
|
|
4781
|
+
for(const b of placedBubbles){
|
|
4782
|
+
if(kept.some(k=>Math.hypot(k.cx-b.cx,k.cy-b.cy)<minGap)){b.g.style.display='none';continue;}
|
|
4783
|
+
kept.push(b);}}
|
|
4784
|
+
// The grid id a 2D bubble group belongs to — mirrors the axis/index decode the drag and rename paths use.
|
|
4785
|
+
function gridIdOfBubble(g){const geo=gridGeo()||{};
|
|
4786
|
+
if(g.dataset.gv!=null)return 'gv:'+g.dataset.gv;
|
|
4787
|
+
if(g.dataset.gh!=null)return 'gh:'+g.dataset.gh;
|
|
4788
|
+
if(g.dataset.gl!=null){const l=(geo.lines||[])[+g.dataset.gl];return 'gl:'+(l&&l.id!=null?l.id:g.dataset.gl);}
|
|
4789
|
+
return null;}
|
|
4790
|
+
let staleBubbleWarned=false; // warn once; sizeGridBubbles runs on every zoom step
|
|
4683
4791
|
// live re-render of just the grid layer while a line is being dragged (render() is too heavy per move)
|
|
4684
4792
|
function refreshGridLayer(){const el=document.getElementById('gridG');if(el)el.outerHTML=gridSvg();}
|
|
4685
4793
|
// every visible grid line with a synthetic id + endpoints — the source for marquee/Ctrl+A grid selection.
|
|
@@ -5281,8 +5389,7 @@ function updateBadges(){const R=12/zoom,F=13/zoom,ox=el=>(+el.dataset.fi-(+el.da
|
|
|
5281
5389
|
// (brace arrowheads need no rescale here — they are content-unit sized, so they scale with the member
|
|
5282
5390
|
// stroke exactly like the line they cap. See braceHeadPoints().)
|
|
5283
5391
|
{const dg=svg.querySelector('g.dimsg');if(dg)dg.innerHTML=renderDimsInner();} // dims shrink below DIM_ZMIN (see dimSvg) so dense dims don't overlap when zoomed out (B8) — every part of a dim is zoom-derived, so rebuild the group rather than patch it
|
|
5284
|
-
|
|
5285
|
-
svg.querySelectorAll('text.gridtx').forEach(t=>t.style.fontSize=(12/zoom)+'px');
|
|
5392
|
+
sizeGridBubbles(); // radius, font AND centre — the bubble hangs off its line end by its own radius, so a zoom that changes the radius moves it too
|
|
5286
5393
|
// property-label chips: recompute size + stacked screen offset from the baked anchor (ax,ay) + per-row screen
|
|
5287
5394
|
// offset (off) so they stay constant on screen while zooming (like dim chips) — AND re-apply the zoom
|
|
5288
5395
|
// threshold live (data-mlen × zoom), so zooming reveals/hides labels as members cross ~24px on screen.
|
|
@@ -7868,6 +7975,28 @@ document.getElementById('dimToggleB').onclick=e=>{e.stopPropagation();if(MODEL_R
|
|
|
7868
7975
|
// selected-member payload to 3D on both formats.
|
|
7869
7976
|
function updLenToggle(){const b=document.getElementById('lenToggleB');if(!b)return;const on=showSelLen;b.disabled=false;b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));}
|
|
7870
7977
|
document.getElementById('lenToggleB').onclick=e=>{e.stopPropagation();showSelLen=!showSelLen;try{localStorage.setItem('steel:selLen:v1',showSelLen?'1':'0');}catch(_){}updLenToggle();render();}; // render() repaints the 2D chips + pushes/clears labels in 3D
|
|
7978
|
+
// ⋯ Display → Grid label size. One setting, both views: 2D re-places its bubbles from the anchors baked
|
|
7979
|
+
// by gridSvg (no re-render — a rebuild between a dblclick's two clicks would kill the rename gesture),
|
|
7980
|
+
// and 3D is told live, where sizeGridLabels() re-derives the world size on the next frame.
|
|
7981
|
+
// Guarded like every other row in this menu (updLenToggle, updCalloutToggle) and for a sharper reason:
|
|
7982
|
+
// this block runs INSIDE main(), which boot() calls unguarded and which wires the SSE subscription
|
|
7983
|
+
// AFTER it — so an unguarded throw on a missing element would abort the remaining ~6000 lines of main()
|
|
7984
|
+
// plus live updates, and leave a half-initialised editor whose root cause is a range input.
|
|
7985
|
+
{const r=document.getElementById('gridLabelSize'),v=document.getElementById('gridLabelSizeV');
|
|
7986
|
+
if(!r||!v)console.warn('steel-editor: the Grid label size control is missing from ⋯ ▸ Display — grid labels stay at '+gridLabelPx+'px this session');
|
|
7987
|
+
else{
|
|
7988
|
+
const showVal=()=>{v.textContent=gridLabelPx+' px';};
|
|
7989
|
+
r.min=GRID_LABEL_PX_MIN;r.max=GRID_LABEL_PX_MAX;r.value=gridLabelPx;showVal();
|
|
7990
|
+
r.addEventListener('input',()=>{gridLabelPx=clampGridLabelPx(r.value);showVal();
|
|
7991
|
+
// A failed write is the ONE path where the two views can disagree: the live push below is skipped
|
|
7992
|
+
// while the renderer module is still loading, so the shared key is the only thing left to carry the
|
|
7993
|
+
// size across — and it just didn't. setView(true) re-pushes on the next switch to 3D, so the
|
|
7994
|
+
// divergence self-heals; this says why persistence stopped working. (Idiom as at :2590.)
|
|
7995
|
+
try{localStorage.setItem('steel:gridLabelPx:v1',String(gridLabelPx));}
|
|
7996
|
+
catch(_){if(!gridLabelPxSaveWarned){gridLabelPxSaveWarned=true;console.warn('steel-editor: the grid label size could not be saved to this browser — it will not survive a reload');}}
|
|
7997
|
+
sizeGridBubbles();
|
|
7998
|
+
if(window.Steel3DView&&window.Steel3DView.setGridLabelPx)window.Steel3DView.setGridLabelPx(gridLabelPx);});}}
|
|
7999
|
+
let gridLabelPxSaveWarned=false;
|
|
7871
8000
|
function updCalloutToggle(){const b=document.getElementById('calloutToggleB');if(!b)return;const on=!MODEL_RO&&calloutsVisible;b.disabled=MODEL_RO;b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));} // plan-only, like Dimensions
|
|
7872
8001
|
document.getElementById('calloutToggleB').onclick=e=>{e.stopPropagation();if(MODEL_RO)return;calloutsVisible=!calloutsVisible;updCalloutToggle();render();};
|
|
7873
8002
|
// NOTE FOR THE NEXT EDITOR: do NOT add `b.disabled=MODEL_RO` here to match the five rows around it.
|
|
@@ -8065,7 +8194,11 @@ addEventListener('keydown',e=>{
|
|
|
8065
8194
|
if(pre)apply(pre);else render(); // apply() restores the snapshot + re-renders (2D+3D); draw/marquee have no snapshot, just refresh
|
|
8066
8195
|
return;}
|
|
8067
8196
|
if(e.key==='Escape'&&!view3d&&snapOnly){snapOnlyClear2d();return;} // own Esc rung: 1st Esc drops the snap override, the next cancels the tool/draft (mirrors the set-axes two-step)
|
|
8068
|
-
|
|
8197
|
+
// `!inForm`, like the shortcuts below it: Home/End is the documented affordance of a range input
|
|
8198
|
+
// (jump to min/max), and ⋯ ▸ Display now has one. Without the gate, tabbing to Grid label size and
|
|
8199
|
+
// pressing Home preventDefault()s the jump-to-min AND zooms the plan to fit behind the open menu —
|
|
8200
|
+
// while End still works, so the pair behaved asymmetrically, which is worse than either alone.
|
|
8201
|
+
if(e.key==='Home'&&!inForm){e.preventDefault();if(view3d&&window.Steel3DView)window.Steel3DView.frameAll();else fitToWindow();return;}
|
|
8069
8202
|
if(view3d&&window.Steel3DView&&!inForm&&e.shiftKey&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!cmTool&&mode!=='add'&&!(window.Steel3DView.dimToolOn&&window.Steel3DView.dimToolOn())){const ck=e.key.toLowerCase(); // Shift+X arms a clip plane, Shift+B a clip box (3D-only sectioning; mirrors the Clip ▾ menu). Both are skipped while Move/Copy, Add, or 3D-Dim is armed: Shift+X then falls through to that tool's X-axis lock (instead of nuking the pick), and Shift+B is held off for the same reason so it can't discard an in-progress operation either.
|
|
8070
8203
|
if(ck==='x'){e.preventDefault();window.Steel3DView.setClipMode('plane');setLastCmd('Clip plane',()=>window.Steel3DView.setClipMode('plane'));return;}
|
|
8071
8204
|
if(ck==='b'){e.preventDefault();window.Steel3DView.setClipMode('box');setLastCmd('Clip box',()=>window.Steel3DView.setClipMode('box'));return;}}
|
|
@@ -12669,6 +12802,7 @@ async function setView(on){
|
|
|
12669
12802
|
if(seq!==viewSeq)return;
|
|
12670
12803
|
window.Steel3DView.setSelection(selIds);
|
|
12671
12804
|
if(window.Steel3DView.setGridSelection)window.Steel3DView.setGridSelection(selGridIds); // carry the shared 2D grid selection across the rebuild; rebuild replaces the line objects/materials
|
|
12805
|
+
if(window.Steel3DView.setGridLabelPx)window.Steel3DView.setGridLabelPx(gridLabelPx); // the renderer reads the shared key at LOAD and the slider pushes live, but a size set BEFORE the module arrived reaches it through neither — so relay it here too, like every other preference in this block. Makes a 2D/3D divergence self-healing on the next switch rather than permanent.
|
|
12672
12806
|
wire3DBar();wireLegendTabs();loadSteelFavourites();build3DLegend();
|
|
12673
12807
|
// Reference models (#278). The tab exists only on the model-level contract — hidden, not disabled,
|
|
12674
12808
|
// because a tab that can never hold anything is the same dead chrome the header stats are hidden for.
|