← Commit history

readme viewer: frame appended meshes explicitly (frameModel only frames the bundle's own registry)

John Lauer ·4fddb51d34 ·3mo ago ·parent 0665431
3 files changed +22−4
package.json+1−1
@@ -2,7 +2,7 @@   "slug": "bq25792-charger",   "title": "BQ25792 Charger",   "type": "component",-  "version": "0.1.15",+  "version": "0.1.16",   "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.15",+  "version": "0.1.16",   "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+11
@@ -156,6 +156,17 @@ exported bodies + design rules.</p>       eng.stopRenderLoop();       eng.runRenderLoop(function(){ sc.render(); });       viewer.frameModel();+      // frameModel only frames models loaded through the bundle's own registry -+      // frame OUR appended meshes explicitly.+      try{+        var ext=sc.getWorldExtends(function(m){ return appended.indexOf(m)>=0; });+        var cx=(ext.min.x+ext.max.x)/2, cy=(ext.min.y+ext.max.y)/2, cz=(ext.min.z+ext.max.z)/2;+        var dx=ext.max.x-ext.min.x, dy=ext.max.y-ext.min.y, dz=ext.max.z-ext.min.z;+        var diag=Math.sqrt(dx*dx+dy*dy+dz*dz);+        var cam=viewer.getCamera();+        if(cam && cam.setTarget){ cam.setTarget(new window.BABYLON.Vector3(cx,cy,cz)); }+        if(cam && typeof cam.radius==="number" && isFinite(diag) && diag>0){ cam.radius=diag*1.1; }+      }catch(e){}       try{ if(viewer.toggleAxes) viewer.toggleAxes("world",false);}catch(e){}       setStatus(which+" view"); busy=false;     }).catch(function(err){ setStatus("load failed: "+((err&&err.message)||"unknown")); busy=false; });