@floless/app 0.94.1 → 0.95.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.95.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.95.0" : void 0 });
|
|
53120
53120
|
}
|
|
53121
53121
|
|
|
53122
53122
|
// workflow-update.ts
|
|
@@ -54144,7 +54144,8 @@ function typeMatches(value, t) {
|
|
|
54144
54144
|
case "string":
|
|
54145
54145
|
return typeof value === "string";
|
|
54146
54146
|
case "number":
|
|
54147
|
-
return typeof value === "number";
|
|
54147
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
54148
|
+
// reject ±Infinity (a 1e400 literal JSON-parses to Infinity, then JSON.stringify → null — silent corruption)
|
|
54148
54149
|
case "integer":
|
|
54149
54150
|
return typeof value === "number" && Number.isInteger(value);
|
|
54150
54151
|
case "boolean":
|
|
@@ -54158,6 +54159,7 @@ function typeMatches(value, t) {
|
|
|
54158
54159
|
function kindOf(v) {
|
|
54159
54160
|
if (v === null) return "null";
|
|
54160
54161
|
if (Array.isArray(v)) return "array";
|
|
54162
|
+
if (typeof v === "number" && !Number.isFinite(v)) return "non-finite number";
|
|
54161
54163
|
return typeof v;
|
|
54162
54164
|
}
|
|
54163
54165
|
function deepEqual(a, b) {
|
|
@@ -363,7 +363,8 @@
|
|
|
363
363
|
"id": { "type": "string" },
|
|
364
364
|
"a": { "$ref": "#/$defs/point3", "description": "First snapped anchor, world-scene mm." },
|
|
365
365
|
"b": { "$ref": "#/$defs/point3", "description": "Second snapped anchor, world-scene mm." },
|
|
366
|
-
"axis": { "enum": ["free", "x", "y", "z"], "description": "free = 3D distance ‖b-a‖; x|y
|
|
366
|
+
"axis": { "enum": ["free", "x", "y", "z"], "description": "free = 3D distance ‖b-a‖; x|y = the component along the local-frame X/Y (see axisDir) when a frame was active at placement, else the global world X/Y; z = the world-Z (elevation) component. The dim line is drawn along that direction for x|y|z." },
|
|
367
|
+
"axisDir": { "type": "array", "items": { "type": "number" }, "minItems": 3, "maxItems": 3, "description": "Optional world direction an x|y measurement runs along, captured from the active local frame (frame3d) at placement; normalized on read. Absent/legacy, or a degenerate (zero/overflow) vector, or presence on z|free → the measurement falls back to the normal `axis` behavior (the world X/Y/Z component, or the full 3D distance for free). Editor-only like the whole dims3d array: stripped before bake, never in the lock / IFC / BOM." }
|
|
367
368
|
}
|
|
368
369
|
},
|
|
369
370
|
"frame": {
|
|
@@ -316,17 +316,58 @@ export function offsetsFor(v, st, vA) {
|
|
|
316
316
|
return st.tool === 'copy' ? lin(v, st.count) : [v];
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
+
// UCS Stage 5 — one shared unit-direction rule for a frame-aware dim's world axisDir.
|
|
320
|
+
// Below EPS a vector is degenerate (no direction); above UNIT_TOL from 1 it's non-unit and gets re-normalized.
|
|
321
|
+
export const AXDIR_EPS = 1e-9, AXDIR_UNIT_TOL = 1e-6;
|
|
322
|
+
/**
|
|
323
|
+
* Normalize a candidate world direction, or return null when it carries no usable direction.
|
|
324
|
+
* null unless v is [finite, finite, finite] with a FINITE magnitude > AXDIR_EPS. Math.hypot can
|
|
325
|
+
* overflow to Infinity for huge finite components (e.g. 1.1e308) — the Number.isFinite(m) guard
|
|
326
|
+
* rejects that so we never divide by Infinity into [0,0,0]/NaN. Shared by dim3dGeom (render) and
|
|
327
|
+
* sanitizeDims3d (editor load) so both apply the exact same rule.
|
|
328
|
+
*/
|
|
329
|
+
export function unitOrNull(v) {
|
|
330
|
+
if (!Array.isArray(v) || v.length !== 3 || !v.every(Number.isFinite)) return null;
|
|
331
|
+
const m = Math.hypot(v[0], v[1], v[2]);
|
|
332
|
+
if (!Number.isFinite(m) || m <= AXDIR_EPS) return null;
|
|
333
|
+
return [v[0] / m, v[1] / m, v[2] / m];
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Canonicalize each 3D dim's optional `axisDir` so the editor never persists junk (which would
|
|
338
|
+
* wedge the schema-validated save). Pure: drops axisDir that is wrong-shape / degenerate / attached
|
|
339
|
+
* to a non-x|y axis, normalizes a non-unit vector, and keeps an already-unit vector verbatim (so a
|
|
340
|
+
* canonical write never ULP-churns across reloads). Run at every point a dims3d array is assigned.
|
|
341
|
+
*/
|
|
342
|
+
export function sanitizeDims3d(arr) {
|
|
343
|
+
if (!Array.isArray(arr)) return [];
|
|
344
|
+
return arr.map((d) => {
|
|
345
|
+
if (!d || d.axisDir === undefined) return d;
|
|
346
|
+
if (d.axis !== 'x' && d.axis !== 'y') { const { axisDir, ...rest } = d; return rest; } // z/free never carry axisDir
|
|
347
|
+
const u = unitOrNull(d.axisDir);
|
|
348
|
+
if (!u) { const { axisDir, ...rest } = d; return rest; } // wrong-shape / degenerate / overflow → drop
|
|
349
|
+
const m = Math.hypot(d.axisDir[0], d.axisDir[1], d.axisDir[2]);
|
|
350
|
+
return Math.abs(m - 1) > AXDIR_UNIT_TOL ? { ...d, axisDir: u } : d; // non-unit → normalize; already-unit → keep
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
|
|
319
354
|
/**
|
|
320
355
|
* 3D dimension geometry (pure). a,b are scene mm [x,y,z]. axis ∈ free|x|y|z.
|
|
321
|
-
* free → the straight segment a→b (valueMm = full 3D distance);
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
356
|
+
* free → the straight segment a→b (valueMm = full 3D distance); z → the world-Z (elevation)
|
|
357
|
+
* component; x|y → the component along `axisDir` (a world unit direction from the active local
|
|
358
|
+
* frame, normalized on read) when supplied & usable, else the world X/Y axis (legacy / global).
|
|
359
|
+
* valueMm = that component's length. Returns the drawn endpoints, the midpoint (where the label
|
|
360
|
+
* sits), and the measured length in mm.
|
|
325
361
|
*/
|
|
326
|
-
export function dim3dGeom(a, b, axis) {
|
|
362
|
+
export function dim3dGeom(a, b, axis, axisDir) {
|
|
327
363
|
const p1 = [a[0], a[1], a[2]];
|
|
364
|
+
const u = (axis === 'x' || axis === 'y') ? unitOrNull(axisDir) : null; // z/free never project onto axisDir
|
|
328
365
|
let p2;
|
|
329
|
-
if (
|
|
366
|
+
if (u) {
|
|
367
|
+
const t = (b[0] - a[0]) * u[0] + (b[1] - a[1]) * u[1] + (b[2] - a[2]) * u[2]; // signed projection of a→b onto û
|
|
368
|
+
p2 = [a[0] + t * u[0], a[1] + t * u[1], a[2] + t * u[2]];
|
|
369
|
+
}
|
|
370
|
+
else if (axis === 'x') p2 = [b[0], a[1], a[2]];
|
|
330
371
|
else if (axis === 'y') p2 = [a[0], b[1], a[2]];
|
|
331
372
|
else if (axis === 'z') p2 = [a[0], a[1], b[2]];
|
|
332
373
|
else p2 = [b[0], b[1], b[2]]; // free (default for any unrecognised axis)
|
|
@@ -1637,7 +1637,28 @@ function reflectDimBar() {
|
|
|
1637
1637
|
const sh = document.getElementById('m3dDimShow'); if (sh) sh.style.display = dimMode3d ? 'inline-block' : 'none';
|
|
1638
1638
|
reflectDimAxisBar();
|
|
1639
1639
|
}
|
|
1640
|
-
|
|
1640
|
+
// UCS Stage 5: the X/Y/Z labels must NEVER lie about what a dim measures. Three honest states:
|
|
1641
|
+
// · global (no frame, no plane) → X / Y / Z (as before)
|
|
1642
|
+
// · a local frame (unshadowed) → X′ / Y′ (local) + Elev (Z stays world elevation — a tilted frame is a hybrid)
|
|
1643
|
+
// · a ◇ Plane set (shadows the frame) → World X / World Y / Elev + a tip: dims IGNORE the plane (they go global)
|
|
1644
|
+
function reflectDimAxisBar() {
|
|
1645
|
+
const framed = !!frame3d && !workPlane, planed = !!workPlane;
|
|
1646
|
+
const LBL = {
|
|
1647
|
+
x: planed ? 'World X' : framed ? 'X′' : 'X',
|
|
1648
|
+
y: planed ? 'World Y' : framed ? 'Y′' : 'Y',
|
|
1649
|
+
z: (framed || planed) ? 'Elev' : 'Z',
|
|
1650
|
+
};
|
|
1651
|
+
const TIP = {
|
|
1652
|
+
x: planed ? 'Dims measure WORLD X, not the ◇ Plane (X)' : framed ? 'Measure along the local frame X′ (X)' : 'Lock measurement to X (X)',
|
|
1653
|
+
y: planed ? 'Dims measure WORLD Y, not the ◇ Plane (Y)' : framed ? 'Measure along the local frame Y′ (Y)' : 'Lock measurement to Y (Y)',
|
|
1654
|
+
z: (framed || planed) ? 'World Z — stays vertical even with a tilted frame (Z); Alt = quick vertical' : 'Lock to Z / vertical (Z); Alt = quick vertical',
|
|
1655
|
+
};
|
|
1656
|
+
document.querySelectorAll('#m3dDimAxis button').forEach((x) => {
|
|
1657
|
+
const a = x.dataset.d3axis;
|
|
1658
|
+
x.classList.toggle('on', a === dimAxis3d);
|
|
1659
|
+
if (a && LBL[a]) { x.textContent = LBL[a]; x.dataset.tip = TIP[a]; } // free button untouched (no LBL entry)
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1641
1662
|
// "Zoom to detail": double-click a part → zoom to a tight region around the click point so a connection
|
|
1642
1663
|
// fills the view (members AND their derived connection parts are valid targets), keeping the current view
|
|
1643
1664
|
// direction. Empty space → no-op (use the Fit button / Home for fit-all, so a stray double-click can't
|
|
@@ -1802,7 +1823,7 @@ function refreshDims() {
|
|
|
1802
1823
|
if (dims3dVisibleFlag) {
|
|
1803
1824
|
for (const d of dims) {
|
|
1804
1825
|
if (dimHiddenByIsolation(d)) continue; // isolated away → no line (the label is hidden in syncDimLabels)
|
|
1805
|
-
const g = dim3dGeom(d.a, d.b, d.axis);
|
|
1826
|
+
const g = dim3dGeom(d.a, d.b, d.axis, d.axisDir); // placed dims render from their STORED axisDir (frame-independent), not the live frame
|
|
1806
1827
|
const col = sel.has(d.id) ? 0xf59e0b : 0x67e8f9; // amber (#f59e0b) when selected, else muted cyan-300 — a quieter tint of the 0x22d3ee preview/2D-dim cyan (intentional, not a stray value)
|
|
1807
1828
|
const pts = [new THREE.Vector3(...g.p1), new THREE.Vector3(...g.p2), ...dimTicks(g.p1, g.p2)]; // the dim line + a 45° tick at each end
|
|
1808
1829
|
const line = new THREE.LineSegments(new THREE.BufferGeometry().setFromPoints(pts), new THREE.LineBasicMaterial({ color: col }));
|
|
@@ -1825,7 +1846,7 @@ function syncDimLabels(dims) {
|
|
|
1825
1846
|
const el = dimLabelPool[i], d = dims[i];
|
|
1826
1847
|
if (!d || !dims3dVisibleFlag || dimHiddenByIsolation(d)) { el.style.display = 'none'; el._dimId = null; el._mid = null; continue; } // isolated-away dims hide their label too
|
|
1827
1848
|
el._dimId = d.id;
|
|
1828
|
-
const g = dim3dGeom(d.a, d.b, d.axis);
|
|
1849
|
+
const g = dim3dGeom(d.a, d.b, d.axis, d.axisDir);
|
|
1829
1850
|
el.textContent = api.fmtLen ? api.fmtLen(g.valueMm) : (g.valueMm / 304.8).toFixed(2) + ' ft';
|
|
1830
1851
|
const seld = selSet.has(d.id);
|
|
1831
1852
|
el.style.borderColor = seld ? '#f59e0b' : 'var(--line,#1e293b)';
|
|
@@ -2381,7 +2402,7 @@ function frameInfo() {
|
|
|
2381
2402
|
}
|
|
2382
2403
|
return { mode: 'global' };
|
|
2383
2404
|
}
|
|
2384
|
-
function fireFrameChange() { invalidatePointEntry('drift'); if (!(pending && pending.frameDrag)) { tfCandidates = null; dimCandidates3d = null; } renderWorkPlane(); } // re-draws the gizmo + reference plane + fires the Axes chip; invalidates the typed HUD (drift) + the snap caches so the UCS-origin snap follows the frame — but NOT during a live origin drag (the drag's own snap cache, which excludes the origin, stays efficient)
|
|
2405
|
+
function fireFrameChange() { invalidatePointEntry('drift'); if (!(pending && pending.frameDrag)) { tfCandidates = null; dimCandidates3d = null; } renderWorkPlane(); reflectDimAxisBar(); } // re-draws the gizmo + reference plane + fires the Axes chip; relabels the dim-axis bar (X′/Y′/Elev follows the frame); invalidates the typed HUD (drift) + the snap caches so the UCS-origin snap follows the frame — but NOT during a live origin drag (the drag's own snap cache, which excludes the origin, stays efficient)
|
|
2385
2406
|
// Set a HORIZONTAL frame at origin (numeric entry + gizmo materialize). origin defaults its Z to the active level.
|
|
2386
2407
|
function setFrame3d(originMm, angleDeg) {
|
|
2387
2408
|
const z = (originMm && originMm.length > 2) ? originMm[2] : frameZ();
|
|
@@ -2627,7 +2648,7 @@ function renderWorkPlane() {
|
|
|
2627
2648
|
}
|
|
2628
2649
|
function reflectWpBar() { const b = document.getElementById('m3dWp'); if (b) { b.classList.toggle('on', !!wpMode || !!workPlane);
|
|
2629
2650
|
const kind = workPlane && workPlane.kind ? { face: 'Face', p3: '3pt', xy: 'XY', xz: 'XZ', yz: 'YZ' }[workPlane.kind] || '' : '';
|
|
2630
|
-
b.textContent = wpMode ? '◇ Plane ✕' : (kind ? '◇ Plane: ' + kind + ' ▾' : '◇ Plane ▾'); } } // the label reads the active plane without opening the menu (ux review)
|
|
2651
|
+
b.textContent = wpMode ? '◇ Plane ✕' : (kind ? '◇ Plane: ' + kind + ' ▾' : '◇ Plane ▾'); } reflectDimAxisBar(); } // the label reads the active plane without opening the menu (ux review); relabel the dim-axis bar (a set/cleared plane flips X/Y between World and local)
|
|
2631
2652
|
function armWorkPlanePick(mode) { if (wpMode === mode) { wpMode = null; wpDraft = null; } else { wpMode = mode; wpDraft = null; if (dimMode3d) toggleDimTool(); if (api && api.disarmTransform) api.disarmTransform(); if (api && api.disarmAdd) api.disarmAdd(); cmClear3d(); drClear3d(); disarmFrame3d(); } marker.visible = false; canvasEl.style.cursor = wpMode ? 'crosshair' : 'default'; reflectWpBar(); } // a set-plane pick shares the left-click — disarm Move/Copy + Add + the local frame (their onDown routes run first)
|
|
2632
2653
|
function setWorkPlanePrincipal(kind, offsetMm) {
|
|
2633
2654
|
const off = offsetMm || 0;
|
|
@@ -3011,6 +3032,13 @@ function gridPlaneZ() {
|
|
|
3011
3032
|
// The axis to measure on: Alt held during the 2nd pick forces a pure-vertical (Z) measurement,
|
|
3012
3033
|
// overriding the sticky axis (else a sticky X/Y would collapse the Alt-locked point to zero length).
|
|
3013
3034
|
function dimEffectiveAxis(alt) { return alt && dimDraft3d ? 'z' : dimAxis3d; }
|
|
3035
|
+
// UCS Stage 5: the world direction a frame-aware x|y dim measures along — the LOCAL frame's X/Y, captured at
|
|
3036
|
+
// placement so the dim survives frame changes/reset/reload. null when: no local frame; a ◇ Plane shadows the frame
|
|
3037
|
+
// (dims go global under a plane — never a SHADOWED frame3d, matching the chip/gizmo); or axis is z/free (world).
|
|
3038
|
+
function dimAxisDir(axis) {
|
|
3039
|
+
if (!frame3d || workPlane) return null;
|
|
3040
|
+
return axis === 'x' ? [...frame3d.xAxis] : axis === 'y' ? [...frame3d.yAxis] : null;
|
|
3041
|
+
}
|
|
3014
3042
|
|
|
3015
3043
|
function onDown(e) {
|
|
3016
3044
|
if (readout) { readout.style.display = 'none'; if (readout._coord) readout._coord.style.display = 'none'; } // UCS Stage 2: hide the whole readout chip so a drag never shows a lingering coordinate (or an empty coord-only shell); the drag/next hover re-shows it
|
|
@@ -3045,10 +3073,11 @@ function onDown(e) {
|
|
|
3045
3073
|
const r = dimPointAt(e, dimDraft3d && dimDraft3d.a); if (!r) return;
|
|
3046
3074
|
if (!dimDraft3d) { dimDraft3d = { a: r.p }; dimCandidates3d = null; }
|
|
3047
3075
|
else {
|
|
3048
|
-
const a = dimDraft3d.a, b = r.p, axis = dimEffectiveAxis(e.altKey);
|
|
3049
|
-
const g = dim3dGeom(a, b, axis);
|
|
3076
|
+
const a = dimDraft3d.a, b = r.p, axis = dimEffectiveAxis(e.altKey), axisDir = dimAxisDir(axis);
|
|
3077
|
+
const g = dim3dGeom(a, b, axis, axisDir);
|
|
3050
3078
|
dimDraft3d = null; dimPreviewLine.visible = false; marker.visible = false; readout.style.display = 'none'; dimCandidates3d = null;
|
|
3051
|
-
if (g.valueMm > 1 && api && api.onAddDim3d) api.onAddDim3d({ id: api.newDim3dId(), a, b, axis });
|
|
3079
|
+
if (g.valueMm > 1 && api && api.onAddDim3d) api.onAddDim3d({ id: api.newDim3dId(), a, b, axis, ...(axisDir ? { axisDir } : {}) });
|
|
3080
|
+
else if (g.valueMm <= 1 && axis !== 'free') { dimDraft3d = { a }; if (api && api.toast) api.toast('No length along the locked axis — move the second point or switch axis'); } // any AXIS-LOCKED projection (world X/Y/Z/Elev or local X′/Y′) collapsed to ~0 despite a real 2nd pick — e.g. two points at the same level with Z / Alt-vertical → keep the first anchor + explain, don't silently drop the pick. A coincident 'free' double-click stays a silent no-op.
|
|
3052
3081
|
}
|
|
3053
3082
|
return;
|
|
3054
3083
|
}
|
|
@@ -3422,7 +3451,8 @@ function onHoverMove(e) {
|
|
|
3422
3451
|
if (snapped) showMarker(r.p, r.type); else marker.visible = false; // reticle only on a real snap (free point rides the preview line) — parity with 2D snapClear
|
|
3423
3452
|
canvasEl.style.cursor = snapped ? 'none' : 'crosshair'; // at a snap the reticle IS the cursor (Tekla) — hide the native crosshair so it doesn't double up on the marker
|
|
3424
3453
|
if (dimDraft3d && r) {
|
|
3425
|
-
const
|
|
3454
|
+
const ax = dimEffectiveAxis(dimLastAlt);
|
|
3455
|
+
const g = dim3dGeom(dimDraft3d.a, r.p, ax, dimAxisDir(ax)); // live preview matches what the commit will store
|
|
3426
3456
|
dimPreviewLine.geometry.setFromPoints([new THREE.Vector3(...g.p1), new THREE.Vector3(...g.p2)]); dimPreviewLine.visible = true;
|
|
3427
3457
|
readout._dist.textContent = api.fmtLen ? api.fmtLen(g.valueMm) : (g.valueMm / 304.8).toFixed(2) + ' ft';
|
|
3428
3458
|
readout._type.textContent = r.type ? ' · ' + r.type : (dimLastAlt ? ' ↕' : '');
|
|
@@ -3637,6 +3667,8 @@ window.Steel3DView = {
|
|
|
3637
3667
|
overlayDimsInfo: () => computeOverlayDims().map((s) => ({ label: s.label, cat: s.cat })), // the dims currently emitted (toggle + visibility applied) — for tests
|
|
3638
3668
|
overlayLabelTexts: () => overlayLabelPool.filter((el) => el.style.display !== 'none' && el.style.visibility !== 'hidden').map((el) => el.textContent),
|
|
3639
3669
|
dims3dCount: () => (api && api.getDims3d ? (api.getDims3d() || []).length : 0),
|
|
3670
|
+
dims3dRecords: () => (api && api.getDims3d ? (api.getDims3d() || []).map((d) => ({ id: d.id, axis: d.axis, axisDir: d.axisDir || null, valueMm: dim3dGeom(d.a, d.b, d.axis, d.axisDir).valueMm })) : []), // test probe: lightweight per-dim {axis, axisDir, rendered length} for E2E assertions (frame-aware capture + read==write)
|
|
3671
|
+
dimAxisBarLabels: () => Array.from(document.querySelectorAll('#m3dDimAxis button')).map((b) => b.textContent), // test probe: the visible axis-control labels (3-state disclosure)
|
|
3640
3672
|
selDims3dCount: () => (api && api.selDim3d ? (api.selDim3d() || []).length : 0), // test helper: how many 3D dims are selected
|
|
3641
3673
|
dim3dLabelOf: (i) => { const el = dimLabelPool[i]; if (!el || el.style.display === 'none') return null; const r = el.getBoundingClientRect(); return { x: r.left + r.width / 2, y: r.top + r.height / 2, text: el.textContent }; },
|
|
3642
3674
|
debug, probe, screenOf, centerOf, worldOf, snapCandidatesScreen, clipHandlesScreen,
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
.seg-group{display:inline-flex;border:1px solid #475569;border-radius:6px;overflow:hidden}
|
|
21
21
|
.seg-group button{border:0;border-radius:0;border-right:1px solid #475569}
|
|
22
22
|
.seg-group button:last-child{border-right:0}
|
|
23
|
+
#m3dDimAxis button{min-width:5.2em;white-space:nowrap;text-align:center} /* UCS Stage 5: min-width holds the longest label ("World X") so relabeling X→X′→World X across frame states keeps every segment — and the group's total width — constant (no header-cluster jitter) */
|
|
23
24
|
main{flex:1;display:flex;min-height:0}
|
|
24
25
|
#stagewrap{flex:1;position:relative;min-width:0;display:flex}
|
|
25
26
|
#stage{flex:1;overflow:auto;background:#0b1220;display:flex;align-items:safe center;justify-content:safe center}
|
|
@@ -729,7 +730,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
729
730
|
<button id=dimB data-tip="Dimension tool (D) — click two snapped points, then a third to place. Default Free (aligned); hold Shift to lock to an axis, X/Y force horizontal/vertical, F free. Right-click the canvas to restrict snapping to one type.">⊢ Dimension</button>
|
|
730
731
|
<!-- 3D Dimension cluster — relocated here from the 3D toolbar so Dimension has ONE home; shown only in 3D (applyViewState). Same ids so steel-3d-view.js reflectDimBar() still drives it. -->
|
|
731
732
|
<span id=dim3dWrap style="display:none;align-items:center;gap:8px">
|
|
732
|
-
<button id=m3dDim data-tip="Measure in 3D — click two snapped points (D); axis
|
|
733
|
+
<button id=m3dDim data-tip="Measure in 3D — click two snapped points (D); the axis buttons follow the active coordinate frame (X′/Y′/Elev local, World X/Y under a ◇ Plane); Alt = vertical; right-click = restrict snap">⊢ Dimension</button>
|
|
733
734
|
<div class=seg-group id=m3dDimAxis style="display:none"><button data-d3axis=free class=on data-tip="Free 3D measurement (F)">Free</button><button data-d3axis=x data-tip="Lock measurement to X (X)">X</button><button data-d3axis=y data-tip="Lock measurement to Y (Y)">Y</button><button data-d3axis=z data-tip="Lock to Z / vertical (Z); Alt = quick vertical">Z</button></div>
|
|
734
735
|
<button id=m3dDimShow data-tip="Show or hide placed 3D dimensions" style="display:none">Hide dims</button>
|
|
735
736
|
</span>
|
|
@@ -1044,6 +1045,7 @@ const APP_ID = new URLSearchParams(location.search).get('app') || '';
|
|
|
1044
1045
|
const PROJECT = new URLSearchParams(location.search).get('project') || '';
|
|
1045
1046
|
const PROJECT_QS = PROJECT ? ('?project=' + encodeURIComponent(PROJECT)) : '';
|
|
1046
1047
|
let C, PAL, WT;
|
|
1048
|
+
let SteelCore = null; // steel-3d-core.js module namespace — boot() awaits its dynamic import before main() so the classic script can call its pure helpers (sanitizeDims3d) at load
|
|
1047
1049
|
let TARGET_CONF = null; // the app's target_confidence input default (%), or null when undeclared — drives the chip's "· target N%" goal
|
|
1048
1050
|
let view3d = false, view3dReady = false; // 2D|3D toggle state; view3dReady once Steel3DView.init has run
|
|
1049
1051
|
// Fallback palette (colorFor indexes this array by profile order) when a contract ships no `palette`
|
|
@@ -1063,6 +1065,7 @@ function showEmpty(icon, headline, bodyText, appIdText) {
|
|
|
1063
1065
|
}
|
|
1064
1066
|
async function boot() {
|
|
1065
1067
|
if (!APP_ID) { showEmpty('⊞', 'No workflow selected', 'Open a workflow in the FloLess canvas, then open the contract editor from that workflow’s node.'); return; }
|
|
1068
|
+
SteelCore = await import('./steel-3d-core.js'); // await BEFORE main()/restoreSaved() so the mandatory dims3d sanitizer is loaded (no deferred-module race — a passive window shim could be undefined here)
|
|
1066
1069
|
const res = await fetch('/api/contract/' + encodeURIComponent(APP_ID) + PROJECT_QS);
|
|
1067
1070
|
if (!res.ok) {
|
|
1068
1071
|
if (res.status === 404) {
|
|
@@ -1517,7 +1520,7 @@ function restoreSaved(){try{const raw=localStorage.getItem(LSKEY);if(!raw)return
|
|
|
1517
1520
|
if(Array.isArray(d.member_types))C.member_types=sanitizeMemberTypes(d.member_types);
|
|
1518
1521
|
if(d.target_confidence!=null)C.target_confidence=d.target_confidence;
|
|
1519
1522
|
C.plans.forEach(p=>{const s=by[p.sheet];if(s){if(Array.isArray(s.members))p.members=s.members;if(s.default_tos!=null)p.default_tos=s.default_tos;if(Array.isArray(s.details))p.details=s.details;if(Array.isArray(s.dims))p.dims=s.dims;if('frame' in s)p.frame=s.frame||null;if('grid' in s)p.grid=s.grid||null;p.autofilled=true;}});
|
|
1520
|
-
if(Array.isArray(d.dims3d))C.dims3d=d.dims3d; // restore model-global 3D dims from the local draft
|
|
1523
|
+
if(Array.isArray(d.dims3d))C.dims3d=SteelCore?SteelCore.sanitizeDims3d(d.dims3d):d.dims3d; // restore model-global 3D dims from the local draft — re-sanitise axisDir (a stale draft could carry junk that would wedge the next save)
|
|
1521
1524
|
if(Array.isArray(d.detail_placements))C.detail_placements=d.detail_placements; // restore placed details
|
|
1522
1525
|
if(d.dim_overlays&&typeof d.dim_overlays==='object'&&!Array.isArray(d.dim_overlays)){const o=d.dim_overlays;C.dim_overlays={bolt_pitch:o.bolt_pitch!==false,edge_clearance:o.edge_clearance!==false,cope_size:o.cope_size!==false,base_plate:o.base_plate!==false,anchor_depth:o.anchor_depth!==false};} // restore the legend DIMENSIONS toggles — sanitised to the known boolean keys (a corrupt/partial draft can't desync the legend from what's drawn; on unless explicitly false)
|
|
1523
1526
|
if('dim_style' in d){C.dim_style=d.dim_style;sanitizeDimStyle();} // restore the model-global dimension-style defaults — sanitised to the three known keys
|
|
@@ -3166,6 +3169,7 @@ function sanitizePropLabels(x){const o=(x&&typeof x==='object'&&!Array.isArray(x
|
|
|
3166
3169
|
ids:Array.isArray(o.ids)?o.ids.filter(v=>typeof v==='string'):[]};}
|
|
3167
3170
|
C.prop_labels=sanitizePropLabels(C.prop_labels); // normalise the contract's incoming value now (PROP_KEYS is initialised above; runs before main's bootstrap render + restoreSaved override)
|
|
3168
3171
|
C.views=sanitizeViews(C.views); // normalise the incoming saved views now — inside main() where sanitizeViews is in scope (boot() only guaranteed an array); runs before the bootstrap render + restoreSaved override, same pattern as prop_labels above
|
|
3172
|
+
if(SteelCore)C.dims3d=SteelCore.sanitizeDims3d(C.dims3d); // UCS Stage 5: canonicalise each 3D dim's axisDir (drop junk / normalise non-unit) so a bad value can't wedge the schema-validated save — the SERVER contract copy; restoreSaved re-sanitises the localStorage draft below
|
|
3169
3173
|
// the "Label: value" lines a member contributes for the currently-checked props (registry order; skips N/A + empty)
|
|
3170
3174
|
function propLabelLinesFor(m){const pl=C.prop_labels;if(!pl||!pl.props.length)return [];ensureMeta(m);
|
|
3171
3175
|
const out=[];for(const def of PROP_DEFS){if(!pl.props.includes(def.key))continue;const raw=def.get(m);if(raw===undefined)continue;const t=def.fmt(raw);if(t==='')continue;out.push(def.label+': '+t);}return out;}
|