@floless/app 0.133.2 → 0.134.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 +5079 -2851
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +93 -6
- package/dist/web/app.css +99 -8
- package/dist/web/app.js +32 -0
- package/dist/web/aware.js +833 -109
- package/dist/web/commands-filter.js +79 -5
- package/dist/web/commands-shell.js +130 -11
- package/dist/web/commands-steel.js +26 -4
- package/dist/web/index.html +30 -15
- package/dist/web/instructor.js +90 -35
- package/dist/web/steel-3d-core.js +329 -3
- package/dist/web/steel-3d-view.js +613 -8
- package/dist/web/steel-editor.html +406 -27
- package/dist/web/steel-filter-core.js +189 -16
- package/dist/web/steel-filter.html +865 -46
- package/dist/web/steel-model-commands.js +23 -2
- package/dist/web/steel-model-v2-commands.js +124 -0
- package/dist/web/workspaces.js +555 -82
- package/package.json +1 -1
|
@@ -575,6 +575,8 @@
|
|
|
575
575
|
body.v3d #moreMenu #dimStyleB{display:none} /* …and the mirror: Dimension style edits the 2D dim overlay, so it has nothing to show in 3D (Grid lines… stays — a grid IS drawn in 3D) */
|
|
576
576
|
body.v3d #moreMenu #csSetB{display:none} /* the 2D set-local-axes (P.frame) is 2D-only… */
|
|
577
577
|
body:not(.v3d) #moreMenu #csArm3dB,body:not(.v3d) #moreMenu #csF3dFields{display:none} /* …and the 3D local frame is 3D-only */
|
|
578
|
+
body:not(.v3d) #moreMenu #posGizmoToggleB{display:none} /* the Profile Position gizmo is a 3D handle — hide its toggle in 2D */
|
|
579
|
+
body:not(.v3d) #posFromMemberRow{display:none} /* "From member" adopts a member's own 3D axes as the coordinate system — 3D-only */
|
|
578
580
|
#moreMenu #csArm3dB.on{border-color:var(--brand);color:var(--brand)}
|
|
579
581
|
#csF3dFields{display:none;grid-template-columns:auto 1fr;gap:4px 7px;align-items:center;margin:6px 2px 2px} /* base hide as a RULE (not inline) so #csF3dFields.on can override it — an inline display:none can't be beaten by a class (Codex) */
|
|
580
582
|
#csF3dFields.on{display:grid}
|
|
@@ -839,6 +841,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
839
841
|
#cmHud{position:fixed;z-index:70;display:none;align-items:center;gap:6px;background:var(--panel);border:1px solid var(--brand);border-radius:8px;padding:6px 8px;box-shadow:0 6px 20px rgba(0,0,0,.55);font:12px system-ui;color:var(--mut)}
|
|
840
842
|
#cmHud.err{border-color:#fca5a5}
|
|
841
843
|
#cmHud input{width:110px;height:24px;background:var(--bg);color:var(--text);border:1px solid var(--line);border-radius:5px;padding:0 7px;font:12px system-ui}
|
|
844
|
+
#cmHud input::placeholder{color:var(--mut);opacity:.75} /* the position HUD opens empty with the current value as its placeholder — keep it legibly muted, never the washed-out browser default */
|
|
842
845
|
#cmHud input:focus{outline:none;border-color:var(--brand)}
|
|
843
846
|
#cmHud.err input{border-color:#fca5a5}
|
|
844
847
|
#cmHudPill{display:inline-flex;align-items:center;gap:2px;padding:2px;height:20px;border-radius:4px;background:#0f172a;border:1px solid var(--line)}
|
|
@@ -1842,6 +1845,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1842
1845
|
to 16 — then jumped on the first drag. One authority on what a legal size is. -->
|
|
1843
1846
|
<div class=mrow><span class=mlbl>Grid label size</span><input data-command-id="steel.grid-label-size" 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>
|
|
1844
1847
|
<button data-command-id="steel.show-member-length" 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>
|
|
1848
|
+
<button data-command-id="steel.position-gizmo" id=posGizmoToggleB class=dtog role=menuitemcheckbox aria-checked=false data-tip="Show a drag handle on the selected member for setting its Profile Position right in the 3D view"><span class=mck aria-hidden=true></span>Position handle</button>
|
|
1845
1849
|
<button data-command-id="steel.show-property-labels" 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>
|
|
1846
1850
|
<button data-command-id="steel.show-reference-sheet" 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>
|
|
1847
1851
|
<button data-command-id="steel.grid" id=gridEditB data-tip="Grid lines — a plan reference with structural bay spacings (n*d repeats a bay). Shows in 2D and 3D; drawing and drags snap to its lines and intersections.">Grid lines…</button>
|
|
@@ -3078,6 +3082,7 @@ let _lastDimDown=null; // F8: {id,t} of the last dim pointerdown, for manual d
|
|
|
3078
3082
|
let drawDraft=null,drawBasisTok=null; // Add-member tool: the first CLICKED start point + immutable authoring-basis snapshot (or null) — both picks must stay in one frame
|
|
3079
3083
|
let calloutsVisible=true; // Workstream B: show/hide the clickable callout bubbles (details + section/elevation/detail-ref) on the plan in select mode
|
|
3080
3084
|
let showSelLen=(()=>{try{return localStorage.getItem('steel:selLen:v2')==='1';}catch(_){return false;}})(); // ⋯ Display → Show member length: paint each selected member's length on the canvas (opt-in, default off)
|
|
3085
|
+
let showPosGizmo=(()=>{try{return localStorage.getItem('steel:posGizmo:v2')==='1';}catch(_){return false;}})(); // ⋯ Display → Position handle: the 3D Profile Position gizmo on the selected member (opt-in, default off)
|
|
3081
3086
|
let refSheetOn=(()=>{try{return localStorage.getItem('steel:refSheet:v2')!=='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)
|
|
3082
3087
|
// ⋯ Display → Grid label size: how big a grid bubble is ON SCREEN, in px. Constant on screen in both
|
|
3083
3088
|
// views (2D divides by zoom, 3D re-derives a world size per frame), so one grid reads the same in each —
|
|
@@ -3396,7 +3401,146 @@ function commitPositionEdit(members,userPatch,source){const captured=positionAut
|
|
|
3396
3401
|
prepared.push({m,patch:Object.assign({},patch,userPatch)});}
|
|
3397
3402
|
if(blockers.length)return positionRefuse('No changes made — '+blockers.join('; ')+'. Resolve every blocker, or set Depth and Width to Middle in each stored frame first.',source);
|
|
3398
3403
|
const current=positionAuthoringBasis();if(current.generation!==captured.generation)return positionRefuse('Frame changed — review the refreshed Profile Position and try again.',source);
|
|
3399
|
-
edit(
|
|
3404
|
+
// Return what edit() ACTUALLY did, not an unconditional true. edit() catches a V2CommandError, toasts it
|
|
3405
|
+
// and returns false; discarding that made a refusal read to the caller as success, and the 3D gizmo keys
|
|
3406
|
+
// its "put the live preview back" branch on exactly this boolean (steel-3d-view.js onUp), so a refused
|
|
3407
|
+
// commit left the moved mesh on screen over an unchanged model. Of the callers here only
|
|
3408
|
+
// commitMemberPosition propagates the value — every other one ignores it in statement position — so this
|
|
3409
|
+
// reaches precisely the consumer that wanted the truth. (slice 3b.1)
|
|
3410
|
+
return edit(()=>{for(const row of prepared)ModelCmd.patchMember(row.m,row.patch);})===true;}
|
|
3411
|
+
/*
|
|
3412
|
+
* Read-only snapshot the 3D Profile Position gizmo (slice 3a) renders from. The editor owns the
|
|
3413
|
+
* semantics; the 3D view only draws the arrows and reports back an ABSOLUTE new value, which
|
|
3414
|
+
* `commitMemberPosition` sends through the shipped `commitPositionEdit` (which rebases to the current
|
|
3415
|
+
* authoring frame exactly as a panel edit does). The values here MIRROR the inspector panel — the SAME
|
|
3416
|
+
* numbers the panel shows — so the gizmo and the panel can never show two different numbers for the same
|
|
3417
|
+
* member:
|
|
3418
|
+
* - the numeric offsets are the stored values (they are basis-independent — a rebase preserves them);
|
|
3419
|
+
* - `rot` is `positionAuthoringRoll(m)` — the stored roll RE-EXPRESSED into the current authoring frame
|
|
3420
|
+
* (3b.2), matching the panel's rotation field/chips (`rotDisp`/`rotN` also read `positionAuthoringRoll`).
|
|
3421
|
+
* The axes are the CURRENT authoring frame's part frame, so a depth/width drag moves the steel along the
|
|
3422
|
+
* same axis a panel offset edit would, and the re-expressed roll makes the roll drag agree too — which is
|
|
3423
|
+
* why the 3a basis-match guard is retired here (the gizmo works under any frame with preview == commit).
|
|
3424
|
+
*/
|
|
3425
|
+
function memberPositionGizmoState(id){
|
|
3426
|
+
const m=byId(id);if(!m)return{available:false,reason:'no member'};
|
|
3427
|
+
const captured=positionAuthoringBasis();if(!captured.ok)return{available:false,reason:captured.message};
|
|
3428
|
+
const input=positionRebaseInput(m);if(!input)return{available:false,reason:m.id+' has incomplete work points'};
|
|
3429
|
+
// 3b.2: the gizmo works under ANY frame. The displayed roll is re-expressed into the current authoring
|
|
3430
|
+
// frame (positionAuthoringRoll — the same angle the Inspect panel shows), and the numeric offsets are
|
|
3431
|
+
// basis-independent, so a drag's live preview — swung with THIS roll on the current-frame axes, from the
|
|
3432
|
+
// last bake — is exactly what commitPositionEdit re-derives (no jump on release; the 3a basis-match guard
|
|
3433
|
+
// is retired). It is available only where a commit would succeed: preflight the rebase and refuse on any
|
|
3434
|
+
// failure (a named face on an unresolved section, a residual, a degenerate frame), so the gizmo never
|
|
3435
|
+
// shows a member the Inspect panel would refuse to commit — never a stored-roll fallback that lies.
|
|
3436
|
+
if(!positionBasisMatches(input.canonical,captured)){
|
|
3437
|
+
const pf=SteelCore.reexpressMemberPlacement(input.canonical,input.from,input.to,captured,input.extents);
|
|
3438
|
+
if(!pf.ok)return{available:false,reason:m.id+' can’t be re-expressed in the current frame — use the Inspect panel'};
|
|
3439
|
+
}
|
|
3440
|
+
const f=SteelCore.positionGizmoFrame(input.from,input.to,captured);
|
|
3441
|
+
if(!f)return{available:false,reason:m.id+' has no Profile Position frame in the current view'};
|
|
3442
|
+
return{available:true,id,anchor:[...input.from],xAxis:[...f.x],yAxis:[...f.y],zAxis:[...f.z],
|
|
3443
|
+
positionOffset:+m.positionOffset||0,positionHOffset:+m.positionHOffset||0,rot:positionAuthoringRoll(m),degenerate:!!f.degenerate,
|
|
3444
|
+
// slice 3b.1 — the reference-line handles need the FAR work point and the basis UP vector as well, plus a
|
|
3445
|
+
// drag-start FINGERPRINT. The fingerprint has to be captured HERE, when the gesture starts, because that
|
|
3446
|
+
// is the state the drag's arithmetic is frozen against; taking it again at commit time would compare the
|
|
3447
|
+
// live member with itself and the staleness guard could never fire (found in review).
|
|
3448
|
+
end:[...input.to],up:positionBasisUp(captured),fingerprint:V2Commands.memberFingerprint(input.canonical),
|
|
3449
|
+
handles:refLineHandleAvailability(m,f,input.from,input.to,positionBasisUp(captured))};}
|
|
3450
|
+
/*
|
|
3451
|
+
* The authoring basis' up vector — world Z under the global basis, else x × y. This is the PLAN-SWING
|
|
3452
|
+
* AXIS, and deliberately not the member's own tilted zAxis: rotating about up leaves both the rise and the
|
|
3453
|
+
* run untouched, so the slope is invariant, the rebuilt part frame equals the rigid preview exactly, and
|
|
3454
|
+
* the swing is provably immune to the 30° depth-face fold. Rotating about the body z would change the
|
|
3455
|
+
* slope on any sloped member and make preview and commit disagree.
|
|
3456
|
+
*/
|
|
3457
|
+
function positionBasisUp(basis){
|
|
3458
|
+
if(!basis||basis.kind==='global')return[0,0,1];
|
|
3459
|
+
const x=basis.x,y=basis.y;
|
|
3460
|
+
return[x[1]*y[2]-x[2]*y[1],x[2]*y[0]-x[0]*y[2],x[0]*y[1]-x[1]*y[0]];}
|
|
3461
|
+
/*
|
|
3462
|
+
* Which reference-line handles this member can actually take, decided from GEOMETRY rather than from its
|
|
3463
|
+
* role alone, each with the reason it is refused.
|
|
3464
|
+
*
|
|
3465
|
+
* The slide is representable for EVERY member, a plumb column included — there it is raise/lower, and the
|
|
3466
|
+
* model stores exactly that. The swings are not: a v2 column is plumb by construction (both work points
|
|
3467
|
+
* share the plan point; only the elevations differ), so a tilt has nowhere to live. And on a DEGENERATE
|
|
3468
|
+
* start frame — partFrame's seeded branch — the closed-form plumb barrier does not apply at all, because
|
|
3469
|
+
* `yAxis` is projected from `upX` there and need not be perpendicular to up. A plan swing additionally
|
|
3470
|
+
* preserves the member's distance from the degeneracy cone, so a member that starts inside it can never
|
|
3471
|
+
* leave: the handle would be permanently inert rather than merely awkward. Refuse both, and say why.
|
|
3472
|
+
*/
|
|
3473
|
+
function refLineHandleAvailability(m,f,from,to,up){
|
|
3474
|
+
const col=m.role==='column';
|
|
3475
|
+
const swing=col?{available:false,reason:'A column stays plumb — set its elevations in the Inspect panel.'}
|
|
3476
|
+
:f.degenerate?{available:false,reason:'This member is plumb — there is no direction to swing it from.'}
|
|
3477
|
+
:{available:true};
|
|
3478
|
+
// A member that is NEARLY plumb is not degenerate, so the check above lets it through — but its two plumb
|
|
3479
|
+
// barriers then sit on the same side of zero, leaving no legal travel one way. A handle that refuses every
|
|
3480
|
+
// drag is worse than one that is not drawn, so require a whole snap step each side and say why. (Review:
|
|
3481
|
+
// without this, a Shift-held tilt on such a member committed roughly a degree in the OPPOSITE direction.)
|
|
3482
|
+
const elev=swing.available&&!SteelCore.swingHasTravel(
|
|
3483
|
+
SteelCore.swingBarriers(from,to,f.y,up,SteelCore.POSITION_SWING_MARGIN_RAD),SteelCore.POSITION_ROT_SNAP_DEG*Math.PI/180)
|
|
3484
|
+
?{available:false,reason:'This member is within a degree of plumb — set its elevations in the Inspect panel.'}
|
|
3485
|
+
:swing;
|
|
3486
|
+
return{slide:{available:true},swingPlan:swing,swingElev:elev};}
|
|
3487
|
+
/*
|
|
3488
|
+
* The gizmo's one write path: the 3D view hands back an absolute new offset (mm) or roll (deg) for a
|
|
3489
|
+
* single member; this routes it through `commitPositionEdit`, which rebases to the current frame,
|
|
3490
|
+
* applies the edit, and produces exactly one undo entry. Returns a boolean (false = refused).
|
|
3491
|
+
*/
|
|
3492
|
+
function commitMemberPosition(id,patch,source){const m=byId(id);if(!m)return positionRefuse('That member is no longer in the model.',source);return commitPositionEdit([m],patch,source||null);}
|
|
3493
|
+
/*
|
|
3494
|
+
* The reference-line handles' one write path (slice 3b.1): the 3D view hands back ABSOLUTE new work points
|
|
3495
|
+
* in world mm, and this commits them as a single undoable edit.
|
|
3496
|
+
*
|
|
3497
|
+
* Deliberately separate from `commitMemberPosition`. That one rebases the stored placement into the current
|
|
3498
|
+
* authoring frame before applying an offset/roll; an endpoint move needs none of that dance, because it does
|
|
3499
|
+
* not change the authoring frame at all — `m.rot` and `m.positionBasis` stay untouched and the displayed
|
|
3500
|
+
* roll re-derives on the new part frame through `positionAuthoringRoll`.
|
|
3501
|
+
*
|
|
3502
|
+
* WHAT THIS OWNS, and what the model command re-checks underneath it:
|
|
3503
|
+
* - the authoring basis must not have drifted since the gesture began (the same generation compare the
|
|
3504
|
+
* panel commit does);
|
|
3505
|
+
* - the candidate points are QUANTISED here, before anything is decided from them, because the depth-face
|
|
3506
|
+
* fold is a threshold test and an unquantised preview can land on the other side of it from what is
|
|
3507
|
+
* actually stored;
|
|
3508
|
+
* - the depth-face pin is computed HERE, from current canonical state, through the same shared helper the
|
|
3509
|
+
* command verifies with — so the two can never drift apart;
|
|
3510
|
+
* - FRAME-BRANCH STABILITY. A swing must land on partFrame's ordinary branch. A slide must merely keep the
|
|
3511
|
+
* branch it started on, IN BOTH DIRECTIONS: a slide is not frame-preserving to the bit (each endpoint
|
|
3512
|
+
* quantises independently, perturbing the direction by ~1e-9), so near the cone it can nudge a member
|
|
3513
|
+
* OUT of the seeded branch as easily as into it — and leaving the cone rebuilds a different section
|
|
3514
|
+
* frame than the rigid preview showed.
|
|
3515
|
+
*
|
|
3516
|
+
* Returns a plain boolean. The pin, when one is applied, is announced here and only AFTER the write lands,
|
|
3517
|
+
* so a refused commit can never announce a pin that was never stored.
|
|
3518
|
+
*/
|
|
3519
|
+
function commitMemberEndpoints(id,spec,source){
|
|
3520
|
+
const m=byId(id);if(!m)return positionRefuse('That member is no longer in the model.',source);
|
|
3521
|
+
const captured=positionAuthoringBasis();if(!captured.ok)return positionRefuse(captured.message,source);
|
|
3522
|
+
const input=positionRebaseInput(m);if(!input)return positionRefuse(m.id+' has incomplete work points.',source);
|
|
3523
|
+
const q=(p)=>[SteelCore.quantizeMm(p[0]),SteelCore.quantizeMm(p[1]),SteelCore.quantizeMm(p[2])];
|
|
3524
|
+
const from=spec&&spec.from?q(spec.from):[...input.from],to=spec&&spec.to?q(spec.to):[...input.to];
|
|
3525
|
+
if(![...from,...to].every(Number.isFinite))return positionRefuse('That move produced a coordinate the model cannot store.',source);
|
|
3526
|
+
const before=SteelCore.positionGizmoFrame(input.from,input.to,captured);
|
|
3527
|
+
const after=SteelCore.positionGizmoFrame(from,to,captured);
|
|
3528
|
+
if(!after)return positionRefuse('That move leaves the member with no length.',source);
|
|
3529
|
+
const gesture=spec&&spec.gesture;
|
|
3530
|
+
if(gesture==='slide'?(!!after.degenerate!==!!(before&&before.degenerate))
|
|
3531
|
+
:after.degenerate)return positionRefuse('That move would leave the section with no usable frame — try a smaller change.',source);
|
|
3532
|
+
const pin=SteelCore.requiredDepthPin(input.canonical,{from:input.from,to:input.to},{from,to}).pin;
|
|
3533
|
+
const current=positionAuthoringBasis();if(current.generation!==captured.generation)return positionRefuse('Frame changed — review the refreshed Profile Position and try again.',source);
|
|
3534
|
+
const ok=edit(()=>{MC().moveWorkPoints(m,{
|
|
3535
|
+
points:{from:{x:from[0],y:from[1],z:from[2]},to:{x:to[0],y:to[1],z:to[2]}},
|
|
3536
|
+
// The DRAG-START fingerprint when the caller froze one (every gesture does, via the gizmo state); only
|
|
3537
|
+
// the typed path falls back to a fresh read, and there the endpoints are derived from that same fresh
|
|
3538
|
+
// read, so the two agree by construction. Recomputing it here for a drag would compare the live member
|
|
3539
|
+
// against itself and render the staleness guard inert.
|
|
3540
|
+
expect:(spec&&spec.expect)||V2Commands.memberFingerprint(input.canonical),
|
|
3541
|
+
...(pin===undefined?{}:{position:pin})});})===true;
|
|
3542
|
+
if(ok&&pin!==undefined)toast('Depth face pinned to “'+pin+'” so the steel stays where you put it.',false,5200);
|
|
3543
|
+
return ok;}
|
|
3400
3544
|
/*
|
|
3401
3545
|
* ONE row of the Profile Position section: heading + offset box on the first line, named faces on the
|
|
3402
3546
|
* second. The mockup drew all three on one line; at 280 px — ~246 px of content once the rail's padding and
|
|
@@ -3963,6 +4107,67 @@ function confirmDanger({title,body,confirmLabel}){
|
|
|
3963
4107
|
// exact tag, so a deliberate overwrite still cannot create a store out of nothing. Only the explicit
|
|
3964
4108
|
// "Overwrite and save" confirm passes it. (This said "skips the precondition" until P1c made a write
|
|
3965
4109
|
// without one a 428; it was already inaccurate, and would now describe an impossible request.)
|
|
4110
|
+
// The write-boundary connection revalidation report (server/contract-gateway.ts) → ONE plain-English toast.
|
|
4111
|
+
// The server decides the fate of every shear-plate/brace-gusset joint a member move could have affected and
|
|
4112
|
+
// has already stored the result; this only TELLS the user, in their words, what changed. Kept-only is silent.
|
|
4113
|
+
// Marks where the model has them (byId(id).mark), else the id. Capped at three clauses so a big move is a
|
|
4114
|
+
// sentence, not a wall. No barrier, no re-install: the local model keeps its own undo history.
|
|
4115
|
+
// The server revalidated connections at the write boundary and reported what it did. Apply that report to
|
|
4116
|
+
// the LIVE joints and tell the user. Applying is not cosmetic: the durable contract already holds the
|
|
4117
|
+
// removal/repoint, but the browser's `C.joints` still carries the stale joint — and because the endpoints
|
|
4118
|
+
// no longer change on the NEXT save, revalidation would be a no-op there and the server would faithfully
|
|
4119
|
+
// persist the stale joint the client re-sent, silently resurrecting it. So we must reconcile `C.joints`.
|
|
4120
|
+
// It is SURGICAL — only the joints the report names are touched — so it needs no full-contract install and
|
|
4121
|
+
// therefore never clears the undo stack (unlike installMemberEndContract): on the ordinary move (the common
|
|
4122
|
+
// case) one Ctrl+Z restores the pre-move snapshot (endpoints AND the original joint), and revalidation
|
|
4123
|
+
// re-derives idempotently from there. The one exception is a move that ALSO invalidates a retained work-point
|
|
4124
|
+
// decision: that write returns the transformed contract, so the caller runs installMemberEndContract FIRST
|
|
4125
|
+
// (which does clear undo, for its own server-owned-decision reason) and this reconcile is then a redundant
|
|
4126
|
+
// no-op — the joints are still correct, only the undo affordance is lost, in that rare combined case.
|
|
4127
|
+
// Guarded by the caller on `seq===saveSeq`: a report is only applied while `C` still equals what was sent.
|
|
4128
|
+
function applyRevalidation(rv){
|
|
4129
|
+
if(!rv)return;
|
|
4130
|
+
const mk=id=>{const m=byId(id);return (m&&(m.mark||m.id))||id;};
|
|
4131
|
+
const KIND={'shear-plate':'Shear plate','brace-gusset':'Brace gusset'};
|
|
4132
|
+
const kindLabel=k=>KIND[k]||'Connection';
|
|
4133
|
+
const rm=rv.removed||[],rp=rv.repointed||[],fl=rv.flagged||[],df=rv.deferred||[];
|
|
4134
|
+
const clauses=[];
|
|
4135
|
+
if(rm.length)clauses.push(rm.length===1?(kindLabel(rm[0].kind)+' removed — no supporting member'):(rm.length+' connections removed — no supporting member'));
|
|
4136
|
+
if(rp.length){
|
|
4137
|
+
if(rp.length===1){const j=(C.joints||[]).find(x=>x.id===rp[0].id);clauses.push(kindLabel(j&&j.kind)+' re-seated onto '+mk(rp[0].to));}
|
|
4138
|
+
else clauses.push(rp.length+' connections re-seated onto new supports');
|
|
4139
|
+
}
|
|
4140
|
+
if(fl.length)clauses.push(fl.length===1?'Custom connection may need review':(fl.length+' custom connections may need review'));
|
|
4141
|
+
if(df.length)clauses.push(df.length+' connection'+(df.length===1?'':'s')+' left unchanged — geometry unresolved');
|
|
4142
|
+
// Reconcile the live joints with the server's authoritative result (removed dropped, repointed re-bound).
|
|
4143
|
+
// The report is server-authored but consumed defensively (a malformed entry must not write `undefined`
|
|
4144
|
+
// into a live binding): only well-shaped ids/targets are applied, the rest are logged and skipped.
|
|
4145
|
+
const removedIds=new Set(rm.filter(r=>r&&typeof r.id==='string').map(r=>r.id));
|
|
4146
|
+
const repoints=rp.filter(r=>r&&typeof r.id==='string'&&typeof r.to==='string');
|
|
4147
|
+
if(removedIds.size||repoints.length){
|
|
4148
|
+
C.joints=(C.joints||[]).filter(j=>!removedIds.has(j.id));
|
|
4149
|
+
for(const r of repoints){const j=(C.joints||[]).find(x=>x.id===r.id);if(j)j.secondaries=[r.to];}
|
|
4150
|
+
persist();render();sync3D(); // persist() rewrites the localStorage draft; the durable copy already holds this
|
|
4151
|
+
}
|
|
4152
|
+
if(rm.length!==removedIds.size||rp.length!==repoints.length)console.warn('steel-editor: a malformed revalidation report entry was skipped',rv);
|
|
4153
|
+
if(clauses.length)toast(clauses.slice(0,3).join(' · '));
|
|
4154
|
+
}
|
|
4155
|
+
// THE CLIENT NEVER DECIDES A JOINT'S FATE — THE SERVER DOES, AND IT NEEDS NOTHING FROM US TO DO IT.
|
|
4156
|
+
//
|
|
4157
|
+
// Normally the server's revalidation report rides the write response and `applyRevalidation` mirrors it into
|
|
4158
|
+
// `C.joints`. Some responses this tab cannot safely apply: a STALE one (a newer edit landed while the PUT was
|
|
4159
|
+
// in flight, so the report's delta no longer describes the live `C`), an UNREADABLE body, or one LOST after
|
|
4160
|
+
// the write committed. On those legs we simply do nothing — no merge, no bookkeeping, no guessing.
|
|
4161
|
+
//
|
|
4162
|
+
// That is safe because of where the guarantee actually lives: the server re-decides every joint a write
|
|
4163
|
+
// INTRODUCES (present in the incoming contract, absent from the stored one), and a joint this tab kept after
|
|
4164
|
+
// missing its removal is exactly that shape. So the next ordinary save re-decides it and removes it again,
|
|
4165
|
+
// authoritatively, with the user told in the usual toast. Undo behaves correctly for free — it restores the
|
|
4166
|
+
// endpoint too, so the support is valid again and the joint is simply `kept`.
|
|
4167
|
+
//
|
|
4168
|
+
// This replaced a client-side merge (fingerprints, ownership rules, etag-generation heuristics) that four
|
|
4169
|
+
// adversarial review rounds kept finding concurrency bugs in: reconciling a server-authoritative transform
|
|
4170
|
+
// against a concurrently-edited local copy is a CRDT-class problem, and the way to win it was not to play.
|
|
3966
4171
|
async function persistServer(force){const seq=saveSeq;
|
|
3967
4172
|
// Once conflicted, stop firing doomed PUTs; re-surface the explanation instead of hammering the
|
|
3968
4173
|
// network every debounce tick. Cleared only by a reload or a confirmed overwrite.
|
|
@@ -4003,11 +4208,24 @@ async function persistServer(force){const seq=saveSeq;
|
|
|
4003
4208
|
// write is usually still in flight — the server broadcasts before it replies — so releasing here would
|
|
4004
4209
|
// make the tab read its OWN echo as external and reload itself mid-edit. The id is released when the
|
|
4005
4210
|
// echo consumes it, when the write fails, or when the SSE channel closes (nothing can echo after that).
|
|
4006
|
-
if(res.ok){
|
|
4211
|
+
if(res.ok){let d={},bodyReadable=true;try{d=await res.json();}catch(_){bodyReadable=false;}const t=d.etag||res.headers.get('ETag');if(d.contract&&t&&Number.isSafeInteger(d.storeRevision))installMemberEndContract(d.contract,t,d.storeRevision);else{if(t){const pv=serverEtag;serverEtag=t;restampDraftBase(pv,t);}if(Number.isSafeInteger(d.storeRevision))serverRevision=Math.max(serverRevision,d.storeRevision);}conflicted=false;
|
|
4212
|
+
// The write COMMITTED. Apply its revalidation report ONLY when we can prove it describes the live `C`:
|
|
4213
|
+
// the body was readable AND `seq===saveSeq` (no newer edit landed while this PUT was in flight). Otherwise
|
|
4214
|
+
// do NOTHING — no merge, no bookkeeping. That is safe because a joint whose removal we then miss is
|
|
4215
|
+
// re-INTRODUCED by the next save, and the server re-decides every introduced joint.
|
|
4216
|
+
const usable=!!t||Number.isSafeInteger(d.storeRevision);
|
|
4217
|
+
// Apply ONLY a report we can prove is current; otherwise do nothing — the server re-decides an
|
|
4218
|
+
// introduced joint on the next save, so a missed removal cannot survive (see the note above).
|
|
4219
|
+
if(bodyReadable&&usable&&seq===saveSeq)applyRevalidation(d.revalidation);
|
|
4220
|
+
} // chain the next edit off the new tag, and install any server-staled endpoint authority instead of leaving the browser on bytes the server deliberately transformed; then tell the user what the write-boundary revalidation did to their connections
|
|
4007
4221
|
else releaseMutation(mid); // 400/500: nothing was written, so nothing will echo
|
|
4008
4222
|
if(seq===saveSeq)setSaved(res.ok?'ok':'err'); // only the latest save owns the pill (a stale late response must not clobber a newer verdict)
|
|
4009
4223
|
if(!res.ok)console.error('server save rejected ('+res.status+')',await res.text().catch(()=>'')); // 400 = schema reject: edits won't be what Approve bakes
|
|
4010
|
-
}catch(e){releaseMutation(mid);if(seq===saveSeq)setSaved('err');console.error('server save failed',e);
|
|
4224
|
+
}catch(e){releaseMutation(mid);if(seq===saveSeq)setSaved('err');console.error('server save failed',e);
|
|
4225
|
+
// The write may have committed even though we never saw the response — nothing to do here. `C.joints` can
|
|
4226
|
+
// then still carry a joint the store removed, and the NEXT save re-introduces it, which is exactly the
|
|
4227
|
+
// shape the server always re-decides. So the removal simply happens again, authoritatively.
|
|
4228
|
+
}
|
|
4011
4229
|
});}
|
|
4012
4230
|
function scheduleSave(){if(memberEndStatus.known||memberEndReview)invalidateMemberEndReview();setSaved('dirty');++saveSeq;clearTimeout(saveT);saveT=setTimeout(()=>{saveT=null;persist();persistServer();},500);} // clear the handle as it fires: `saveT !== null` is read as "a write is still pending" (the project send refuses on it), and a spent timer id would read as pending forever // ++saveSeq: a fresh edit is a new save intent — it invalidates any still-in-flight PUT so that PUT's late response can't flip the pill to a stale 'Saved ✓' while this edit is still unsaved (persistServer below captures this same intent id)
|
|
4013
4231
|
// The boot-scope SSE handler's seam into that debounce — see `flushLocalDraft` for why the handler
|
|
@@ -4042,12 +4260,12 @@ window.flushContract = async () => {
|
|
|
4042
4260
|
const headers = { 'content-type': 'application/json', 'x-floless-mutation-id': mid };
|
|
4043
4261
|
// Same total rule as persistServer — see the comment there for why "no tag" means If-None-Match: *.
|
|
4044
4262
|
if (serverEtag) headers['if-match'] = serverEtag; else headers['if-none-match'] = '*';
|
|
4045
|
-
res = await fetch('/api/contract/' + encodeURIComponent(APP_ID) + PROJECT_QS, {
|
|
4046
|
-
method: 'PUT', headers, body: JSON.stringify(C),
|
|
4047
|
-
});
|
|
4263
|
+
res = await fetch('/api/contract/' + encodeURIComponent(APP_ID) + PROJECT_QS, { method: 'PUT', headers, body: JSON.stringify(C) });
|
|
4048
4264
|
} catch (e) {
|
|
4049
4265
|
releaseMutation(mid); // nothing was written, so no broadcast will ever carry this id
|
|
4050
4266
|
if (seq === saveSeq) setSaved('err'); // B9: a network rejection must show "Save failed", not leave the pill stuck on "Saving…" (this fn cancels the debounced persistServer that would otherwise flag it)
|
|
4267
|
+
// Parity with persistServer: a lost response needs no bookkeeping here — a joint whose removal we missed
|
|
4268
|
+
// is re-introduced by the next save, and the server always re-decides an introduced joint.
|
|
4051
4269
|
throw e; // still reject so the parent (Approve) aborts — regardless of seq
|
|
4052
4270
|
}
|
|
4053
4271
|
if (res.status === 428) { // same cause as persistServer's 428 branch — a writer sent no precondition
|
|
@@ -4066,7 +4284,12 @@ window.flushContract = async () => {
|
|
|
4066
4284
|
showConflictBanner();
|
|
4067
4285
|
throw new Error('save conflict');
|
|
4068
4286
|
}
|
|
4069
|
-
if (res.ok) {
|
|
4287
|
+
if (res.ok) { let d = {}, bodyReadable = true; try { d = await res.json(); } catch (_) { bodyReadable = false; } const t = d.etag || res.headers.get('ETag'); if (d.contract && t && Number.isSafeInteger(d.storeRevision)) installMemberEndContract(d.contract, t, d.storeRevision); else { if (t) { const pv = serverEtag; serverEtag = t; restampDraftBase(pv, t); } if (Number.isSafeInteger(d.storeRevision)) serverRevision = Math.max(serverRevision, d.storeRevision); } conflicted = false;
|
|
4288
|
+
// The flush committed. Same rule as persistServer: apply the report only when the body was readable and
|
|
4289
|
+
// `seq===saveSeq` (Approve awaits this flush, so the user CAN edit meanwhile and make it stale). Otherwise
|
|
4290
|
+
// do nothing — the next save re-introduces any joint whose removal we missed, and the server re-decides it.
|
|
4291
|
+
const usable = !!t || Number.isSafeInteger(d.storeRevision);
|
|
4292
|
+
if (bodyReadable && usable && seq === saveSeq) applyRevalidation(d.revalidation); }
|
|
4070
4293
|
else releaseMutation(mid);
|
|
4071
4294
|
if (seq === saveSeq) setSaved(res.ok ? 'ok' : 'err'); // only the latest save owns the pill
|
|
4072
4295
|
if (!res.ok) throw new Error('save failed (' + res.status + ')');
|
|
@@ -4592,13 +4815,52 @@ function planRegistration(){
|
|
|
4592
4815
|
}
|
|
4593
4816
|
_planXfCache={key,xf};return xf;
|
|
4594
4817
|
}
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
return
|
|
4818
|
+
// The member's stored roll RE-EXPRESSED into `target` (a positionAuthoringBasis snapshot; null/global →
|
|
4819
|
+
// world). ONE copy of the roll math — the 2D plan footprint targets global (positionEffectiveWorldRot),
|
|
4820
|
+
// the Profile Position panel + 3D gizmo target the current authoring frame (positionAuthoringRoll). The
|
|
4821
|
+
// roll needs NO section extents (unlike the offset re-expression), so it is always computable for a
|
|
4822
|
+
// non-degenerate member. Returns null only for a degenerate/unresolvable frame; a caller picks its fallback.
|
|
4823
|
+
function positionEffectiveRotInto(m,target){
|
|
4824
|
+
if(!m)return null;
|
|
4825
|
+
// Match the commit path (SteelCore.reexpressMemberPlacement) EXACTLY so the displayed roll can never
|
|
4826
|
+
// diverge from what a commit re-expresses: the stored basis is read as-is (stored bases are already
|
|
4827
|
+
// canonical), and the TARGET is CANONICALISED the same way (Gram-Schmidt) — a skew authoring basis then
|
|
4828
|
+
// still agrees instead of silently falling back to the stored roll. Wrapped so a single degenerate member
|
|
4829
|
+
// degrades to null (→ stored roll) rather than throwing partFrame and taking down the whole panel render.
|
|
4830
|
+
try{
|
|
4831
|
+
const oldBasis=m.positionBasis?SteelCore.basisFromAxes(m.positionBasis.x,m.positionBasis.y):{x:[1,0,0],y:[0,1,0],z:[0,0,1]};
|
|
4832
|
+
const ct=(!target||target.kind==='global')?{x:[1,0,0],y:[0,1,0]}:SteelCore.canonicalPositionBasis(target.x,target.y);
|
|
4833
|
+
const tgt=ct&&SteelCore.basisFromAxes(ct.x,ct.y);
|
|
4834
|
+
const g=SteelCore.memberGeometryV2(v2CanonicalMember(m.id));
|
|
4835
|
+
if(!oldBasis||!tgt||!g)return null;
|
|
4836
|
+
const a0=SteelCore.partFrame(g.line[0],g.line[1],oldBasis.z,oldBasis.x),a1=SteelCore.partFrame(g.line[0],g.line[1],tgt.z,tgt.x);
|
|
4837
|
+
if(!a0||!a1)return null;
|
|
4838
|
+
const th=(+m.rot||0)*Math.PI/180,c=Math.cos(th),s=Math.sin(th),w=[c*a0.y[0]+s*a0.z[0],c*a0.y[1]+s*a0.z[1],c*a0.y[2]+s*a0.z[2]];
|
|
4839
|
+
return Math.atan2(w[0]*a1.z[0]+w[1]*a1.z[1]+w[2]*a1.z[2],w[0]*a1.y[0]+w[1]*a1.y[1]+w[2]*a1.y[2])*180/Math.PI;
|
|
4840
|
+
}catch(err){console.warn('[positionEffectiveRotInto]',m&&m.id,'roll re-expression failed',err);return null;}
|
|
4841
|
+
}
|
|
4842
|
+
function positionEffectiveWorldRot(m){if(!m||!m.positionBasis)return +m.rot||0;return positionEffectiveRotInto(m,null);}
|
|
4843
|
+
// The roll AS IT READS in the current authoring frame (deg, signed like the stored value) — the one source
|
|
4844
|
+
// the panel and the 3D gizmo both show, so a member authored in another frame reads the angle you would type
|
|
4845
|
+
// to leave it where it is, matching what commitPositionEdit round-trips. Falls back to the stored roll when
|
|
4846
|
+
// the authoring basis is invalid, the work points are incomplete, the bases already match, or the frame is
|
|
4847
|
+
// degenerate — every case where there is no distinct current-frame roll to show.
|
|
4848
|
+
function positionAuthoringRoll(m){
|
|
4849
|
+
if(!m)return 0;const stored=+m.rot||0;
|
|
4850
|
+
const captured=positionAuthoringBasis();if(!captured.ok)return stored;
|
|
4851
|
+
// Cheap membership check — deliberately NOT positionRebaseInput, which builds the section outline/extents
|
|
4852
|
+
// this never uses (it would run N outline builds per multi-select render). Only the canonical member (for
|
|
4853
|
+
// positionBasisMatches) and resolvable work points are needed; positionEffectiveRotInto re-derives the rest.
|
|
4854
|
+
const c=v2CanonicalMember(m.id);
|
|
4855
|
+
if(!c||SteelCore.knownZ(c.from&&c.from.z)==null||SteelCore.knownZ(c.to&&c.to.z)==null)return stored;
|
|
4856
|
+
if(positionBasisMatches(c,captured))return stored;
|
|
4857
|
+
const r=positionEffectiveRotInto(m,captured);
|
|
4858
|
+
// A distinct current-frame roll exists but is degenerate/unresolvable — show the stored roll rather than a
|
|
4859
|
+
// thrown panel, and SAY SO (a silent wrong angle is the one thing a placement display may never be). The
|
|
4860
|
+
// 3D gizmo never reaches here: its reexpress preflight shares partFrame's degeneracy, so it is unavailable
|
|
4861
|
+
// in exactly these cases (no preview jump). This is a display-only fallback on an already-degenerate member.
|
|
4862
|
+
if(r==null){console.warn('[positionAuthoringRoll]',m.id,'no current-frame roll (degenerate/unresolvable) — showing the stored roll');return stored;}
|
|
4863
|
+
return r;
|
|
4602
4864
|
}
|
|
4603
4865
|
function columnSectionPoly(m){
|
|
4604
4866
|
const wp=m&&m.wp;if(!wp||!wp.length)return null;
|
|
@@ -6600,7 +6862,7 @@ function panel(){
|
|
|
6600
6862
|
// reads is what stops the two from ever disagreeing. (code review)
|
|
6601
6863
|
const rollDeg=r=>{const th=((typeof r==='number'&&isFinite(r))?r:0)*Math.PI/180;
|
|
6602
6864
|
const d=Math.atan2(Math.sin(th),Math.cos(th))*180/Math.PI;return +(((d%360)+360)%360).toFixed(6);};
|
|
6603
|
-
const rotAgg=agg(arr,m=>rollDeg(
|
|
6865
|
+
const rotAgg=agg(arr,m=>rollDeg(positionAuthoringRoll(m))); // 3b.2: shared roll RE-EXPRESSED into the current frame (rollDeg reads the geometry quantity + normalises), or VARIES
|
|
6604
6866
|
const qdElig=(sel2d()||[]).filter(isDimAnchorableMember),qdN=qdElig.length+selGridIds.size,qdHasBeam=qdElig.some(m=>(m.role||'beam')!=='column'); // F7: active-plan beams + columns + co-selected grid lines; the Start/Mid/End toggle only matters when a beam is in the set
|
|
6605
6867
|
p.innerHTML=`<h3>${arr.length} members selected</h3>
|
|
6606
6868
|
${typeFilterHTML()}
|
|
@@ -6670,7 +6932,7 @@ function panel(){
|
|
|
6670
6932
|
// Rotation — apply one angle to every selected member's section (blank input = no-op). Normalised (-360,360).
|
|
6671
6933
|
{const setRot=v=>{const raw=String(v).trim();let r=Number(raw.replace(',','.'));
|
|
6672
6934
|
if(!isFinite(r)){toast('Couldn’t read “'+raw+'” as an angle — enter degrees, e.g. 45 or -90.');render();return;}
|
|
6673
|
-
r=r
|
|
6935
|
+
r=SteelCore.rollCommitNorm(r);commitPositionEdit(selArr(),{rot:r},document.activeElement);}; // shared fold (== r%360, signed) — one convention for panel + gizmo
|
|
6674
6936
|
const _ri=document.getElementById('detRotZ');if(_ri)_ri.onchange=e=>{if(e.target.value.trim()==='')return;setRot(e.target.value);};
|
|
6675
6937
|
const chip=(id,val)=>{const b=document.getElementById(id);if(b)b.onclick=()=>setRot(val);};
|
|
6676
6938
|
chip('rot0',0);chip('rot90',90);chip('rot180',180);chip('rot270',270);}
|
|
@@ -6815,8 +7077,9 @@ function panel(){
|
|
|
6815
7077
|
const spSect=spjs.length?`<div class=hint style="margin:8px 0 0">${spIntro}</div>${spjs.map(spBlock).join('')}`:'';
|
|
6816
7078
|
const _cps=(!col&&copesByMember[m.id])?copesByMember[m.id]:[]; // auto cope(s) on this beam (from the rendered scene)
|
|
6817
7079
|
const copeSect=_cps.length?`<div class=divrow><hr><span class=sect style="margin:0">Cope (auto)</span><hr></div><div class=hint style="margin:0 0 2px">${_cps.map(esc).join(' · ')} — auto, clash-driven so the beam clears the support.</div>`:'';
|
|
6818
|
-
const
|
|
6819
|
-
const
|
|
7080
|
+
const _effRot=positionAuthoringRoll(m); // 3b.2: roll as it reads in the CURRENT authoring frame, not the raw stored value
|
|
7081
|
+
const rotN=Number(((((_effRot)%360)+360)%360).toFixed(2));// [0,360), 2dp → a re-expressed 90.0000001 still lights the 90° chip
|
|
7082
|
+
const rotDisp=Number((((_effRot)%360)).toFixed(2)); // signed (-360,360), cleaned, shown in the input
|
|
6820
7083
|
const br=isBrace(m), brc=(m.brace||{}); // B4 brace controls (Brace type / Position / Offset / swap lower↔higher)
|
|
6821
7084
|
const braceSect=!br?'':`<div class=divrow><hr><span class=sect style="margin:0">Brace</span><hr></div>
|
|
6822
7085
|
<div class=elab>Brace type</div>
|
|
@@ -6903,6 +7166,7 @@ function panel(){
|
|
|
6903
7166
|
${bpSect}${spSect}${copeSect}
|
|
6904
7167
|
<div class=divrow><hr><span class=sect style="margin:0" data-tip="${POSTIP.head}">Profile Position <span style="opacity:.45;font-weight:400">ⓘ</span></span><hr></div>
|
|
6905
7168
|
${positionFrameHTML()}
|
|
7169
|
+
<div class=row id=posFromMemberRow style="margin:0 0 6px"><button data-command-id="steel.position-from-member" id=posFromMemberB class=ghostw data-tip="Set the coordinate system to this member's own axes — its Rotation then reads 0">⌖ From member</button></div>
|
|
6906
7170
|
${posRow('Depth','posOff','Offset',m.positionOffset,POSTIP.offD,
|
|
6907
7171
|
`<button data-command-id="steel.position-face#with its top face on the line" id=posTop class="${pos==='top'?'on':''}" aria-pressed="${pos==='top'?'true':'false'}" data-tip="${POSTIP.top}">Top</button><button data-command-id="steel.position-face#centred in depth" id=posMid class="${pos==='middle'?'on':''}" aria-pressed="${pos==='middle'?'true':'false'}" data-tip="${POSTIP.mid}">Middle</button><button data-command-id="steel.position-face#with its underside on the line" id=posBot class="${pos==='bottom'?'on':''}" aria-pressed="${pos==='bottom'?'true':'false'}" data-tip="${POSTIP.bot}">Bottom</button>`)
|
|
6908
7172
|
+posRow('Width','posHOff','Offset',m.positionHOffset,POSTIP.offW,
|
|
@@ -6966,10 +7230,37 @@ function panel(){
|
|
|
6966
7230
|
// the one thing a placement field may never do.
|
|
6967
7231
|
{const setRot=v=>{const raw=String(v).trim();let r=Number(raw.replace(',','.'));
|
|
6968
7232
|
if(!isFinite(r)){toast('Couldn’t read “'+raw+'” as an angle — enter degrees, e.g. 45 or -90.');render();return;}
|
|
6969
|
-
r=r
|
|
7233
|
+
r=SteelCore.rollCommitNorm(r);commitPositionEdit([m],{rot:r},document.activeElement);}; // shared fold (== r%360, signed) — one convention for panel + gizmo
|
|
6970
7234
|
const _ri=document.getElementById('detRotZ');if(_ri)_ri.onchange=e=>setRot(e.target.value);
|
|
6971
7235
|
const chip=(id,val)=>{const b=document.getElementById(id);if(b)b.onclick=()=>setRot(val);};
|
|
6972
7236
|
chip('rot0',0);chip('rot90',90);chip('rot180',180);chip('rot270',270);}
|
|
7237
|
+
// From member (§3.2): adopt this member's OWN axes — INCLUDING its roll — as the 3D coordinate system, so it
|
|
7238
|
+
// then reads Rotation 0. The steel does not move (only the frame the numbers are read against changes), and
|
|
7239
|
+
// it is idempotent. The adopted basis is built from the member's ROLLED transverse axes (rolledWidth =
|
|
7240
|
+
// a0.y·cosθ + a0.z·sinθ, and its cross with the member axis is the rolled depth = the CS normal); partFrame
|
|
7241
|
+
// then re-derives the member's frame as exactly this rolled frame, so positionAuthoringRoll reads 0.
|
|
7242
|
+
{const _fm=document.getElementById('posFromMemberB');
|
|
7243
|
+
if(_fm)_fm.onclick=()=>{
|
|
7244
|
+
if(!(view3d&&window.Steel3DView&&window.Steel3DView.setFrameBasis)){toast('Switch to the 3D view to adopt a member’s axes.');return;}
|
|
7245
|
+
const input=positionRebaseInput(m);
|
|
7246
|
+
if(!input){toast('This member’s work points aren’t resolved yet — can’t read its axes.');return;}
|
|
7247
|
+
let frame;
|
|
7248
|
+
try{
|
|
7249
|
+
const sb=m.positionBasis?SteelCore.basisFromAxes(m.positionBasis.x,m.positionBasis.y):{x:[1,0,0],y:[0,1,0],z:[0,0,1]};
|
|
7250
|
+
const a0=sb&&SteelCore.partFrame(input.from,input.to,sb.z,sb.x);
|
|
7251
|
+
if(!a0){toast('This member has no usable section frame to adopt.');return;}
|
|
7252
|
+
const th=(+m.rot||0)*Math.PI/180,c=Math.cos(th),s=Math.sin(th);
|
|
7253
|
+
const rolledWidth=[a0.y[0]*c+a0.z[0]*s,a0.y[1]*c+a0.z[1]*s,a0.y[2]*c+a0.z[2]*s];
|
|
7254
|
+
const b=SteelCore.basisFromAxes(a0.x,rolledWidth); // b.z = the rolled depth = the coordinate system normal
|
|
7255
|
+
if(!b){toast('This member’s axes don’t form a usable frame.');return;}
|
|
7256
|
+
frame={origin:[...input.from],xAxis:[...b.x],yAxis:[...b.y],normal:[...b.z]};
|
|
7257
|
+
}catch(err){console.error('[steel.position-from-member] failed to derive '+(m&&m.id)+' axes',err);toast('Couldn’t read this member’s axes.');return;}
|
|
7258
|
+
// The write + confirmation live OUTSIDE the try: a throw inside setFrameBasis's render chain is a
|
|
7259
|
+
// different failure (it would half-apply the frame) and must not be reported as "couldn't read axes".
|
|
7260
|
+
// The toast is NON-sticky (false) so the confirmation fades — `true` would pin it on screen forever.
|
|
7261
|
+
window.Steel3DView.setFrameBasis(frame);
|
|
7262
|
+
toast('Coordinate system set to '+m.id+'’s axes — its Rotation now reads 0.',false,3200);
|
|
7263
|
+
};}
|
|
6973
7264
|
const wireTos=(id,o)=>{const ck=document.getElementById(id+'_ck');if(ck)ck.onchange=e=>edit(()=>{ModelCmd.setTosDefault(o,e.target.checked,defaultTOS);});
|
|
6974
7265
|
const inp=document.getElementById(id);if(inp)inp.onchange=e=>edit(()=>{ModelCmd.setTosValue(o,parseLen(e.target.value));});};
|
|
6975
7266
|
const wireDet=(id,o)=>{const i=document.getElementById(id);if(i)i.onchange=e=>edit(()=>{ModelCmd.patchEnd(o,{detail:e.target.value.trim()});});
|
|
@@ -8104,8 +8395,30 @@ function cmCommit(v){cmApplyOffsets(cmOffsetsFor(v));}
|
|
|
8104
8395
|
// --- numeric HUD (spec §3.3): type after the base pick → exact distance or dx,dy[,dz] (dz inches).
|
|
8105
8396
|
// Live parse echo while typing; unparseable Enter flags the chip red (inline, not just a toast). ---
|
|
8106
8397
|
let cmHudEl=null,cmHudAbs=false,cmHudLock=false,cmHudConsumer='movecopy',cmHudPrimed=false; // UCS stage 3 typed-entry HUD state (per open)
|
|
8398
|
+
let posHudTarget=null; // 3b.3: {id,axis,cur} when the shared #cmHud is opened as the Profile Position typed-entry consumer (double-click a handle)
|
|
8399
|
+
// Double-click a position gizmo handle → dock the shared #cmHud at it to type an exact value (bypasses snap).
|
|
8400
|
+
// Opens EMPTY (the current value is the placeholder, spec §3.1); the view freezes the camera so orbit can't
|
|
8401
|
+
// drift the anchor the HUD is pinned to. Only opens where the panel would commit (memberPositionGizmoState.available).
|
|
8402
|
+
function openPositionHud(id,axis,scr){
|
|
8403
|
+
const st=memberPositionGizmoState(id);
|
|
8404
|
+
if(!st||!st.available){ // a double-click on a VISIBLE handle that opens nothing is confusing — the view picked it from a cached snapshot, but a fresh read can disagree (a mid-flight external write, a roll that became unresolvable). Surface it instead of a silent return (mirrors currentPositionGizmoState's console.debug + the drag bail).
|
|
8405
|
+
console.debug('steel: position HUD not opened —',st&&st.reason);
|
|
8406
|
+
toast('Can’t edit this handle right now'+(st&&st.reason?' — '+st.reason:'')+'. Try the Inspect panel.');return;}
|
|
8407
|
+
// The reference-line handles (3b.1) type a DELTA — how far to slide, how far to swing — so their "current
|
|
8408
|
+
// value" hint is 0, unlike the three profile handles whose current absolute value is the hint. A handle the
|
|
8409
|
+
// member cannot take never opens a HUD either, or the user would type a value into something that can only
|
|
8410
|
+
// refuse it.
|
|
8411
|
+
const refline=axis==='slide'||axis==='swingPlan'||axis==='swingElev';
|
|
8412
|
+
if(refline&&!(st.handles&&st.handles[axis]&&st.handles[axis].available)){
|
|
8413
|
+
toast((st.handles&&st.handles[axis]&&st.handles[axis].reason)||'That handle isn’t available on this member.');return;}
|
|
8414
|
+
const cur=refline?0:axis==='depth'?st.positionOffset:axis==='width'?st.positionHOffset:st.rot;
|
|
8415
|
+
posHudTarget={id,axis,cur};
|
|
8416
|
+
if(view3d&&window.Steel3DView&&window.Steel3DView.setPositionTyping)window.Steel3DView.setPositionTyping(true);
|
|
8417
|
+
cmHudShow('',{consumer:'position',scr});
|
|
8418
|
+
}
|
|
8107
8419
|
function cmHudIsOpen(){return !!(cmHudEl&&cmHudEl.style.display!=='none');}
|
|
8108
8420
|
function cmHudClose(){if(cmHudEl){cmHudEl.style.display='none';cmHudEl.classList.remove('err');const i=cmHudEl.querySelector('input');if(i)i.value='';}
|
|
8421
|
+
if(posHudTarget){posHudTarget=null;if(view3d&&window.Steel3DView&&window.Steel3DView.setPositionTyping)window.Steel3DView.setPositionTyping(false);} // 3b.3: unfreeze the camera + drop the position target (a close is not a commit). KEEP THESE TWO ATOMIC — the camera unfreeze is gated on posHudTarget being non-null here; nulling posHudTarget anywhere else would strand the camera frozen.
|
|
8109
8422
|
if(view3d&&window.Steel3DView&&window.Steel3DView.pointEntryEnd)window.Steel3DView.pointEntryEnd(); // drop the view's captured token (a close is not a commit)
|
|
8110
8423
|
try{stage.focus({preventScroll:true});}catch(_){}}
|
|
8111
8424
|
function cmHudSetAbs(abs){if(cmHudLock)abs=true;cmHudAbs=!!abs;cmHudSyncPill();cmHudPlaceholder();if(cmHudEl)cmHudEcho();} // REL/ABS pill toggle — re-runs the same live parse/echo
|
|
@@ -8114,6 +8427,8 @@ function cmHudSyncPill(){if(!cmHudEl)return;const pill=cmHudEl.querySelector('#c
|
|
|
8114
8427
|
pill.querySelectorAll('.cmHudSeg').forEach(s=>{const on=((s.dataset.mode==='abs')===cmHudAbs);s.setAttribute('aria-checked',on?'true':'false');s.tabIndex=on?0:-1;s.classList.toggle('on',on);}); // roving tabindex: only the selected radio is Tab-reachable
|
|
8115
8428
|
const abs=pill.querySelector('.cmHudSeg[data-mode="abs"]');if(abs)abs.setAttribute('data-tip',cmHudLock?'First point has no anchor to offset from — absolute only':'Absolute — X′,Y′,Z′ in the local frame (X,Y,Z if none)');}
|
|
8116
8429
|
function cmHudPlaceholder(){if(!cmHudEl)return;const inp=cmHudEl.querySelector('input');if(!inp)return;
|
|
8430
|
+
if(cmHudConsumer==='position'){const ang=posHudTarget&&(posHudTarget.axis==='rot'||posHudTarget.axis==='swingPlan'||posHudTarget.axis==='swingElev');
|
|
8431
|
+
inp.placeholder=posHudTarget?(ang?(String(+(+posHudTarget.cur||0).toFixed(2))+'°'):(posOffDisp(posHudTarget.cur)||'0"')):'';return;} // 3b.3: the current value is the hint (HUD opens empty). 3b.1: a reference-line handle types a DELTA, so its hint is 0.
|
|
8117
8432
|
inp.placeholder=cmHudAbs?(cmHudPrimed?"X′,Y′ · or X′,Y′,Z′":"X,Y · or X,Y,Z"):(cmHudConsumer==='add'?"dx,dy · or dx,dy,dz":"12'-6 · or dx,dy");}
|
|
8118
8433
|
function cmHudEcho(){const inp=cmHudEl.querySelector('input'),lbl=cmHudEl.querySelector('#cmHudLbl');
|
|
8119
8434
|
const pv=parseVec(inp.value),n=(cmTool==='copy'&&!cmArrayMode&&cmCount>1)?(' ×'+cmCount):'';let txt='';
|
|
@@ -8122,8 +8437,10 @@ function cmHudEcho(){const inp=cmHudEl.querySelector('input'),lbl=cmHudEl.queryS
|
|
|
8122
8437
|
txt='= '+pv.comp.map((c,i)=>pv.provided[i]?((ax[i]?ax[i]+' ':'')+fmtFtIn(c)):null).filter(Boolean).join(', ');}}
|
|
8123
8438
|
lbl.textContent=(txt?txt+n:n.trim());
|
|
8124
8439
|
cmHudEl.classList.remove('err');}
|
|
8125
|
-
function cmHudShow(seed){
|
|
8126
|
-
if(
|
|
8440
|
+
function cmHudShow(seed,opts){
|
|
8441
|
+
if(opts&&opts.consumer==='position'){ // 3b.3: Profile Position typed entry — its own commit path (commitMemberPosition), no pointEntry token, no coordinate-mode pill
|
|
8442
|
+
cmHudConsumer='position';cmHudLock=false;cmHudAbs=false;cmHudPrimed=false;
|
|
8443
|
+
}else if(view3d&&window.Steel3DView&&window.Steel3DView.pointEntryBegin){ // 3D: capture the view's frame/anchor/aim token for this operation
|
|
8127
8444
|
const consumer=cmTool?'movecopy':(mode==='add'?'add':null);if(!consumer)return;
|
|
8128
8445
|
const b=window.Steel3DView.pointEntryBegin(consumer);if(!b||!b.ok)return;
|
|
8129
8446
|
cmHudConsumer=consumer;cmHudLock=!!b.locked;cmHudAbs=!!(b.mode==='abs'||b.locked);cmHudPrimed=!!b.primed;
|
|
@@ -8144,16 +8461,62 @@ function cmHudShow(seed){
|
|
|
8144
8461
|
inp.addEventListener('input',cmHudEcho);
|
|
8145
8462
|
inp.addEventListener('keydown',ev=>{ev.stopPropagation();
|
|
8146
8463
|
if(ev.key==='Enter'){ev.preventDefault();cmHudCommit(inp.value);}
|
|
8147
|
-
else if(ev.key==='Escape'){ev.preventDefault();cmHudClose();}});
|
|
8464
|
+
else if(ev.key==='Escape'){ev.preventDefault();cmHudClose();}});
|
|
8465
|
+
inp.addEventListener('blur',()=>{if(cmHudConsumer==='position'&&cmHudIsOpen()){const had=inp.value.trim()!=='';cmHudClose();if(had)toast('Discarded — nothing was committed. Double-click the handle to type again.');}});} // 3b.3: losing focus (click away) cancels the transient docked position HUD; a toast prevents silent data loss when text was typed (ui-ux). Enter commits, Esc cancels quietly, blur cancels with the toast.
|
|
8148
8466
|
cmHudEl.classList.toggle('v3d',!!view3d);
|
|
8467
|
+
{const pill=cmHudEl.querySelector('#cmHudPill');if(pill)pill.style.display=(cmHudConsumer==='position')?'none':'';} // 3b.3: position is a single scalar — no REL/ABS pill; restored ('') for the movecopy/add consumers on every open (shared-singleton teardown)
|
|
8149
8468
|
cmHudSyncPill();cmHudPlaceholder();
|
|
8469
|
+
const scrPos=(opts&&opts.consumer==='position')?opts.scr:null;
|
|
8150
8470
|
const scr3=view3d&&window.Steel3DView&&window.Steel3DView.cmLastClient?window.Steel3DView.cmLastClient():null;
|
|
8151
|
-
const scr=scr3||(cmLastEvt?[cmLastEvt.clientX,cmLastEvt.clientY]:[innerWidth/2,innerHeight/2]);
|
|
8152
|
-
cmHudEl.style.left=Math.min(scr[0]+16,innerWidth-240)+'px';cmHudEl.style.top=Math.min(scr[1]+16,innerHeight-46)+'px';
|
|
8471
|
+
const scr=scrPos||scr3||(cmLastEvt?[cmLastEvt.clientX,cmLastEvt.clientY]:[innerWidth/2,innerHeight/2]);
|
|
8472
|
+
cmHudEl.style.left=Math.max(6,Math.min(scr[0]+16,innerWidth-240))+'px';cmHudEl.style.top=Math.max(6,Math.min(scr[1]+16,innerHeight-46))+'px'; // dock at the handle, clamped both edges (a member at the viewport edge stays typeable)
|
|
8153
8473
|
cmHudEl.style.display='flex';cmHudEl.classList.remove('err');
|
|
8154
8474
|
const inp=cmHudEl.querySelector('input');inp.value=seed||'';cmHudEcho();inp.focus();
|
|
8155
8475
|
try{inp.setSelectionRange(inp.value.length,inp.value.length);}catch(_){}}
|
|
8156
|
-
function cmHudCommit(str){
|
|
8476
|
+
function cmHudCommit(str){
|
|
8477
|
+
if(cmHudConsumer==='position'){ // 3b.3: single scalar → commitMemberPosition (same path as a drag: absolute value, one undo entry). Typed values BYPASS the ¼"/5° snap.
|
|
8478
|
+
const t=String(str==null?'':str).trim();
|
|
8479
|
+
if(t===''||!posHudTarget){cmHudClose();return;} // empty = no-op close
|
|
8480
|
+
if(posHudTarget.axis==='slide'||posHudTarget.axis==='swingPlan'||posHudTarget.axis==='swingElev'){ // 3b.1: a reference-line handle — the typed value is a DELTA, committed as absolute work points
|
|
8481
|
+
const st=memberPositionGizmoState(posHudTarget.id);
|
|
8482
|
+
if(!st||!st.available){cmHudEl.classList.add('err');toast('Can’t move this member right now'+(st&&st.reason?' — '+st.reason:'')+'.');return;}
|
|
8483
|
+
let spec=null;
|
|
8484
|
+
if(posHudTarget.axis==='slide'){
|
|
8485
|
+
const inch=parseLen(t);if(inch==null||!isFinite(inch)){cmHudEl.classList.add('err');toast('Couldn’t read “'+t+'” as a length — try 3 1/2" or 1\'-3 1/2".');return;}
|
|
8486
|
+
if(Math.abs(inch)<1e-9){cmHudClose();return;} // typing 0 is "never mind", not an error — close quietly rather than toasting the command's inert-move refusal
|
|
8487
|
+
const r=SteelCore.slideEndpoints(st.anchor,st.end,st.xAxis,inch*25.4);
|
|
8488
|
+
if(!r){cmHudEl.classList.add('err');toast('That slide can’t be applied to this member.');return;}
|
|
8489
|
+
spec={from:r.from,to:r.to,gesture:'slide'};
|
|
8490
|
+
}else{
|
|
8491
|
+
const deg=Number(t.replace(',','.'));if(!isFinite(deg)){cmHudEl.classList.add('err');toast('Enter an angle in degrees, e.g. 45 or -90.');return;}
|
|
8492
|
+
let theta=deg*Math.PI/180;
|
|
8493
|
+
const swingAxis=posHudTarget.axis==='swingPlan'?st.up:st.yAxis;
|
|
8494
|
+
if(posHudTarget.axis==='swingElev'){
|
|
8495
|
+
// A typed value bypasses the SNAP — that is the shipped 3b.3 contract — but it does not bypass
|
|
8496
|
+
// geometry. 'typed' mode REFUSES rather than silently rewriting the number the user asked for; the
|
|
8497
|
+
// HUD stays open in its error state so they can see nothing was committed and pick another angle.
|
|
8498
|
+
const bars=SteelCore.swingBarriers(st.anchor,st.end,st.yAxis,st.up,SteelCore.POSITION_SWING_MARGIN_RAD); // ONE constant shared with the drag path — if they drift, typing a number the drag allowed gets refused
|
|
8499
|
+
const c=bars&&SteelCore.clampSwingTheta(theta,bars,'typed',0);
|
|
8500
|
+
if(!c){cmHudEl.classList.add('err');toast('That angle would tilt the member through plumb — nothing was committed. Try a smaller angle.');return;}
|
|
8501
|
+
theta=c.theta;
|
|
8502
|
+
}
|
|
8503
|
+
const to=SteelCore.swingEndpoint(st.anchor,st.end,swingAxis,theta);
|
|
8504
|
+
if(!to){cmHudEl.classList.add('err');toast('That swing can’t be applied to this member.');return;}
|
|
8505
|
+
spec={to,gesture:posHudTarget.axis};
|
|
8506
|
+
}
|
|
8507
|
+
const okRef=commitMemberEndpoints(posHudTarget.id,spec,cmHudEl);
|
|
8508
|
+
if(!okRef){cmHudEl.classList.add('err');return;}
|
|
8509
|
+
cmHudClose();return;
|
|
8510
|
+
}
|
|
8511
|
+
let val;
|
|
8512
|
+
if(posHudTarget.axis==='rot'){val=Number(t.replace(',','.'));if(!isFinite(val)){cmHudEl.classList.add('err');toast('Enter an angle in degrees, e.g. 45 or -90.');return;}val=SteelCore.rollCommitNorm(val);}
|
|
8513
|
+
else{const inch=parseLen(t);if(inch==null||!isFinite(inch)){cmHudEl.classList.add('err');toast('Couldn’t read “'+t+'” as a length — try 3 1/2" or 1\'-3 1/2".');return;}val=inch*25.4;}
|
|
8514
|
+
const key=posHudTarget.axis==='depth'?'positionOffset':posHudTarget.axis==='width'?'positionHOffset':'rot';
|
|
8515
|
+
const ok=commitMemberPosition(posHudTarget.id,{[key]:val},cmHudEl); // refused (frame drift) toasts its own reason; keep the HUD open + .err so the user can retry. Passing cmHudEl as `source` is safe ONLY because #cmHud is not focusable — positionRefuse calls source.focus(), a no-op on a plain <div>; giving #cmHud a tabindex/contenteditable would blur the input, fire the blur handler, and wrongly discard+toast.
|
|
8516
|
+
if(!ok){cmHudEl.classList.add('err');return;}
|
|
8517
|
+
cmHudClose();return;
|
|
8518
|
+
}
|
|
8519
|
+
const pv=parseVec(str);
|
|
8157
8520
|
if(!pv){cmHudEl.classList.add('err');toast('Enter a length (12\'-6) or components (dx,dy)');return;}
|
|
8158
8521
|
if(view3d&&window.Steel3DView){ // 3D: the view resolves via the pure resolver + its token, commits via onTransform3d/onAddMember3d
|
|
8159
8522
|
const fn=cmHudConsumer==='add'?window.Steel3DView.drHudApply:window.Steel3DView.cmHudApply;
|
|
@@ -8581,11 +8944,13 @@ document.getElementById('csArm3dB').onclick=()=>{const d3=window.Steel3DView;if(
|
|
|
8581
8944
|
* updater here and nowhere else; `npm run verify:display-sync` fails the build if a `.dtog` id in the
|
|
8582
8945
|
* markup has no updater in this function.
|
|
8583
8946
|
*/
|
|
8584
|
-
function syncDisplayRows(){updGridToggle();updLenToggle();updDimToggle();updCalloutToggle();updPlToggle();updRefToggle();}
|
|
8947
|
+
function syncDisplayRows(){updGridToggle();updLenToggle();updPosGizmoToggle();updDimToggle();updCalloutToggle();updPlToggle();updRefToggle();}
|
|
8585
8948
|
function updDimToggle(){const b=document.getElementById('dimToggleB');if(!b)return;b.disabled=false;b.classList.toggle('on',dimsVisible);b.setAttribute('aria-checked',String(dimsVisible));}
|
|
8586
8949
|
document.getElementById('dimToggleB').onclick=e=>{e.stopPropagation();dimsVisible=!dimsVisible;updDimToggle();render();};
|
|
8587
8950
|
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));}
|
|
8588
8951
|
document.getElementById('lenToggleB').onclick=e=>{e.stopPropagation();showSelLen=!showSelLen;try{localStorage.setItem('steel:selLen:v2',showSelLen?'1':'0');}catch(_){}updLenToggle();render();}; // render() repaints the 2D chips + pushes/clears labels in 3D
|
|
8952
|
+
function updPosGizmoToggle(){const b=document.getElementById('posGizmoToggleB');if(!b)return;b.disabled=false;b.classList.toggle('on',showPosGizmo);b.setAttribute('aria-checked',String(showPosGizmo));}
|
|
8953
|
+
document.getElementById('posGizmoToggleB').onclick=e=>{e.stopPropagation();showPosGizmo=!showPosGizmo;try{localStorage.setItem('steel:posGizmo:v2',showPosGizmo?'1':'0');}catch(_){}updPosGizmoToggle();if(view3dReady&&window.Steel3DView&&window.Steel3DView.setPositionGizmoVisible)window.Steel3DView.setPositionGizmoVisible(showPosGizmo);}; // the gizmo is a 3D overlay — push straight to the view (.stopPropagation keeps the menu open, like every .dtog)
|
|
8589
8954
|
// ⋯ Display → Grid label size. One setting, both views: 2D re-places its bubbles from the anchors baked
|
|
8590
8955
|
// by gridSvg (no re-render — a rebuild between a dblclick's two clicks would kill the rename gesture),
|
|
8591
8956
|
// and 3D is told live, where sizeGridLabels() re-derives the world size on the next frame.
|
|
@@ -8618,7 +8983,7 @@ function updRefToggle(){const b=document.getElementById('refToggleB');if(!b)retu
|
|
|
8618
8983
|
// that flag — the reader writes it and Steel Filter only dims the row. So say it here, on the one
|
|
8619
8984
|
// control a user consults to reason about the backdrop, instead of leaving the omission silent.
|
|
8620
8985
|
const n=hiddenLayerCount();
|
|
8621
|
-
b.setAttribute('data-tip',REF_TIP+(n?(' '+n+' layer'+(n===1?'':'s')+' marked “listed but not drawn” '+(n===1?'is':'are')+' always excluded — review them in
|
|
8986
|
+
b.setAttribute('data-tip',REF_TIP+(n?(' '+n+' layer'+(n===1?'':'s')+' marked “listed but not drawn” '+(n===1?'is':'are')+' always excluded — review them in Drawing Filter.'):''));}
|
|
8622
8987
|
document.getElementById('refToggleB').onclick=e=>{e.stopPropagation();refSheetOn=!refSheetOn;try{localStorage.setItem('steel:refSheet:v2',refSheetOn?'1':'0');}catch(_){}updRefToggle();render();};
|
|
8623
8988
|
document.getElementById('gridEditB').onclick=()=>{setGridMode(!gridMode);render();};
|
|
8624
8989
|
document.getElementById('dimStyleB').onclick=()=>{setDimStyleMode(!dimStyleMode);render();};
|
|
@@ -9371,6 +9736,12 @@ const view3dApi={
|
|
|
9371
9736
|
defaultTosMm:()=>v2Refuse('defaultTosMm — native members carry explicit elevations, so a substituted default would silently relocate them'),
|
|
9372
9737
|
geoMode:()=>geoMode, // 'el' | 'split' | null — armed Trim/Extend/Split state
|
|
9373
9738
|
onMoveMember:(id,newWp)=>{edit(()=>{const m=byId(id);if(m)MC().replaceEndpoints(m,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.
|
|
9739
|
+
positionGizmoState:(id)=>memberPositionGizmoState(id), // 3D Profile Position gizmo (slice 3a): read-only frame axes + current-frame offset/roll for one member
|
|
9740
|
+
commitMemberPosition:(id,patch,source)=>commitMemberPosition(id,patch,source), // gizmo drag/type → absolute {positionOffset|positionHOffset|rot} through the shipped commitPositionEdit (one undo entry)
|
|
9741
|
+
commitMemberEndpoints:(id,spec,source)=>commitMemberEndpoints(id,spec,source), // slice 3b.1: reference-line handles → absolute world-mm work points through moveWorkPoints (one undo entry, connections revalidate at the server write boundary)
|
|
9742
|
+
openPositionHud:(id,axis,scr)=>openPositionHud(id,axis,scr), // 3b.3: double-click a handle → dock the shared #cmHud typed-entry HUD at it, commit bypasses snap
|
|
9743
|
+
showHandleTip:(txt,x,y)=>{if(window.__tip)window.__tip.showText(txt,x,y);}, // 3b.3: canvas gizmo handles carry no DOM data-tip — route through the shared themed #tooltip programmatically
|
|
9744
|
+
hideHandleTip:()=>{if(window.__tip)window.__tip.hide();},
|
|
9374
9745
|
dragMoveEnabled:()=>dragMoveOn, // the 3D view gates its plain member-drag on this
|
|
9375
9746
|
dragMoveHint:()=>{if(dragHintShown)return;dragHintShown=true;try{localStorage.setItem('steel:dragmovehint:v2','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');},
|
|
9376
9747
|
onCopyDrag3d:(ids,dxMm,dyMm)=>{ // Ctrl+drag copy: WORLD MM straight across the boundary now — it owns the per-plane mm→px conversion (direct manipulation, not gated by the Select filter — see onMoveMember)
|
|
@@ -15406,6 +15777,7 @@ async function setView(on,{remember=true}={}){
|
|
|
15406
15777
|
// nothing to undo here; just stop.
|
|
15407
15778
|
if(seq!==viewSeq)return;
|
|
15408
15779
|
window.Steel3DView.setSelection(selIds);
|
|
15780
|
+
if(window.Steel3DView.setPositionGizmoVisible)window.Steel3DView.setPositionGizmoVisible(showPosGizmo); // reflect the persisted ⋯ Display → Position handle state when 3D becomes visible
|
|
15409
15781
|
if(window.Steel3DView.setGridSelection)window.Steel3DView.setGridSelection(selGridIds); // carry the shared 2D grid selection across the rebuild; rebuild replaces the line objects/materials
|
|
15410
15782
|
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.
|
|
15411
15783
|
wire3DBar();wireLegendTabs();loadSteelFavourites();build3DLegend();
|
|
@@ -17781,5 +18153,12 @@ boot().catch(err => { document.body.replaceChildren(Object.assign(document.creat
|
|
|
17781
18153
|
document.addEventListener('pointerover', e=>{ const el=e.target.closest('[data-tip]'); if(!el) return; clearTimeout(t); t=setTimeout(()=>show(el),400); });
|
|
17782
18154
|
document.addEventListener('pointerout', e=>{ if(e.target.closest('[data-tip]')) hide(); });
|
|
17783
18155
|
document.addEventListener('pointerdown', hide, true); // a click hides the tip immediately
|
|
18156
|
+
// Programmatic access for canvas handles (the 3D gizmo has no DOM to carry data-tip). Same shared themed
|
|
18157
|
+
// #tooltip element, positioned at a client point, clamped to the viewport — so a WebGL handle's tooltip is
|
|
18158
|
+
// themed exactly like every toolbar tip and never a native light title=. showText hides on the next hover-out
|
|
18159
|
+
// or pointerdown via the existing listeners; the 3D view also calls hideHandleTip when the cursor leaves a handle.
|
|
18160
|
+
window.__tip = { showText(txt, x, y){ clearTimeout(t); if(!txt){ hide(); return; } tip.textContent=txt; tip.classList.add('show');
|
|
18161
|
+
const tw=tip.offsetWidth, th=tip.offsetHeight; tip.style.left=Math.max(6,Math.min(x - tw/2, innerWidth - tw - 6))+'px';
|
|
18162
|
+
tip.style.top=(y + 18 + th > innerHeight - 6 ? y - th - 12 : y + 18)+'px'; }, hide };
|
|
17784
18163
|
})();
|
|
17785
18164
|
</script></body></html>
|