@floless/app 0.95.2 → 0.96.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/floless-server.cjs
CHANGED
|
@@ -53106,7 +53106,7 @@ function appVersion() {
|
|
|
53106
53106
|
return resolveVersion({
|
|
53107
53107
|
isSea: isSea2(),
|
|
53108
53108
|
sqVersionXml: readSqVersionXml(),
|
|
53109
|
-
define: true ? "0.
|
|
53109
|
+
define: true ? "0.96.0" : void 0,
|
|
53110
53110
|
pkgVersion: readPkgVersion()
|
|
53111
53111
|
});
|
|
53112
53112
|
}
|
|
@@ -53116,7 +53116,7 @@ function resolveChannel(s) {
|
|
|
53116
53116
|
return "dev";
|
|
53117
53117
|
}
|
|
53118
53118
|
function appChannel() {
|
|
53119
|
-
return resolveChannel({ isSea: isSea2(), define: true ? "0.
|
|
53119
|
+
return resolveChannel({ isSea: isSea2(), define: true ? "0.96.0" : void 0 });
|
|
53120
53120
|
}
|
|
53121
53121
|
|
|
53122
53122
|
// workflow-update.ts
|
|
@@ -125,7 +125,7 @@ function closestOnSeg(p, a, b) {
|
|
|
125
125
|
|
|
126
126
|
/** The 3D point a candidate proposes for the dragged point. */
|
|
127
127
|
function candidatePoint(c, dragged) {
|
|
128
|
-
if (c.type === 'vertex' || c.type === 'intersection' || c.type === 'midpoint' || c.type === 'level' || c.type === 'origin') return c.p; // fixed points
|
|
128
|
+
if (c.type === 'vertex' || c.type === 'intersection' || c.type === 'midpoint' || c.type === 'level' || c.type === 'origin' || c.type === 'origin-grid') return c.p; // fixed points (origin-grid = a quantized lattice node, UCS Stage 6)
|
|
129
129
|
if (c.type === 'vertical-axis') return [c.p[0], c.p[1], dragged[2]]; // lock plan X/Y to the axis, keep dragged Z
|
|
130
130
|
if (c.type === 'grid-int') return [c.p[0], c.p[1], dragged[2]]; // grid steers PLAN only — never yanks the elevation
|
|
131
131
|
if (c.type === 'grid-line') { const q = closestOnSeg(dragged, c.a, c.b); return [q[0], q[1], dragged[2]]; }
|
|
@@ -261,6 +261,24 @@ export function frameFromAngle(origin, angleRad) {
|
|
|
261
261
|
return { origin: [origin[0], origin[1], origin[2]], xAxis: [c, s, 0], yAxis: [-s, c, 0], normal: [0, 0, 1] };
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
+
/**
|
|
265
|
+
* UCS Stage 6 — origin-relative snap: quantize a WORLD point to the nearest node of a lattice of spacing
|
|
266
|
+
* `incMm` measured FROM the frame origin ALONG its rotated local axes (worldToLocal → round each local coord
|
|
267
|
+
* to the increment → localToWorld). Returns a world point (3 finite mm), or null when it can't produce a
|
|
268
|
+
* finite node — no frame (null), `incMm` not a positive finite number, a non-array point, or a non-finite
|
|
269
|
+
* result (the single fail-closed guard so a garbage increment/point never reaches geometry). Opt-in: the caller
|
|
270
|
+
* competes
|
|
271
|
+
* this ONE node against real geometry in snapPoint, where the 'origin-grid' type has the lowest precedence, so
|
|
272
|
+
* a real vertex/intersection always wins — the grid only catches a free click, never drowns geometry snap.
|
|
273
|
+
*/
|
|
274
|
+
export function snapGridPoint(p, frame, incMm) {
|
|
275
|
+
if (!frame || !Array.isArray(p) || !Number.isFinite(incMm) || !(incMm > 0)) return null;
|
|
276
|
+
const l = worldToLocal(p, frame);
|
|
277
|
+
const q = [Math.round(l[0] / incMm) * incMm, Math.round(l[1] / incMm) * incMm, Math.round(l[2] / incMm) * incMm];
|
|
278
|
+
const w = localToWorld(q, frame);
|
|
279
|
+
return (Number.isFinite(w[0]) && Number.isFinite(w[1]) && Number.isFinite(w[2])) ? w : null;
|
|
280
|
+
}
|
|
281
|
+
|
|
264
282
|
/**
|
|
265
283
|
* Typed coordinate entry (UCS Stage 3) — the ONE pure seam Move/Copy + Add both route through. Given a
|
|
266
284
|
* parsed component triple + a `provided` mask (which slots the user actually typed), a mode, the anchor in
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import * as THREE from 'three';
|
|
18
18
|
import { OrbitControls } from 'three/addons/OrbitControls.js';
|
|
19
19
|
import { Brush, Evaluator, SUBTRACTION } from 'three-bvh-csg';
|
|
20
|
-
import { snapCandidates, snapPoint, planPointToWp, memberGeometry, elevationLevels, snapElevation, dim3dGeom, dominantAxis3d, planeBasis, planeFrom3Points, vecToPlane, frameFrom3Points, frameFromAngle, worldToLocal, identityFrame, resolvePointEntry, offsetsFor, candidateOnPlane } from './steel-3d-core.js';
|
|
20
|
+
import { snapCandidates, snapPoint, planPointToWp, memberGeometry, elevationLevels, snapElevation, dim3dGeom, dominantAxis3d, planeBasis, planeFrom3Points, vecToPlane, frameFrom3Points, frameFromAngle, worldToLocal, identityFrame, resolvePointEntry, offsetsFor, candidateOnPlane, snapGridPoint } from './steel-3d-core.js';
|
|
21
21
|
import { gridGeometry, gridCandidates3d, mmPerPx } from './grid-core.js';
|
|
22
22
|
|
|
23
23
|
let renderer, scene, perspCam, orthoCam, camera, controls, root, api, canvasEl, ro, rafId, grid, raycaster, downXY, lastPick = '(none)';
|
|
@@ -2735,13 +2735,31 @@ function cmClear3d() { tfDraft = null; tfCandidates = null; tfLock.clear(); tfPr
|
|
|
2735
2735
|
function cmEscape() { if (!tfDraft) return false; if (tfDraft.vA) { tfDraft.vA = null; tfPreviewClear(); return true; } tfDraft = null; tfPreviewClear(); return true; }
|
|
2736
2736
|
function tfDisposeGhost() { if (!tfGhost) return; if (scene) scene.remove(tfGhost); for (const c of tfGhost.children) { if (c.userData._ownGeom && c.geometry) c.geometry.dispose(); } tfGhost = null; } // clones share the source geometry/material; only the >600 fallback BoxGeometry is per-ghost → dispose those (flagged _ownGeom) so the preview can't leak
|
|
2737
2737
|
function tfPreviewClear() { tfDisposeGhost(); if (tfRubber) tfRubber.visible = false; if (tfRubberA) tfRubberA.visible = false; if (marker) marker.visible = false; if (readout) readout.style.display = 'none'; }
|
|
2738
|
+
// UCS Stage 6 — origin-relative snap (opt-in, OFF by default). ONE candidate: the cursor quantized to the
|
|
2739
|
+
// nearest node of a lattice measured FROM the local-frame origin ALONG its rotated axes (snapGridPoint).
|
|
2740
|
+
// Injected per-hover here because allCandidates is cached + cursorless — a lattice node depends on the cursor.
|
|
2741
|
+
// It competes in snapPoint at the lowest precedence (type 'origin-grid' → PRECEDENCE default), so a real
|
|
2742
|
+
// vertex/intersection always wins; the grid only catches a FREE click and never drowns geometry snap.
|
|
2743
|
+
// Requires an UNSHADOWED local frame (a UCS origin to measure from): a set ◇ Plane shadows frame3d for every
|
|
2744
|
+
// drawing tool (chip reads "Plane"), so the grid — a frame3d-axes feature — is dormant under a plane too, the
|
|
2745
|
+
// same way Stage-5 dims ignore a shadowed frame. A transient snap override (one-type or 'none') or the host
|
|
2746
|
+
// toggle being off also suppresses it. NOT gated by candOnActiveWP: that level constraint is measured against
|
|
2747
|
+
// effectiveWP (which can differ in Z from the frame origin), whereas the grid deliberately measures from
|
|
2748
|
+
// frame3d.origin — the "3D snapping" toggle governs GEOMETRY snapping, not this explicit opt-in grid.
|
|
2749
|
+
function gridSnapCand(p) {
|
|
2750
|
+
if (!frame3d || workPlane || snapOnly3d || !api || !api.originGrid) return [];
|
|
2751
|
+
const g = api.originGrid(); if (!g || !g.on) return [];
|
|
2752
|
+
const node = snapGridPoint(p, frame3d, g.incMm);
|
|
2753
|
+
return node ? [{ type: 'origin-grid', p: node, fromId: 'ucs-grid' }] : [];
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2738
2756
|
// snapped pick projected onto the working plane (Tekla: snaps win, then land on the plane)
|
|
2739
2757
|
function wpPointAt(e) {
|
|
2740
2758
|
const wp = effectiveWP();
|
|
2741
2759
|
const hit = rayToWP(e.clientX, e.clientY, wp); if (!hit) return null;
|
|
2742
2760
|
if (!e.altKey) {
|
|
2743
2761
|
if (!tfCandidates) tfCandidates = allCandidates(null); // members + grid, so Move/Copy + draw-on-plane snap to the grid too
|
|
2744
|
-
const cands = tfCandidates.filter((c) => candAllowed3d(c.type) && candOnActiveWP(c, hit, wp)); // running-snaps / override, then (3D toggle off) the working-plane constraint
|
|
2762
|
+
const cands = tfCandidates.filter((c) => candAllowed3d(c.type) && candOnActiveWP(c, hit, wp)).concat(gridSnapCand(hit)); // running-snaps / override, then (3D toggle off) the working-plane constraint; opt-in origin grid rides on top (its own precedence)
|
|
2745
2763
|
const r = snapPoint(hit, cands, toScreen, SNAP_TOL_PX);
|
|
2746
2764
|
if (r.candidate) return { p: r.snapped, snap: true, type: r.candidate.type }; // land on the TRUE 3D snap (member end / grid) when the SNAP-bar 3D toggle is ON — free to the whole model, same as global (Pawel D5); OFF constrains to the working plane above; a free (non-snapped) click still rides the plane below
|
|
2747
2765
|
}
|
|
@@ -3005,6 +3023,7 @@ function makeReticleTexture(kind) {
|
|
|
3005
3023
|
else if (kind === 'vbar') dual(() => { g.beginPath(); g.moveTo(cx, cy - r); g.lineTo(cx, cy + r); g.stroke(); }, 8, 14);
|
|
3006
3024
|
else if (kind === 'square') dual(() => { g.beginPath(); g.rect(cx - r, cy - r, 2 * r, 2 * r); g.stroke(); }, 7, 13); // vertex/endpoint = square (CAD convention; matches the 2D endpoint marker)
|
|
3007
3025
|
else if (kind === 'hourglass') dual(() => { g.beginPath(); g.moveTo(cx - r, cy - r); g.lineTo(cx + r, cy - r); g.lineTo(cx - r, cy + r); g.lineTo(cx + r, cy + r); g.closePath(); g.stroke(); }, 6, 12); // on-line ("nearest") = hourglass/clepsydra, matches the 2D marker
|
|
3026
|
+
else if (kind === 'plus') dual(() => { g.beginPath(); g.moveTo(cx - r, cy); g.lineTo(cx + r, cy); g.moveTo(cx, cy - r); g.lineTo(cx, cy + r); g.stroke(); }, 7, 13); // origin-grid node = upright plus (distinct from the × intersection glyph)
|
|
3008
3027
|
else { g.fillStyle = HALO; g.beginPath(); g.arc(cx, cy, 11, 0, Math.PI * 2); g.fill(); g.fillStyle = CY; g.beginPath(); g.arc(cx, cy, 8, 0, Math.PI * 2); g.fill(); } // dot (fallback)
|
|
3009
3028
|
const tex = new THREE.CanvasTexture(c); if (THREE.SRGBColorSpace) tex.colorSpace = THREE.SRGBColorSpace; tex.needsUpdate = true;
|
|
3010
3029
|
return tex;
|
|
@@ -3014,6 +3033,7 @@ function reticleFor(type) {
|
|
|
3014
3033
|
const k = (type === 'intersection' || type === 'grid-int') ? 'x' : type === 'midpoint' ? 'tri'
|
|
3015
3034
|
: (type === 'centerline' || type === 'grid-line') ? 'hourglass' // snap ONTO a line = "nearest"
|
|
3016
3035
|
: type === 'level' ? 'bar' // elevation level = horizontal bar
|
|
3036
|
+
: type === 'origin-grid' ? 'plus' // origin-relative grid node (UCS Stage 6)
|
|
3017
3037
|
: type === 'vertical-axis' ? 'vbar' : type === 'vertex' ? 'square' : 'dot';
|
|
3018
3038
|
return reticleTex[k] || (reticleTex[k] = makeReticleTexture(k));
|
|
3019
3039
|
}
|
|
@@ -206,6 +206,14 @@
|
|
|
206
206
|
.m3dmenu button.wtog.on{color:var(--text)} /* the slider carries the on-state — don't also brand the label text */
|
|
207
207
|
#moreMenu button.msnap .sg{display:inline-block;width:17px;color:#22d3ee;opacity:.5;flex:none;transition:opacity .15s}
|
|
208
208
|
#moreMenu button.msnap.on .sg{opacity:1}
|
|
209
|
+
/* UCS Stage 6 — origin-grid: a plain .msnap toggle (3D-only), then a Step sub-row revealed only when it's on. */
|
|
210
|
+
body:not(.v3d) #snapSect [data-s3donly]{display:none} body.v3d #snapSect [data-s3donly]{display:flex} /* body:not(.v3d) adds the specificity to beat the base #moreMenu button.msnap{display:flex} rule (else the 3D-only row leaks into the 2D menu) */
|
|
211
|
+
#moreMenu .msnap-sub{display:none;align-items:center;flex-wrap:wrap;gap:4px 8px;padding:2px 12px 6px 26px} /* indent to sit under the toggle's label; revealed via .on (and only in 3D) */
|
|
212
|
+
body.v3d #moreMenu .msnap-sub.on{display:flex}
|
|
213
|
+
#moreMenu .msnap-sub .msub-lbl{color:var(--mut);font-size:11px;flex:none}
|
|
214
|
+
#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}
|
|
215
|
+
#moreMenu .msnap-sub input:focus{outline:none;border-color:var(--brand)}
|
|
216
|
+
#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 */
|
|
209
217
|
/* Pointer-behaviour bars, bottom-right of the canvas (both views): [ Select filter ] [ Snap ]. Both reuse the brand-fill "on" toolbar language. */
|
|
210
218
|
#ptrBars{position:absolute;right:12px;bottom:12px;z-index:8;display:flex;align-items:flex-end;gap:8px}
|
|
211
219
|
#ptrBars.s3d{right:104px} /* in 3D, sit just LEFT of the bottom-right world-axis triad (#m3dAxes, right 15 + 78 wide) — same bottom edge (the ViewCube is top-right) */
|
|
@@ -251,7 +259,7 @@
|
|
|
251
259
|
/* The "3D" snap-MODE toggle is the inverse: 3D-only. A short text label (not an osnap glyph) → smaller/bolder; a hair-line divider before it marks it as a mode, not a peer snap type. */
|
|
252
260
|
#snapBar [data-snap3d]{display:none;font-size:11px;font-weight:700;letter-spacing:.02em;margin-left:4px;border-left:1px solid var(--line);border-radius:0 5px 5px 0;padding-left:4px;box-sizing:border-box;width:32px}
|
|
253
261
|
body.v3d #snapBar [data-snap3d]{display:grid}
|
|
254
|
-
#snapSect [data-snap3d]{display:none}
|
|
262
|
+
body:not(.v3d) #snapSect [data-snap3d]{display:none} /* specificity to beat button.msnap{display:flex} — same 2D-leak fix as [data-s3donly] above */
|
|
255
263
|
body.v3d #snapSect [data-snap3d]{display:flex}
|
|
256
264
|
#moreMenu .mhint{color:var(--mut);font-size:11px;line-height:1.4;padding:4px 12px 6px;max-width:230px;white-space:normal}
|
|
257
265
|
#rfiStat{cursor:pointer;text-decoration:underline dotted} #rfiStat:hover b{color:#fff}
|
|
@@ -765,6 +773,8 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
765
773
|
<button class="msnap" data-snap=par role=menuitemcheckbox aria-checked=false data-tip="Parallel — when you draw roughly parallel to a nearby line, snap the direction to exactly parallel."><span class=mck aria-hidden=true></span><span class=sg aria-hidden=true>∥</span>Parallel</button>
|
|
766
774
|
<button class="msnap" data-snap=ext role=menuitemcheckbox aria-checked=false data-tip="Snap along the invisible extension of a member/line past its endpoint, with a dashed guide line"><span class=mck aria-hidden=true></span><span class=sg aria-hidden=true>┈</span>Extension</button>
|
|
767
775
|
<button class="msnap on" data-snap3d role=menuitemcheckbox aria-checked=true data-tip="On: snap freely to any point in 3D, at any elevation. Off: snap only on the current working level. (3D view only.)"><span class=mck aria-hidden=true></span><span class=sg aria-hidden=true>◈</span>3D snapping</button>
|
|
776
|
+
<button class=msnap data-ogrid data-s3donly role=menuitemcheckbox aria-checked=false data-tip="On: also snap to a lattice measured from your local-axes origin, spaced by the Step, along the rotated axes — on top of geometry snapping (real geometry always wins). Does nothing until you set a local frame (3D). 3D view only."><span class=mck aria-hidden=true></span><span class=sg aria-hidden=true>▦</span>Origin grid</button>
|
|
777
|
+
<div class=msnap-sub data-ogrid-sub><span class=msub-lbl>Step</span><input id=ogridInc type=text inputmode=decimal autocomplete=off spellcheck=false aria-label="Origin grid step" data-tip="Distance between snap points along the local axes (feet-inches, e.g. 12" or 1'-0")."><span id=ogridHint class=oghint hidden>Set local axes (3D) below to activate.</span></div>
|
|
768
778
|
<div class=mhint>Right-click the canvas any time to force one snap type for a single pick.</div>
|
|
769
779
|
</div>
|
|
770
780
|
<button class=msec-hdr data-sec=display aria-expanded=false data-tip="Show/hide plan layers, and edit grid lines">Display<span class=chev aria-hidden=true>▸</span></button>
|
|
@@ -2962,6 +2972,14 @@ function saveSnapPrefs(){try{localStorage.setItem(SNAP_PREF_KEY,JSON.stringify(s
|
|
|
2962
2972
|
const SNAP3D_KEY='steel:snap3dFree:v1';
|
|
2963
2973
|
let snap3dFree=(()=>{try{return localStorage.getItem(SNAP3D_KEY)!=='0';}catch(_){return true;}})(); // default ON; only an explicit '0' is OFF (unset OR a corrupted value falls back to the ON default)
|
|
2964
2974
|
function saveSnap3d(){try{localStorage.setItem(SNAP3D_KEY,snap3dFree?'1':'0');}catch(_){}}
|
|
2975
|
+
// UCS Stage 6 — origin-relative snap (opt-in, OFF by default). A lattice measured from the local-frame
|
|
2976
|
+
// origin along its rotated axes; the 3D view reads it live (api.originGrid) and competes ONE quantized node
|
|
2977
|
+
// against real geometry at the lowest precedence (never drowns geometry snap). Increment stored in INCHES
|
|
2978
|
+
// (parseLen/fmtFtIn units); it only does anything once a local frame is set (Set local axes, 3D).
|
|
2979
|
+
const OGRID_ON_KEY='steel:originGrid:v1', OGRID_INC_KEY='steel:originGridInc:v1', OGRID_INC_DEFAULT=12; // 12" default step — a clean, visible grid; user-configurable
|
|
2980
|
+
let originGridOn=(()=>{try{return localStorage.getItem(OGRID_ON_KEY)==='1';}catch(_){return false;}})(); // default OFF (opt-in): only an explicit '1' turns it on
|
|
2981
|
+
let originGridInc=(()=>{try{const v=Number(localStorage.getItem(OGRID_INC_KEY));return (Number.isFinite(v)&&v>0)?v:OGRID_INC_DEFAULT;}catch(_){return OGRID_INC_DEFAULT;}})(); // inches; STRICT Number() (not parseFloat) so "6garbage" → NaN → default, not a partial 6
|
|
2982
|
+
function saveOriginGrid(){try{localStorage.setItem(OGRID_ON_KEY,originGridOn?'1':'0');localStorage.setItem(OGRID_INC_KEY,String(originGridInc));}catch(_){}}
|
|
2965
2983
|
// ── Selection filter (Tekla "select switches"): which object CLASSES — and which member types /
|
|
2966
2984
|
// connection kinds — may enter a selection. One persisted source of truth, consulted at every pick
|
|
2967
2985
|
// sink (2D click/marquee/Ctrl+A, 3D pick/box). Default: everything ON, so nothing is filtered out
|
|
@@ -3827,6 +3845,7 @@ function axisGlyphSvg(o,dir,preview){
|
|
|
3827
3845
|
+tag(lx,'#ef4444','X')+tag(ly,'#22c55e','Y')+`</g>`;}
|
|
3828
3846
|
// header chip + the More-menu "Reset to global" enabled state — reflect the current frame.
|
|
3829
3847
|
function updCS(){const s=document.getElementById('csStat');const r=document.getElementById('csResetB');
|
|
3848
|
+
if(typeof syncOgridHint==='function')syncOgridHint(); // keep the origin-grid "set a frame" nudge in sync when the frame is set/cleared
|
|
3830
3849
|
if(view3d&&window.Steel3DView&&window.Steel3DView.frameInfo){ // 3D → the local drawing frame (◇ Plane shadows it)
|
|
3831
3850
|
const fi=window.Steel3DView.frameInfo(),local=fi.mode==='local',plane=fi.mode==='plane';
|
|
3832
3851
|
const desc=plane?'Plane':(local?((fi.horizontal?Math.round(fi.angleDeg)+'°':'tilted')+' local (3D)'):'Global'); // a tilt can't be one number → the word "tilted" (numeric tilt lives in the panel/tooltip)
|
|
@@ -4257,6 +4276,25 @@ function reflectSnap3d(){for(const b of snap3dBtns){b.classList.toggle('on',snap
|
|
|
4257
4276
|
function toggleSnap3d(){snap3dFree=!snap3dFree;saveSnap3d();reflectSnap3d();}
|
|
4258
4277
|
for(const b of snap3dBtns)b.onclick=e=>{e.stopPropagation();toggleSnap3d();};
|
|
4259
4278
|
reflectSnap3d();
|
|
4279
|
+
// UCS Stage 6 — origin-grid toggle + step (increment) field. Persists locally; the 3D view reads it live
|
|
4280
|
+
// (api.originGrid) per hover. Step is stored/parsed in inches (parseLen/fmtFtIn); a bad/empty entry reverts
|
|
4281
|
+
// to the last good value. No marker to clear — the next canvas hover re-evaluates against the new setting.
|
|
4282
|
+
const ogridBtn=document.getElementById('snapSect')?.querySelector('[data-ogrid]'), ogridSub=document.querySelector('[data-ogrid-sub]'), ogridInc=document.getElementById('ogridInc');
|
|
4283
|
+
function syncOgridHint(){const h=document.getElementById('ogridHint');if(!h)return;let local=false;try{local=!!(view3d&&window.Steel3DView&&window.Steel3DView.frameInfo&&window.Steel3DView.frameInfo().mode==='local');}catch(_){}h.hidden=!(originGridOn&&!local);} // nudge appears only when the grid is on but no local frame exists yet; self-heals via updCS on frame set/clear
|
|
4284
|
+
function reflectOriginGrid(){
|
|
4285
|
+
if(ogridBtn){ogridBtn.classList.toggle('on',originGridOn);ogridBtn.setAttribute('aria-checked',String(originGridOn));}
|
|
4286
|
+
if(ogridSub)ogridSub.classList.toggle('on',originGridOn); // reveal the Step sub-row only while on (mirrors #csF3dFields.on)
|
|
4287
|
+
if(ogridInc&&document.activeElement!==ogridInc)ogridInc.value=fmtFtIn(originGridInc); // don't clobber what the user is typing
|
|
4288
|
+
syncOgridHint();
|
|
4289
|
+
}
|
|
4290
|
+
function commitOriginGridInc(){const v=parseLen(ogridInc.value);if(v!=null&&v>0)originGridInc=v;saveOriginGrid();ogridInc.value=fmtFtIn(originGridInc);syncOgridHint();} // reject <=0 / unparseable, then ALWAYS echo the canonical last-good step back into the field (a garbage/blank/Escape entry visibly snaps to the previous value)
|
|
4291
|
+
if(ogridBtn)ogridBtn.onclick=e=>{e.stopPropagation();originGridOn=!originGridOn;saveOriginGrid();reflectOriginGrid();};
|
|
4292
|
+
if(ogridInc){
|
|
4293
|
+
ogridInc.addEventListener('keydown',e=>{e.stopPropagation();if(e.key==='Enter'){e.preventDefault();commitOriginGridInc();ogridInc.blur();}else if(e.key==='Escape'){e.preventDefault();ogridInc.value=fmtFtIn(originGridInc);ogridInc.blur();}}); // stopPropagation keeps editor shortcuts out while typing; Enter commits; Escape restores the last-good display (the ensuing blur re-commits that same value, a no-op)
|
|
4294
|
+
ogridInc.addEventListener('change',commitOriginGridInc); // blur/commit
|
|
4295
|
+
ogridInc.addEventListener('click',e=>e.stopPropagation()); // clicking the field must not close the ⋯ menu
|
|
4296
|
+
}
|
|
4297
|
+
reflectOriginGrid();
|
|
4260
4298
|
// Property-panel width: draggable handle on its left edge (persisted, clamped so it can't swallow the canvas).
|
|
4261
4299
|
(function(){
|
|
4262
4300
|
const rz=document.getElementById('panelResizer'); if(!rz)return;
|
|
@@ -4371,6 +4409,7 @@ const view3dApi={
|
|
|
4371
4409
|
membersByPlan:()=>((C&&Array.isArray(C.plans))?C.plans:[]).map(p=>({members:p.members||[],ptPerFt:(p.pt_per_ft>0?p.pt_per_ft:1),defaultTosMm:(p.default_tos!=null?p.default_tos:0)*25.4})), // every sheet's members WITH its OWN px→ft scale AND its OWN default T.O.S — 3D snapping targets the whole model (any elevation), each plan resolved exactly like the server bake (contract-to-scene: per-plan pt_per_ft + `default_tos ?? 0`) so candidates land on the rendered steel. Guards a not-yet-loaded contract (C.plans absent) so a hover can't throw out of the pointer handler.
|
|
4372
4410
|
snapEnabled:()=>snapEnabled, // the persistent running-snaps (⋯ menu → Snapping) — 3D honours the same on/off set
|
|
4373
4411
|
snap3dFree:()=>snap3dFree, // SNAP-bar "3D snapping" mode — ON: free 3D snap; OFF: 3D placement snap constrained to the working plane
|
|
4412
|
+
originGrid:()=>({on:originGridOn,incMm:originGridInc*25.4}), // UCS Stage 6 origin-relative snap — read live per hover; incMm from the inches step. Off ⇒ view skips it; requires a local frame to have any effect
|
|
4374
4413
|
canSelectId:(id)=>selIdOK(id), // Select-filter predicate for the 3D view (e.g. don't draw a whole-connection envelope for a fully-filtered connection)
|
|
4375
4414
|
ptPerFt:()=>(P&&P.pt_per_ft>0?P.pt_per_ft:1),
|
|
4376
4415
|
defaultTosMm:()=>(defaultTOS!=null?defaultTOS*25.4:0), // editor stores default T.O.S in inches
|