← Commit history

Fix blank interactive viewer on the wiki embed - his frameModel mis-frames here (it framed the 5000-unit skybox, leaving the camera at radius ~2500m so the 3mm part was a sub-pixel dot); set an explicit mm-scale camera per mode (Static and Pick-and-Place).

AravK ·3eadc0da68 ·3mo ago ·parent efe8333
1 file changed +14−2
IN-S42ATR-viewer.html+14−2
@@ -202,6 +202,18 @@   });   const lockLayer = (key,locked)=>{ rows[key].row.classList.toggle('disabled',locked); rows[key].cb.disabled=locked; }; +  // His frameModel() mis-frames in this embed (it framed the 5000-unit skybox → camera at+  // radius ~2500 m, so the ~3mm part is a sub-pixel dot). Run it for its spotlight/ground+  // positioning, then set a sane mm-scale camera explicitly.+  function applyFrame(mode){+    try { viewer.frameModel(); } catch (e) {}+    const c = scene.activeCamera;+    c.lowerRadiusLimit = 0.0015; c.upperRadiusLimit = 0.08; c.minZ = 0.00005; c.maxZ = 10;+    c.alpha = 1.05; c.beta = 1.0;+    if (mode === 'pnp') { c.target.copyFromFloats(0.0034, 0, 0.0011); c.radius = 0.019; }+    else { c.target.copyFromFloats(0, 0, -0.0002); c.radius = 0.0065; }+  }+   // 6) Mode switching — ghosts are a content root only in P&P (so Static frames just the part).   let mode = 'static';   function setMode(m){@@ -215,14 +227,14 @@       if (led) setNodeEnabled(led, true);       if (ledLit) setNodeEnabled(ledLit, state.light); if (ptLight) ptLight.setEnabled(state.light);       if (fovCone) setNodeEnabled(fovCone, state.fov);-      viewer.frameModel();+      applyFrame(m);       statusEl.textContent = 'STATIC · LED insertion (up/down) · toggle Light & FOV in Layers';     } else {       setNodeEnabled(ghostRoot, true); viewer.addContentRoot(ghostRoot, { castShadows:false, receiveShadows:false });       if (ledLit) setNodeEnabled(ledLit, false); if (fovCone) setNodeEnabled(fovCone, false); if (ptLight) ptLight.setEnabled(false);       lockLayer('light',true); lockLayer('fov',true);       if (led) setNodeEnabled(led, true);-      viewer.frameModel();+      applyFrame(m);       statusEl.textContent = 'PICK & PLACE · nozzle picks LED from tape → places on pads';     }   }