@floless/app 0.93.0 → 0.93.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.
@@ -53106,7 +53106,7 @@ function appVersion() {
53106
53106
  return resolveVersion({
53107
53107
  isSea: isSea2(),
53108
53108
  sqVersionXml: readSqVersionXml(),
53109
- define: true ? "0.93.0" : void 0,
53109
+ define: true ? "0.93.1" : 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.93.0" : void 0 });
53119
+ return resolveChannel({ isSea: isSea2(), define: true ? "0.93.1" : void 0 });
53120
53120
  }
53121
53121
 
53122
53122
  // workflow-update.ts
@@ -113,7 +113,7 @@ export function snapElevation(z, levels, tol) {
113
113
 
114
114
  // Lower wins when two candidates are both within tolerance. Grid intersections rank with member
115
115
  // intersections (columns land on them); grid lines below member centerlines.
116
- const PRECEDENCE = { vertex: 0, intersection: 1, 'grid-int': 1, midpoint: 2, centerline: 3, 'vertical-axis': 4, 'grid-line': 5, level: 1 };
116
+ const PRECEDENCE = { origin: 0, vertex: 0, intersection: 1, 'grid-int': 1, midpoint: 2, centerline: 3, 'vertical-axis': 4, 'grid-line': 5, level: 1 }; // origin = the local UCS origin, ties with a vertex (a deliberate reference point)
117
117
 
118
118
  function closestOnSeg(p, a, b) {
119
119
  const ab = [b[0] - a[0], b[1] - a[1], b[2] - a[2]];
@@ -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') return c.p; // fixed points
128
+ if (c.type === 'vertex' || c.type === 'intersection' || c.type === 'midpoint' || c.type === 'level' || c.type === 'origin') return c.p; // fixed points
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]]; }
@@ -605,6 +605,7 @@ function buildFromScene(sc) {
605
605
  box.expandByObject(mesh);
606
606
  }
607
607
  sceneBox = box.clone();
608
+ renderWorkPlane(); // re-draw the gizmo + reference plane sized to the (possibly new) model bounds
608
609
  // Retain the dim-relevant parts (plates + copes) so the legend's DIMENSIONS overlays can be derived
609
610
  // from the resolved geometry — fin-plate holes give bolt pitch/edge clearance, cuts give cope size.
610
611
  // (computeOverlayDims scopes the plate path to group 'shear-plate' — base/washer plates are skipped there.)
@@ -627,15 +628,8 @@ let sceneGroups = [];
627
628
  // opacity — no white grid (per the baseline). Rebuilt with the model so it always fits.
628
629
  function buildGrid(box) {
629
630
  if (grid) { scene.remove(grid); grid.geometry.dispose(); grid.material.dispose(); grid = null; }
630
- if (box.isEmpty()) return;
631
- const size = box.getSize(new THREE.Vector3());
632
- const span = Math.max(size.x, size.y) * 1.6 || 5000;
633
- grid = new THREE.GridHelper(span, 24, 0x1e293b, 0x1e293b); // --line (slate-800)
634
- grid.material.transparent = true; grid.material.opacity = 0.35;
635
- grid.rotation.x = Math.PI / 2; // GridHelper is XZ by default → rotate to XY for Z-up
636
- const c = box.getCenter(new THREE.Vector3());
637
- grid.position.set(c.x, c.y, box.min.z); // ground at the lowest member
638
- scene.add(grid);
631
+ // Default 3D floor grid disabled (Pawel 2026-07-13): the plan grid (buildStructGrid — our own grid object)
632
+ // is the ground reference, so the built-in GridHelper is redundant clutter.
639
633
  }
640
634
 
641
635
  // Optional reference lines: the work-line (between the two end dots) of every member — the centreline
@@ -877,6 +871,7 @@ const gridTexCache = new Map(); // 'b:LABEL' bubble / 't:LABEL' tag -> CanvasTex
877
871
 
878
872
  function allCandidates(excludeId) {
879
873
  const base = snapCandidates(members(), api.ptPerFt(), api.defaultTosMm(), excludeId);
874
+ if (frame3d && !(pending && pending.frameDrag)) base.push({ type: 'origin', p: [...frame3d.origin], fromId: 'ucs-origin' }); // the local UCS origin is a snap target for every tool (Move/Copy, Add, Dimension); excluded while dragging the origin itself → no self-snap
880
875
  try { return base.concat(gridCandidates3d(api.getGrid ? api.getGrid() : null, api.ptPerFt())); }
881
876
  catch { return base; } // a malformed hand-edited grid must never break member dragging
882
877
  }
@@ -1284,7 +1279,7 @@ function setClipState(s) {
1284
1279
  else workArea = null;
1285
1280
  selectedClipIds = new Set(s.selected || []);
1286
1281
  if (typeof s.seq === 'number') clipSeq = Math.max(clipSeq, s.seq);
1287
- applyClips(); renderClipGizmo(); renderWorkArea(); refreshWorkAreaVis();
1282
+ applyClips(); renderClipGizmo(); renderWorkArea(); refreshWorkAreaVis(); renderWorkPlane();
1288
1283
  if (api && api.onClipsChange) api.onClipsChange();
1289
1284
  if (api && api.onWorkAreaChange) api.onWorkAreaChange(workAreaState()); // undo/redo of a work-area edit must resync the Work-area button + its sliders, not just the model
1290
1285
  }
@@ -1466,7 +1461,7 @@ function setWorkAreaBox(box) {
1466
1461
  if (api && api.beginClipEdit) api.beginClipEdit(); // undoable
1467
1462
  const whole = workArea ? workArea.whole : true; // keep the current cut/whole mode across a re-define; a brand-new work area defaults to "show whole parts" (no surprise slicing)
1468
1463
  workArea = { enabled: true, whole, planes: boxToPlanes(box), box: box.clone() };
1469
- applyClips(); renderWorkArea(); refreshWorkAreaVis();
1464
+ applyClips(); renderWorkArea(); refreshWorkAreaVis(); renderWorkPlane();
1470
1465
  if (api && api.onWorkAreaChange) api.onWorkAreaChange(workAreaState());
1471
1466
  return true;
1472
1467
  }
@@ -1479,7 +1474,7 @@ function workAreaToggle(on) {
1479
1474
  if (!workArea) return on === false ? false : workAreaSetAll(); // first toggle-on with no box → bound the whole model
1480
1475
  if (api && api.beginClipEdit) api.beginClipEdit(); // undoable
1481
1476
  workArea.enabled = on === undefined ? !workArea.enabled : !!on;
1482
- applyClips(); renderWorkArea(); refreshWorkAreaVis();
1477
+ applyClips(); renderWorkArea(); refreshWorkAreaVis(); renderWorkPlane();
1483
1478
  if (api && api.onWorkAreaChange) api.onWorkAreaChange(workAreaState());
1484
1479
  return workArea.enabled;
1485
1480
  }
@@ -1493,7 +1488,7 @@ function workAreaSetWhole(on) {
1493
1488
  if (api && api.onWorkAreaChange) api.onWorkAreaChange(workAreaState());
1494
1489
  return workArea.whole;
1495
1490
  }
1496
- function clearWorkArea() { if (api && api.beginClipEdit && workArea) api.beginClipEdit(); workArea = null; applyClips(); renderWorkArea(); refreshWorkAreaVis(); if (api && api.onWorkAreaChange) api.onWorkAreaChange(null); }
1491
+ function clearWorkArea() { if (api && api.beginClipEdit && workArea) api.beginClipEdit(); workArea = null; applyClips(); renderWorkArea(); refreshWorkAreaVis(); renderWorkPlane(); if (api && api.onWorkAreaChange) api.onWorkAreaChange(null); }
1497
1492
  function workAreaState() { return workArea ? { on: workArea.enabled, whole: !!workArea.whole } : null; }
1498
1493
  // The camera viewpoint as plain data — position + orbit target + projection + the ortho frustum half-height
1499
1494
  // and zoom. A saved view restores it via setCameraState. (perspCam/orthoCam share position; orthoBaseH+zoom
@@ -1557,6 +1552,7 @@ function onKey(e) {
1557
1552
  if (pending && pending.clipDrag && e.key === 'Escape') { e.preventDefault(); const p = pending; if (p.plane) p.clip.point = p.prePoint; else p.clip.box.copy(p.preBox); rebuildClipPlanes(p.clip); applyClips(); renderClipGizmo(); pending = dragging = null; if (controls) controls.enabled = true; if (readout) readout.style.display = 'none'; return; } // Esc mid-drag → undo the handle move
1558
1553
  if (framePicking() && e.key === 'Escape') { e.preventDefault(); if (frame3d) { cancelFramePick(); fireFrameChange(); } else armFrame3d(false); return; } // Esc cancels the whole 3-click pick (discards partial clicks); no prior frame → also exit the tool
1559
1554
  if (pending && pending.frameDrag && e.key === 'Escape') { e.preventDefault(); if (frame3d && pending.preFrame) frame3d = cloneFrame(pending.preFrame); pending = dragging = null; if (controls) controls.enabled = true; if (readout) readout.style.display = 'none'; fireFrameChange(); return; } // Esc mid-drag → revert the frame to its pre-drag basis
1555
+ if (frameMode && e.key === 'Escape' && !pending) { e.preventDefault(); disarmFrame3d(); return; } // armed but idle (frame set, gizmo grabbable for refine) → Esc exits the "Set local axes" tool (the frame stays; it just stops being editable). `!pending` so a mid-gesture Esc (member move / endpoint stretch, reachable while the tool is armed) still falls through to the cancel-and-revert below instead of silently committing (code-review) (frame set, gizmo grabbable for refine) → Esc exits the "Set local axes" tool (the frame stays; it just stops being editable). `!pending` so a mid-gesture Esc (member move / endpoint stretch, reachable while the tool is armed) still falls through to the cancel-and-revert below instead of silently committing (code-review)
1560
1556
  if (pending && e.key === 'Escape' && (pending.epDrag || pending.origMm)) { // Esc mid-drag → cancel a member move / endpoint stretch and revert to the pre-drag state (no commit)
1561
1557
  e.preventDefault();
1562
1558
  if (pending.mesh && pending.meshPos0) pending.mesh.position.copy(pending.meshPos0); // put a live-moved (or Alt-vertical) member mesh back
@@ -2329,7 +2325,7 @@ function frameInfo() {
2329
2325
  }
2330
2326
  return { mode: 'global' };
2331
2327
  }
2332
- function fireFrameChange() { invalidatePointEntry('drift'); renderFrameGizmo(); if (api && api.onFrame3dChange) api.onFrame3dChange(frameInfo()); } // a frame change re-bases typed entry → invalidate any open HUD (drift)
2328
+ 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)
2333
2329
  // Set a HORIZONTAL frame at origin (numeric entry + gizmo materialize). origin defaults its Z to the active level.
2334
2330
  function setFrame3d(originMm, angleDeg) {
2335
2331
  const z = (originMm && originMm.length > 2) ? originMm[2] : frameZ();
@@ -2367,16 +2363,12 @@ let frameGizmo = null;
2367
2363
  function disposeFrameGizmo() { if (!frameGizmo) return; if (overlayScene) overlayScene.remove(frameGizmo); frameGizmo.traverse((o) => { if (o.geometry) o.geometry.dispose(); if (o.material) o.material.dispose(); }); frameGizmo = null; }
2368
2364
  function renderFrameGizmo() {
2369
2365
  disposeFrameGizmo();
2370
- if (!overlayScene || workPlane) return; // ◇ Plane shadows the frame → renderWorkPlane draws instead
2371
- const act = !!frame3d, on = frameMode;
2372
- const O = frame3d ? frame3d.origin : [0, 0, api ? api.defaultTosMm() : 0];
2373
- const u = new THREE.Vector3(...(frame3d ? frame3d.xAxis : [1, 0, 0])), v = new THREE.Vector3(...(frame3d ? frame3d.yAxis : [0, 1, 0])), n = new THREE.Vector3(...(frame3d ? frame3d.normal : [0, 0, 1])); // the real basis (tilted-aware)
2366
+ if (!overlayScene) return; // ALWAYS draw the gizmo (matches the reference plane); a ◇ Plane no longer removes it
2367
+ const on = frameMode && !workPlane; // grabbable/armed only when the LOCAL frame is the active basis (a ◇ Plane is picked, not gizmo-dragged)
2368
+ const { O, u: ux, v: uy, n: uz } = refPlaneBasis(); // effective basis the tools follow: ◇ Plane > local frame > global
2369
+ const u = new THREE.Vector3(...ux), v = new THREE.Vector3(...uy), n = new THREE.Vector3(...uz);
2374
2370
  const g = new THREE.Group();
2375
- const CELL = 1524, N = 4, half = (CELL * N) / 2; // a small 4×4 @ 5ft patch (drawn in local coords, group oriented below)
2376
- const verts = []; for (let i = 0; i <= N; i++) { const o = -half + i * CELL; verts.push(o, -half, 0, o, half, 0, -half, o, 0, half, o, 0); }
2377
- const grid = new THREE.BufferGeometry(); grid.setAttribute('position', new THREE.Float32BufferAttribute(verts, 3));
2378
- g.add(new THREE.LineSegments(grid, new THREE.LineBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: act ? 0.3 : 0.14 })));
2379
- g.add(new THREE.Mesh(new THREE.PlaneGeometry(CELL * N, CELL * N), new THREE.MeshBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: act ? 0.1 : 0.05, side: THREE.DoubleSide, depthWrite: false })));
2371
+ const CELL = 1524, N = 2, half = (CELL * N) / 2; // half = axis length (5 ft). The gizmo is just axes + origin now — NO grid patch (the reference plane is the separate "Show plane").
2380
2372
  const axis = (len, col, vx, vy, vz) => { const l = new THREE.Line(new THREE.BufferGeometry().setFromPoints([new THREE.Vector3(0, 0, 0), new THREE.Vector3(vx * len, vy * len, vz * len)]), new THREE.LineBasicMaterial({ color: col, transparent: true, opacity: 0.95 })); l.renderOrder = 997; return l; };
