@floless/app 0.103.2 → 0.104.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.
@@ -23,7 +23,7 @@ import { gridGeometry, gridCandidates3d, mmPerPx, visibleGridLevels } from './gr
23
23
  let renderer, scene, perspCam, orthoCam, camera, controls, root, api, canvasEl, ro, rafId, grid, raycaster, downXY, lastPick = '(none)';
24
24
  let pending = null, dragging = null, marker = null, readout = null; // pending = member gesture; readout = drag dimension overlay
25
25
  let boxSel = null, rubber = null; // LEFT-drag-on-empty rubber-band multi-select
26
- let hoverId = null, hoverChip = null, hoverRAF = 0, lastHoverXY = null; // hover readout + cursor
26
+ let hoverId = null, hoverGlowIds = [], hoverChip = null, hoverRAF = 0, lastHoverXY = null; // hover readout + cursor; hoverGlowIds = every mesh currently wearing the sky glow (the WHOLE connection when hovering one of its parts)
27
27
  let epGroup = null; // yellow/magenta endpoint markers (start/end direction dots)
28
28
  let epGeom = null, epMatStart = null, epMatEnd = null; // shared across all endpoint dots (no per-rebuild churn)
29
29
  let epRing = null, epPreview = null, epMovedLine = null; // white ring on the active end node + member rubber (epPreview) + the "moved" leader (epMovedLine) while dragging an end
@@ -533,7 +533,7 @@ function clearRoot() {
533
533
  root.remove(m);
534
534
  }
535
535
  meshById.clear();
536
- hoverId = null; hoverEp = null; // the meshes are gone — drop stale hover state so the next pointermove re-glows the fresh mesh
536
+ hoverId = null; hoverGlowIds = []; hoverEp = null; // the meshes are gone — drop stale hover state so the next pointermove re-glows the fresh mesh
537
537
  }
538
538
 
539
539
  // Subtract each cope (a `cut` part) from a member's solid via CSG — a real coped beam end. Cut boxes are
@@ -1828,7 +1828,8 @@ function setSelection(ids) {
1828
1828
  selIds = new Set(set);
1829
1829
  reconcileConnState(set); // any selection path (2D click, box-select, keyboard) must not leave a stale connection envelope/drill
1830
1830
  rebuildEndpoints(); // endpoint dots follow the selection
1831
- if (hoverId != null && !set.has(hoverId)) setHoverGlow(hoverId, true); // a still-hovered, now-unselected member keeps its glow (the material swap above cleared it)
1831
+ let reglow = false; for (const g of hoverGlowIds) if (!set.has(g)) { setHoverGlow(g, true, false); reglow = true; } // still-hovered, now-unselected parts keep their glow (the material swap above cleared it)
1832
+ if (reglow) applyDisplayMode(); // one re-sync after re-lighting the whole set, not one per part
1832
1833
  updateStatusChip();
1833
1834
  }
1834
1835
  let selIds = new Set();
@@ -1843,7 +1844,7 @@ function hoverMaterial(mesh) {
1843
1844
  if (!mesh.userData._hovMat) mesh.userData._hovMat = materialFor(mesh.userData.group).clone();
1844
1845
  return mesh.userData._hovMat;
1845
1846
  }
1846
- function setHoverGlow(id, on) {
1847
+ function setHoverGlow(id, on, sync = true) {
1847
1848
  if (id == null) return;
1848
1849
  const mesh = meshById.get(id);
1849
1850
  if (!mesh || String(id).startsWith('det:')) return; // placed details use a texture, no emissive to glow
@@ -1851,15 +1852,28 @@ function setHoverGlow(id, on) {
1851
1852
  mesh.material = on ? hoverMaterial(mesh) : materialFor(mesh.userData.group);
1852
1853
  mesh.material.emissive = new THREE.Color(on ? HOVER_EMISSIVE : 0x000000);
1853
1854
  mesh.material.emissiveIntensity = on ? HOVER_INTENSITY : 0;
1854
- applyDisplayMode(); // ALWAYS re-sync after a material swap (mirrors setSelection): the swapped-in clone may have been cloned in another mode, and on clear the restored shared material can itself be stale — for a sole-profile member it stays detached while its mesh wears _hovMat, so applyDisplayMode never updated it. emissive is preserved (applyDisplayMode never touches it).
1855
- }
1856
- // Move the hover glow from the previous member to `id` (null = clear). One entry point so every
1857
- // hoverId transition stays consistent.
1855
+ if (sync) applyDisplayMode(); // ALWAYS re-sync after a material swap (mirrors setSelection): the swapped-in clone may have been cloned in another mode, and on clear the restored shared material can itself be stale — for a sole-profile member it stays detached while its mesh wears _hovMat, so applyDisplayMode never updated it. emissive is preserved (applyDisplayMode never touches it). sync=false lets a whole-connection glow batch ONE applyDisplayMode() after the loop instead of an O(meshes) sweep per part.
1856
+ }
1857
+ // The ids that glow together when `id` is hovered: the WHOLE connection's parts (so hovering any part
1858
+ // lights the entire base-plate / shear-plate as one unit — parity with whole-connection SELECTION), unless
1859
+ // we've DRILLED into that connection (ctxConn) — then only the part under the cursor glows. A bare member
1860
+ // glows alone. connOf/connChildIds are function declarations (hoisted), safe to call from here.
1861
+ function hoverGroupOf(id) {
1862
+ if (id == null) return [];
1863
+ const conn = connOf(id);
1864
+ if (conn && conn !== ctxConn) { const kids = connChildIds(conn); if (kids.length) return kids; }
1865
+ return [id];
1866
+ }
1867
+ // Move the hover glow from the previous member/connection to `id` (null = clear). One entry point so every
1868
+ // hoverId transition stays consistent. `hoverId` stays the single representative (status chip); `hoverGlowIds`
1869
+ // is the full set actually lit.
1858
1870
  function setHover(id) {
1859
1871
  if (id === hoverId) return;
1860
- setHoverGlow(hoverId, false);
1872
+ for (const g of hoverGlowIds) setHoverGlow(g, false, false);
1861
1873
  hoverId = id;
1862
- setHoverGlow(hoverId, true);
1874
+ hoverGlowIds = hoverGroupOf(id);
1875
+ for (const g of hoverGlowIds) setHoverGlow(g, true, false);
1876
+ applyDisplayMode(); // ONE material re-sync for the whole clear+relight — not an O(meshes) sweep per part (a connection can be ~26 parts)
1863
1877
  }
1864
1878
 
1865
1879
  // ---- yellow (start) / magenta (end) endpoint markers — also the drag handles ----
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.103.2",
3
+ "version": "0.104.0",
4
4
  "type": "module",
5
- "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
5
+ "description": "Thin localhost host for floless.app \u2014 serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {
7
7
  "floless-app": "bin/floless.mjs"
8
8
  },