← Commit history

draggable floaties (grips) + exclude ground/helper meshes from layer groups (hover was hiliting the ground)

John Lauer ·79443b742c ·3mo ago ·parent 45768b2
3 files changed +36−7
package.json+1−1
@@ -2,7 +2,7 @@   "slug": "bq25792-charger",   "title": "BQ25792 Charger",   "type": "component",-  "version": "0.1.35",+  "version": "0.1.36",   "description": "BQ25792 Charger - buck-boost 1S-4S battery charger board by Adonis, with real 3D copper traces and measured stackup.",   "tags": [     "hardware"
page.json+10−3
@@ -4,9 +4,16 @@   "slug": "bq25792-charger",   "title": "BQ25792 Charger",   "brief": "Buck-boost 1S-4S battery charger board (TI BQ25792) with 14 Adom machine pins, by Adonis",-  "version": "0.1.35",+  "version": "0.1.36",   "tags": [-    "hardware"+    "adom",+    "adom-modular",+    "component",+    "charger",+    "battery",+    "bq25792",+    "power",+    "usb-c"   ],   "license": "proprietary",   "component": {@@ -49,7 +56,7 @@     "email": "[email protected]"   },   "visibility": "public",-  "description": "BQ25792 Charger - buck-boost 1S-4S battery charger board by Adonis, with real 3D copper traces and measured stackup.",+  "description": "BQ25792 Charger - a buck-boost 1S-4S battery charger board (Texas Instruments BQ25792) designed by Adonis in Fusion 360, with 14 Adom machine pins for the modular stack. Interactive colored 3D model, schematic and layout views.",   "dependencies": {},   "files": [     "README.md",
readme.html+25−3
@@ -58,19 +58,21 @@     width:46%; background:rgba(13,17,23,0.55); backdrop-filter:blur(8px);     border:1px solid rgba(48,54,61,0.8); border-radius:10px; padding:7px 12px; }   #scrub { width:100%; accent-color:#00b8b1; }+  .grip { cursor:grab; color:#6e7681; font-weight:700; letter-spacing:1px; padding:0 6px 0 2px; user-select:none; }+  .grip:active { cursor:grabbing; } </style> </head> <body>  <div id="viewer-card">   <div id="viewer-wrap"></div>-  <div id="floaty">+  <div id="floaty"><span class="grip" title="drag">::</span>     <button class="fbtn active" id="btn-anim" type="button" title="Auto-play cascade">Animate</button>     <button class="fbtn" id="btn-assembled" type="button">Assembled</button>     <button class="fbtn" id="btn-exploded" type="button">Exploded</button>     <button class="fbtn" id="btn-fs" type="button" title="Fullscreen">Fullscreen</button>   </div>-  <div id="layers-panel"><div class="lp-title">Layers</div><div id="lp-rows"></div><div id="lp-order">order: -</div></div>+  <div id="layers-panel"><div class="lp-title"><span class="grip" title="drag">::</span> Layers</div><div id="lp-rows"></div><div id="lp-order">order: -</div></div>   <div id="scrub-wrap"><input id="scrub" type="range" min="0" max="1000" value="0"></div>   <span id="vstatus">starting viewer...</span> </div>@@ -210,7 +212,11 @@ exported bodies + design rules.</p>   const N=LAYERS.length;   LAYERS.forEach(L=>{ L.meshes=[]; L.visible=true; });   const byKey={}; LAYERS.forEach(L=>byKey[L.key]=L);-  function attach(key,meshes){ meshes.forEach(m=>{ m.__z0=m.position.z; }); byKey[key].meshes=byKey[key].meshes.concat(meshes); }+  function attach(key,meshes){+    meshes=meshes.filter(m=>!/ground|sky|env|viewcube|cube|axis|grid/i.test(m.name||""));+    meshes.forEach(m=>{ m.__z0=m.position.z; });+    byKey[key].meshes=byKey[key].meshes.concat(meshes);+  }    async function build(){     const sc=viewer.getScene();@@ -391,6 +397,22 @@ exported bodies + design rules.</p>     resumeTimer=setTimeout(function(){ mode="anim"; dir=(u>=1)?-1:1; holdT=0; setBtns(btnAnim); set("animating"); },5000);   }); +  // draggable floaties (drag by the :: grip)+  function makeDraggable(el){+    const grip=el.querySelector(".grip"); if(!grip) return;+    grip.addEventListener("pointerdown",function(e){+      e.preventDefault();+      const r=el.getBoundingClientRect(), pr=el.parentElement.getBoundingClientRect();+      el.style.left=(r.left-pr.left)+"px"; el.style.top=(r.top-pr.top)+"px"; el.style.right="auto"; el.style.bottom="auto";+      const sx=e.clientX-r.left+pr.left, sy=e.clientY-r.top+pr.top;+      function mv(ev){ el.style.left=(ev.clientX-sx)+"px"; el.style.top=(ev.clientY-sy)+"px"; }+      function up(){ document.removeEventListener("pointermove",mv); document.removeEventListener("pointerup",up); }+      document.addEventListener("pointermove",mv); document.addEventListener("pointerup",up);+    });+  }+  makeDraggable(document.getElementById("floaty"));+  makeDraggable(document.getElementById("layers-panel"));+   build().then(function(){     const sc=viewer.getScene();     let last=performance.now();