2381
2373
  g.add(axis(half, 0xef4444, 1, 0, 0)); // local X = red
2382
2374
  g.add(axis(half, 0x22c55e, 0, 1, 0)); // local Y = green
@@ -2400,15 +2392,16 @@ function sizeFrameHandle() {
2400
2392
  for (const h of frameGizmo.children) if (h.userData && h.userData.frameHandle === 'origin') h.scale.setScalar(r);
2401
2393
  }
2402
2394
  // --- frame manipulator: grab + drag the gizmo's origin (translate) or ring (rotate about Z). Armed only. ---
2403
- const FRAME_RING_R = (1524 * 4 / 2) * 0.8; // ring radius (matches renderFrameGizmo)
2404
- function frameGizmoOrigin() { return frame3d ? frame3d.origin : [0, 0, api ? api.defaultTosMm() : 0]; }
2405
- function pickFrameHandle(cx, cy) { // → 'origin' | 'ring' | null (screen-space, like pickClipHandle)
2406
- if (!frameMode || !overlayScene || workPlane || !canvasEl) return null;
2395
+ const FRAME_RING_R = (1524 * 2 / 2) * 0.8; // ring radius (matches renderFrameGizmo's half*0.8, N=2)
2396
+ function frameGizmoOrigin() { return frame3d ? frame3d.origin : [0, 0, 0]; } // Global → true global 0,0,0
2397
+ function pickFrameHandle(cx, cy, allowPassive) { // → 'origin' | 'ring' | null (screen-space, like pickClipHandle). allowPassive: hit-test the un-armed (passive) gizmo too, for click-to-re-select.
2398
+ if ((!frameMode && !allowPassive) || !overlayScene || workPlane || !canvasEl) return null;
2407
2399
  camera.updateMatrixWorld();
2408
2400
  const rect = canvasEl.getBoundingClientRect(), px = cx - rect.left, py = cy - rect.top;
2409
2401
  const O = frameGizmoOrigin();
2410
2402
  const toS = (p) => { const w = new THREE.Vector3(p[0], p[1], p[2]).project(camera); return w.z > 1 ? null : [(w.x * 0.5 + 0.5) * rect.width, (-w.y * 0.5 + 0.5) * rect.height]; };
2411
2403
  const os = toS(O); if (os && Math.hypot(os[0] - px, os[1] - py) <= 16) return 'origin';
2404
+ if (!frameMode) return null; // passive gizmo (allowPassive re-select): only the VISIBLE origin dot is grabbable — the rotation ring isn't drawn when idle, so don't hit-test its invisible band (would steal a member click / box-select and rotate by accident) (code-review)
2412
2405
  const u = frame3d ? frame3d.xAxis : [1, 0, 0], v = frame3d ? frame3d.yAxis : [0, 1, 0]; let bestD = 12; // ring lies in the frame's X-Y plane — sample all THREE coords so a tilted ring's grab matches the drawn ring
2413
2406
  for (let i = 0; i < 48; i++) { const ph = i / 48 * Math.PI * 2, c = Math.cos(ph), s = Math.sin(ph);
2414
2407
  const ss = toS([O[0] + FRAME_RING_R * (c * u[0] + s * v[0]), O[1] + FRAME_RING_R * (c * u[1] + s * v[1]), O[2] + FRAME_RING_R * (c * u[2] + s * v[2])]);
@@ -2534,28 +2527,46 @@ function orthoLockDelta(dx, dy) {
2534
2527
  const du = dx * u[0] + dy * u[1], dv = dx * v[0] + dy * v[1];
2535
2528
  return Math.abs(du) >= Math.abs(dv) ? [du * u[0], du * u[1]] : [dv * v[0], dv * v[1]];
2536
2529
  }
2530
+ // The unified "Show plane" REFERENCE PLANE (Pawel 2026-07-13): a transparent, gridded plane that MATCHES the
2531
+ // working plane the tools actually follow — a ◇ Plane if set, else the local frame (tilted), else horizontal
2532
+ // at the global origin. Sized to the Work area (if set) else the model. The axes+origin gizmo always draws on
2533
+ // top of it (renderFrameGizmo, never shadowed). Toggled by "Show plane" (wpVisible).
2534
+ function refPlaneBasis() {
2535
+ if (workPlane) { const b = planeBasis(workPlane.normal, workPlane.xAxis); return { O: workPlane.origin, u: b.u, v: b.v, n: workPlane.normal }; }
2536
+ if (frame3d) return { O: frame3d.origin, u: frame3d.xAxis, v: frame3d.yAxis, n: frame3d.normal };
2537
+ return { O: frameGizmoOrigin(), u: [1, 0, 0], v: [0, 1, 0], n: [0, 0, 1] }; // Global → horizontal at 0,0,0
2538
+ }
2537
2539
  function renderWorkPlane() {
2538
- renderFrameGizmo(); // keep the frame gizmo in sync with the ◇ Plane (it self-guards on workPlane: hidden while a plane is set, restored when cleared) — Codex/code-review
2539
- if (api && api.onFrame3dChange) api.onFrame3dChange(frameInfo()); // and refresh the Axes chip: "Plane" when a plane is set, back to Local/Global when cleared
2540
+ renderFrameGizmo(); // the axes+origin gizmo always draws (matches the plane; never shadowed)
2541
+ if (api && api.onFrame3dChange) api.onFrame3dChange(frameInfo()); // refresh the Axes chip: "Plane" when a plane is set, back to Local/Global when cleared
2540
2542
  if (wpGroup) { scene.remove(wpGroup); wpGroup.traverse((o) => { if (o.geometry) o.geometry.dispose(); if (o.material) o.material.dispose(); }); wpGroup = null; }
2541
- if (!workPlane || !wpVisible) return; // the implicit level plane is not drawn — the 2D plan already communicates it
2542
- const wp = effectiveWP(), { u, v } = planeBasis(wp.normal, wp.xAxis);
2543
- const CELL = 1524, N = 12, half = (CELL * N) / 2; // 12 × 12 cells at 5 ft — a work patch, not an infinite plane
2543
+ if (!wpVisible || !scene) return; // "Show plane" off → no reference plane (works at Global too now, not only for a ◇ Plane)
2544
+ // Draw AT the true pick plane (effectiveWP = where a click actually lands), NOT the 0,0,0 gizmo origin.
2545
+ // For a local frame / ◇ Plane these coincide; only at Global do they differ (plane at the active level's
2546
+ // TOS, gizmo at world 0,0,0) — so the plane never lies about the work height (code-review High).
2547
+ const wp = effectiveWP(), { u, v } = planeBasis(wp.normal, wp.xAxis), O = wp.origin, n = wp.normal;
2548
+ const CELL = 1524; let span = 6096; // size to the Work area if set, else the model bbox, + a margin
2549
+ const box = (workArea && workArea.enabled && workArea.box && !workArea.box.isEmpty()) ? workArea.box : sceneBox;
2550
+ if (box && !box.isEmpty()) { // project the bbox corners onto the plane's OWN u/v so a tilted/vertical (XZ/YZ) plane spans its model in-plane, not by world X/Y (code-review)
2551
+ let uMin = Infinity, uMax = -Infinity, vMin = Infinity, vMax = -Infinity;
2552
+ for (const x of [box.min.x, box.max.x]) for (const y of [box.min.y, box.max.y]) for (const z of [box.min.z, box.max.z]) {
2553
+ const dx = x - O[0], dy = y - O[1], dz = z - O[2];
2554
+ const pu = dx * u[0] + dy * u[1] + dz * u[2], pv = dx * v[0] + dy * v[1] + dz * v[2];
2555
+ uMin = Math.min(uMin, pu); uMax = Math.max(uMax, pu); vMin = Math.min(vMin, pv); vMax = Math.max(vMax, pv);
2556
+ }
2557
+ span = Math.max(uMax - uMin, vMax - vMin, 3048) * 1.15;
2558
+ }
2559
+ const N = Math.min(160, Math.max(2, Math.ceil(span / CELL))), half = (CELL * N) / 2; // N capped: a huge (or degenerate) bbox must never allocate thousands of lines, rebuilt every frame-drag move (code-review)
2544
2560
  const g = new THREE.Group();
2545
2561
  const verts = [];
2546
2562
  for (let i = 0; i <= N; i++) { const o = -half + i * CELL; verts.push(o, -half, 0, o, half, 0, -half, o, 0, half, o, 0); }
2547
2563
  const grid = new THREE.BufferGeometry(); grid.setAttribute('position', new THREE.Float32BufferAttribute(verts, 3));
2548
- g.add(new THREE.LineSegments(grid, new THREE.LineBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: 0.28 })));
2549
- const fill = new THREE.Mesh(new THREE.PlaneGeometry(CELL * N, CELL * N), new THREE.MeshBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: 0.09, side: THREE.DoubleSide, depthWrite: false }));
2550
- g.add(fill);
2551
- const ax = new THREE.Line(new THREE.BufferGeometry().setFromPoints([new THREE.Vector3(0, 0, 0), new THREE.Vector3(half, 0, 0)]), new THREE.LineBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: 0.9 }));
2552
- ax.renderOrder = 996; g.add(ax); // the brighter ray = the plane's local X
2553
- const ay = new THREE.Line(new THREE.BufferGeometry().setFromPoints([new THREE.Vector3(0, 0, 0), new THREE.Vector3(0, half / 2, 0)]), new THREE.LineBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: 0.55 }));
2554
- ay.renderOrder = 996; g.add(ay); // the shorter, dimmer ray = local Y (tells the axes apart on a skewed plane)
2555
- const od = new THREE.Mesh(new THREE.SphereGeometry(60, 12, 8), new THREE.MeshBasicMaterial({ color: 0x3b82f6 }));
2556
- g.add(od); // origin dot
2557
- g.applyMatrix4(new THREE.Matrix4().makeBasis(new THREE.Vector3(...u), new THREE.Vector3(...v), new THREE.Vector3(...wp.normal)));
2558
- g.position.set(wp.origin[0], wp.origin[1], wp.origin[2]);
2564
+ g.add(new THREE.LineSegments(grid, new THREE.LineBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: 0.2 })));
2565
+ g.add(new THREE.Mesh(new THREE.PlaneGeometry(CELL * N, CELL * N), new THREE.MeshBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: 0.05, side: THREE.DoubleSide, depthWrite: false }))); // just a transparent plane + grid (the gizmo carries the axes)
2566
+ const edge = [new THREE.Vector3(-half, -half, 0), new THREE.Vector3(half, -half, 0), new THREE.Vector3(half, half, 0), new THREE.Vector3(-half, half, 0)];
2567
+ g.add(new THREE.LineLoop(new THREE.BufferGeometry().setFromPoints(edge), new THREE.LineBasicMaterial({ color: 0x3b82f6, transparent: true, opacity: 0.42 }))); // brighter perimeter so the plane's extent reads now that it's sized to the work-area/model (ux review)
2568
+ g.applyMatrix4(new THREE.Matrix4().makeBasis(new THREE.Vector3(...u), new THREE.Vector3(...v), new THREE.Vector3(...n)));
2569
+ g.position.set(O[0], O[1], O[2]);
2559
2570
  wpGroup = g; scene.add(g); // on `scene` (like epGroup) so rebuild() never wipes it; not in meshById → picking ignores it
2560
2571
  }
2561
2572
  function reflectWpBar() { const b = document.getElementById('m3dWp'); if (b) { b.classList.toggle('on', !!wpMode || !!workPlane);
@@ -2952,6 +2963,10 @@ function onDown(e) {
2952
2963
  if (clipMode === 'box') { e.stopPropagation(); onClipBoxClick(e); return; } // armed: 2-corner clip-box draw on the floor plane
2953
2964
  if (framePicking()) { e.stopPropagation(); controls.enabled = true; framePickClick(e); return; } // 3-click UCS set: this click collects the origin / X point / Y point
2954
2965
  if (frameMode) { let fh = null; try { fh = pickFrameHandle(e.clientX, e.clientY); } catch { fh = null; } if (fh) { e.stopPropagation(); controls.enabled = false; startFrameDrag(fh, e); return; } } // grab the local-frame origin/ring (armed) → drag it; an empty click falls through (orbit)
2966
+ if (frame3d && !frameMode && !geoMode() && !cmActive() && !addActive() && !dimMode3d && !clipMode && !wpMode && !basePickCol && !insertMode && !selectedClipIds.size) { // passive gizmo, no tool armed → clicking its origin/ring re-selects the local frame for editing (NOT reached by box-select or select-all, which only touch members)
2967
+ let fh = null; try { fh = pickFrameHandle(e.clientX, e.clientY, true); } catch { fh = null; }
2968
+ if (fh) { e.stopPropagation(); controls.enabled = false; armFrame3d(true); startFrameDrag(fh, e); return; } // re-arm the tool + grab the clicked handle so a click-drag manipulates immediately
2969
+ }
2955
2970
  if (selectedClipIds.size) { let ch = null; try { ch = pickClipHandle(e.clientX, e.clientY); } catch { ch = null; } if (ch) { e.stopPropagation(); controls.enabled = false; downXY = [e.clientX, e.clientY]; startClipDrag(ch, e); return; } } // grab a clip handle (plane dot / box face) → drag it
2956
2971
  if (dimMode3d) { // 2-click dimension placement (not a drag): pick A, then B → place
2957
2972
  e.stopPropagation(); controls.enabled = true;
@@ -3214,7 +3229,7 @@ function onUp(e) {
3214
3229
  const moved = downXY ? Math.hypot(e.clientX - downXY[0], e.clientY - downXY[1]) : Infinity; downXY = null;
3215
3230
  if (!p) return;
3216
3231
  if (p.clipDrag) return; // a clip handle drag is applied live during onMoveClip; nothing to commit on up (controls re-enabled above)
3217
- if (p.frameDrag) { if (marker) marker.visible = false; if (readout) readout.style.display = 'none'; return; } // local-frame origin/rotation is applied live during onMoveFrame; session-only, nothing to commit — clear the snap marker/readout on release
3232
+ if (p.frameDrag) { if (marker) marker.visible = false; if (readout) readout.style.display = 'none'; tfCandidates = null; dimCandidates3d = null; return; } // local-frame origin/rotation is applied live during onMoveFrame; session-only, nothing to commit — clear the snap marker/readout AND re-null the snap caches (they were rebuilt sans the UCS origin during the drag) so the next Move/Dimension snaps TO the moved origin again (code-review)
3218
3233
  if (p.epDrag) { // end-node drag → write just that endpoint's wp; a click (no drag) just selects the member
3219
3234
  if (wasDragging && p.newPt && api && api.onMoveEndpoint) { if (api.onSelect) api.onSelect(p.id, false); api.onMoveEndpoint(p.id, p.end, planPointToWp(p.newPt, p.ppf)); }
3220
3235
  else if (api && api.onSelect) api.onSelect(p.id, false);
@@ -3357,6 +3372,10 @@ function onHoverMove(e) {
3357
3372
  canvasEl.style.cursor = fh ? 'grab' : 'crosshair';
3358
3373
  return;
3359
3374
  }
3375
+ if (frame3d && !frameMode && !geoMode() && !cmActive() && !addActive() && !dimMode3d && !clipMode && !wpMode && !basePickCol && !insertMode && !selectedClipIds.size) { // hovering the PASSIVE gizmo (nothing armed) → pointer cursor hints "click to edit the local axes again"
3376
+ let fh = null; try { fh = pickFrameHandle(lastHoverXY[0], lastHoverXY[1], true); } catch { fh = null; }
3377
+ if (fh) { canvasEl.style.cursor = 'pointer'; return; }
3378
+ }
3360
3379
  if (selectedClipIds.size) { let ch = null; try { ch = pickClipHandle(lastHoverXY[0], lastHoverXY[1]); } catch { ch = null; } if (ch) { canvasEl.style.cursor = 'move'; return; } } // over a clip handle → move cursor
3361
3380
  let ep = null; try { ep = pickEndpoint(lastHoverXY[0], lastHoverXY[1]); } catch { ep = null; }
3362
3381
  if (ep) { // over an end node → ring + move cursor; keep its member's dots shown
@@ -3454,6 +3473,7 @@ function dispose() {
3454
3473
  gridTexCache.clear();
3455
3474
  clearRoot();
3456
3475
  if (workAreaHelper) { if (overlayScene) overlayScene.remove(workAreaHelper); workAreaHelper.geometry.dispose(); workAreaHelper.material.dispose(); workAreaHelper = null; }
3476
+ if (wpGroup) { if (scene) scene.remove(wpGroup); wpGroup.traverse((o) => { if (o.geometry) o.geometry.dispose(); if (o.material) o.material.dispose(); }); wpGroup = null; } // the reference plane can exist by default now → dispose it too (code-review)
3457
3477
  clearConnEnvelope(); clearClipGizmo(); setClipPreview(null); disposeFramePreview(); disposeFrameGizmo(); overlayScene = null; // dispose the frame gizmo/preview THREE resources before dropping the scene (Codex)
3458
3478
  clips = []; workArea = null; clipMode = null; selectedClipIds.clear(); clipBoxDraft = null; // clips live on the renderer; drop them with the renderer
3459
3479
  if (renderer) renderer.dispose();
@@ -31,6 +31,9 @@
31
31
  .detrow{display:flex;gap:6px;margin:2px 0}
32
32
  .detf{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0;font-size:11px;color:var(--mut)}
33
33
  .detf input{width:100%}
34
+ /* F14 definition-points: local-frame coord row — reuses the #csStat.local cyan wash (no new colour) */
35
+ .dp-local{background:rgba(34,211,238,.06);border:1px solid rgba(34,211,238,.35);border-radius:6px;padding:4px 4px 2px}
36
+ .dp-local .detf span{color:#22d3ee}
34
37
  #detOpacity{accent-color:var(--brand);flex:1;min-width:0}
35
38
  #zoombar #zPct{min-width:40px;text-align:right;color:var(--mut);font-variant-numeric:tabular-nums}
36
39
  /* Connection Component breadcrumb (Slice A) — a floating chip over the 3D canvas, same recipe as #zoombar. */
@@ -2746,6 +2749,50 @@ function panel(){
2746
2749
  <div class=row><button class=ghostw id=brSwap data-tip="Flip which end is the lower (double-arrow) end — display only, no geometry change">⇄ Swap lower ↔ higher end</button>
2747
2750
  <div class=hint style="margin:4px 0 0">Changes which end shows the double arrowhead. <b>Display only</b> — no geometry moves.</div></div>
2748
2751
  <div class=hint style="margin:8px 0 0">Split / Extend / Trim don't apply to a brace — drag an end handle to move a work point, or set the Offset above.</div>`;
2752
+ // --- Definition points (F14): the member's start/end work points in GLOBAL + current-view LOCAL coords,
2753
+ // editable. Global (ft-in): x=wpx·12/ppf, y=−wpy·12/ppf (Y-flip to world), z=this end's elevation (in).
2754
+ // LOCAL = relative to the active frame — 3D→frame3d (Steel3DView.frameInfo, mm), 2D→P.frame (planar, plan-px);
2755
+ // same view-scoped resolution updCS() uses. Typing a value moves that endpoint through the same edit() path as
2756
+ // every geometry pill (undo + 2D + 3D + autosave). Inline w2l/l2w mirror steel-3d-core (this script isn't a module).
2757
+ const _dpPpf=(P&&P.pt_per_ft>0)?P.pt_per_ft:1;
2758
+ const _dpFI=(view3d&&window.Steel3DView&&window.Steel3DView.frameInfo)?window.Steel3DView.frameInfo():null;
2759
+ const _dp3d=!!(_dpFI&&_dpFI.mode==='local'); // a 3D UCS (frame3d) is set
2760
+ const _dp2d=!!(!view3d&&P&&P.frame); // 2D local axes (P.frame) set
2761
+ // A column is a single plan point at a fixed elevation; under a TILTED 3D frame local X′/Y′ would be Z-coupled
2762
+ // (no clean 2-DOF answer), so show the column's local row only for a planar frame (2D, or a horizontal 3D UCS).
2763
+ const _dpLocal=(_dp3d||_dp2d)&&(!col||_dp2d||(_dp3d&&_dpFI.horizontal));
2764
+ const _dpZin=i=>col?(i===0?(Number.isFinite(+m.col.bos)?+m.col.bos:0):(Number.isFinite(+m.col.tos)?+m.col.tos:defaultTOS)):effEndTos(m.ends[i]);
2765
+ const _dpGlobal=i=>[m.wp[i][0]*12/_dpPpf,-m.wp[i][1]*12/_dpPpf,_dpZin(i)]; // end i → world point, inches
2766
+ const _dpToLocal=g=>{ // world-in [x,y,z] → local-in, or null
2767
+ if(_dp3d){const o=_dpFI.origin,X=_dpFI.xAxis,Y=_dpFI.yAxis,Z=_dpFI.normal,d=[g[0]*25.4-o[0],g[1]*25.4-o[1],g[2]*25.4-o[2]];
2768
+ return [(d[0]*X[0]+d[1]*X[1]+d[2]*X[2])/25.4,(d[0]*Y[0]+d[1]*Y[1]+d[2]*Y[2])/25.4,(d[0]*Z[0]+d[1]*Z[1]+d[2]*Z[2])/25.4];}
2769
+ if(_dp2d){const o=P.frame.o,u=P.frame.u,px=g[0]*_dpPpf/12,py=-g[1]*_dpPpf/12,dx=px-o[0],dy=py-o[1];
2770
+ return [(dx*u[0]+dy*u[1])*12/_dpPpf,(dx*u[1]-dy*u[0])*12/_dpPpf,g[2]];} // v=[uy,−ux]; Z′=global Z (planar frame)
2771
+ return null;};
2772
+ const _dpFromLocal=l=>{ // local-in [x,y,z] → world-in, or null
2773
+ if(_dp3d){const o=_dpFI.origin,X=_dpFI.xAxis,Y=_dpFI.yAxis,Z=_dpFI.normal,L=[l[0]*25.4,l[1]*25.4,l[2]*25.4];
2774
+ return [(o[0]+L[0]*X[0]+L[1]*Y[0]+L[2]*Z[0])/25.4,(o[1]+L[0]*X[1]+L[1]*Y[1]+L[2]*Z[1])/25.4,(o[2]+L[0]*X[2]+L[1]*Y[2]+L[2]*Z[2])/25.4];}
2775
+ if(_dp2d){const o=P.frame.o,u=P.frame.u,du=l[0]*_dpPpf/12,dv=l[1]*_dpPpf/12,px=o[0]+du*u[0]+dv*u[1],py=o[1]+du*u[1]-dv*u[0];
2776
+ return [px*12/_dpPpf,-py*12/_dpPpf,l[2]];}
2777
+ return null;};
2778
+ // Commit a new world-in point Pt=[x,y,z] to end i. Column stays plumb (both wp) and leaves BOS/TOS to the
2779
+ // Elevation section (Pt[2] unused for a column); a beam writes wp[i], and touches this end's TOS ONLY when the
2780
+ // world Z actually changed — so a plain X/Y move keeps the end following the sheet default (a local-axis edit
2781
+ // under a tilted 3D frame legitimately changes Z and DOES clear the default, which this comparison allows).
2782
+ const _dpCommit=(i,Pt)=>edit(()=>{const nx=Pt[0]*_dpPpf/12,ny=-Pt[1]*_dpPpf/12;
2783
+ if(col){m.wp[0]=[nx,ny];m.wp[1]=[nx,ny];}
2784
+ else{m.wp[i]=[nx,ny];if(Math.abs(Pt[2]-effEndTos(m.ends[i]))>1e-6){m.ends[i].tos=Pt[2];m.ends[i].tosDef=false;}}});
2785
+ const _dpAxes=col?['X','Y']:['X','Y','Z']; // a column has one plan point → X/Y only
2786
+ const _dpPH='5 3/4&quot; · 1&#39;-0 1/4&quot;';
2787
+ const _dpIn=(id,lbl,vin)=>{const v=Math.abs(vin)<1e-6?0:vin;return `<label class=detf><span>${lbl}</span><input id=${id} inputmode=decimal placeholder="${_dpPH}" value="${esc(fmtFtIn(v))}" autocomplete=off></label>`;}; // snap float-noise to 0 (no "-0"" from a local round-trip)
2788
+ const _dpBlock=(i,head)=>{const g=_dpGlobal(i),loc=_dpLocal?_dpToLocal(g):null;
2789
+ const grow=`<div class=detrow>${_dpAxes.map((ax,a)=>_dpIn('dpG_'+i+'_'+a,ax,g[a])).join('')}</div>`;
2790
+ const lrow=loc?`<div class=elab style="color:#22d3ee;margin:4px 0 0">Local frame</div><div class="detrow dp-local">${_dpAxes.map((ax,a)=>_dpIn('dpL_'+i+'_'+a,ax+'′',loc[a])).join('')}</div>`:'';
2791
+ return head+(loc?'<div class=elab style="margin:2px 0 0">Global</div>':'')+grow+lrow;};
2792
+ const defPts=`<div class=divrow><hr><span class=sect style="margin:0" data-tip="The member's start &amp; end work points in global coordinates${_dpLocal?' and the current local frame':''}. Type a value to move that end.">Definition points</span><hr></div>`
2793
+ +(col
2794
+ ? `<div class=hint style="margin:0 0 4px">A column runs plumb — one plan position; its elevation (bottom → top) is set above.</div>`+_dpBlock(0,`<div class=sect>Plan position</div>`)
2795
+ : _dpBlock(0,`<div class=sect>${dotS}Start</div>`)+`<div class=divrow><hr></div>`+_dpBlock(1,`<div class=sect>${dotE}End</div>`));
2749
2796
  p.innerHTML=`<h3>Member ${esc(m.id)}</h3>
2750
2797
  ${typeFilterHTML()}
2751
2798
  ${memberTypeField('mTypeS',[m])}
@@ -2755,6 +2802,7 @@ function panel(){
2755
2802
  <div class=row><button class=ghostw id=verifyBtn${m.verified?' style="border-color:#166534;color:#86efac"':''} data-tip="Mark this member human-confirmed → 100% in the confidence report">${m.verified?'✓ Verified — human-confirmed':'Mark verified'}</button></div>
2756
2803
  ${mfSug.length?`<div class="row" style="border:1px solid #a855f7;border-radius:6px;padding:7px 8px;background:rgba(168,85,247,.07)"><div class=elab style="color:#c4b5fd;margin:0">Moment-frame girder · ${_lvl==='roof'?'roof':'2nd floor'} (from Frames)</div><div style="display:flex;flex-wrap:wrap;gap:5px;margin-top:5px">${mfSug.map(s=>`<button class="ghost mfsug${s===m.profile?' on':''}" data-s="${esc(s)}">${esc(s)}</button>`).join('')}</div></div>`:''}
2757
2804
  ${elev}
2805
+ ${defPts}
2758
2806
  ${bpSect}${spSect}${copeSect}
2759
2807
  ${col?'':`<div class=divrow><hr><span class=sect style="margin:0" data-tip="Where the section sits on the reference line (between the end dots). Top = top-of-steel (dots on the top flange); Middle = centroid; Bottom = underside.">Profile Position <span style="opacity:.45;font-weight:400">ⓘ</span></span><hr></div>
2760
2808
  <div class=seg2 style="margin-top:0"><button id=posTop class="${pos==='top'?'on':''}">Top</button><button id=posMid class="${pos==='middle'?'on':''}">Middle</button><button id=posBot class="${pos==='bottom'?'on':''}">Bottom</button></div>`}
@@ -2852,6 +2900,20 @@ function panel(){
2852
2900
  {const ck=document.getElementById('spck_e'+e);if(ck)ck.onchange=ev=>edit(()=>{const jj=(C.joints||[]).find(x=>x&&x.id===jid);if(!jj)return;if(!jj.params)jj.params={};jj.params.stiffener=ev.target.checked;jj.source='user';});}
2853
2901
  {const rm=document.getElementById('sprm_e'+e);if(rm)rm.onclick=()=>edit(()=>{C.joints=(C.joints||[]).filter(x=>x!==j);});}} // Remove is undoable
2854
2902
  }
2903
+ // Definition points (F14) — each coord commits through edit() (undo + 2D + 3D + autosave). Enter = commit(blur),
2904
+ // Escape = revert; a non-parseable value flags the field red and doesn't commit (mirrors the grid panel's wire()).
2905
+ // stopPropagation keeps ft-in keystrokes off the global shortcut/repeat-last handler.
2906
+ {const dpWire=(id,i,a,isLocal)=>{const inp=document.getElementById(id);if(!inp)return;const orig=inp.value;
2907
+ inp.onkeydown=e=>{e.stopPropagation();if(e.key==='Enter'){e.preventDefault();inp.blur();}else if(e.key==='Escape'){e.preventDefault();inp.value=orig;inp.blur();}};
2908
+ inp.onchange=()=>{const vin=parseLen(inp.value);
2909
+ if(vin==null||!Number.isFinite(vin)){inp.style.borderColor='#fca5a5';return;} // bad parse → flag, don't commit
2910
+ inp.style.borderColor='';
2911
+ const g=_dpGlobal(i);let Pt;
2912
+ if(isLocal){const loc=_dpToLocal(g)||[0,0,0];loc[a]=vin;Pt=_dpFromLocal(loc);}
2913
+ else{Pt=g.slice();Pt[a]=vin;}
2914
+ if(Pt)_dpCommit(i,Pt);};};
2915
+ const wireEnd=i=>_dpAxes.forEach((ax,a)=>{dpWire('dpG_'+i+'_'+a,i,a,false);if(_dpLocal)dpWire('dpL_'+i+'_'+a,i,a,true);});
2916
+ wireEnd(0);if(!col)wireEnd(1);}
2855
2917
  document.getElementById('del').onclick=()=>edit(()=>{P.members=P.members.filter(x=>x.id!==m.id);selIds.clear();if(selDimIds.size){P.dims=P.dims.filter(d=>!selDimIds.has(d.id));selDimIds.clear();}}); // also drop any dims a mixed marquee selected
2856
2918
  {const vb=document.getElementById('verifyBtn');if(vb)vb.onclick=()=>edit(()=>{m.verified=!m.verified;});}
2857
2919
  }
@@ -4218,7 +4280,11 @@ document.getElementById('cpLevelB').onclick=()=>openLevelModal('copy');
4218
4280
  // member Inspector can show a read-only "Cope (auto)" note (a coped beam otherwise looks like an error).
4219
4281
  let copesByMember={}, partsById={};
4220
4282
  const view3dApi={
4221
- onFrame3dChange:()=>{updCS();if(typeof csSyncF3d==='function')csSyncF3d();}, // the 3D local frame moved/armed/reset → resync the Axes chip + the numeric fields
4283
+ onFrame3dChange:()=>{updCS();if(typeof csSyncF3d==='function')csSyncF3d();
4284
+ // F14: the Definition-points local (X′/Y′/Z′) row reads the 3D frame — refresh the inspector when the
4285
+ // frame changes outside a render() path (notably Reset-to-global, which only fires this callback). Skip
4286
+ // while the frame tool is armed (it owns the panel) and outside 3D / select mode.
4287
+ if(view3d&&mode==='sel'&&!(window.Steel3DView&&window.Steel3DView.frameArmed&&window.Steel3DView.frameArmed()))panel();}, // the 3D local frame moved/armed/reset → resync the Axes chip + the numeric fields
4222
4288
  // POST the in-progress contract so the model reflects unsaved edits; throws on a bad contract.
4223
4289
  fetchScene:async()=>{const r=await fetch('/api/contract/'+encodeURIComponent(APP_ID)+'/scene',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({contract:C})});const j=await r.json();if(!j.ok)throw new Error(j.error||'scene render failed');
4224
4290
  // The bake reports everything it could NOT emit in `skipped[]`, and we used to discard it entirely — so a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.93.0",
3
+ "version": "0.93.1",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {