Skip to content

Commit

Permalink
Merge pull request #1084 from hypar-io/fix-extension-viewer
Browse files Browse the repository at this point in the history
fix some bugs in the notebook viewer (#1084)
  • Loading branch information
andrewheumann authored May 1, 2024
2 parents 4816fbd + 58fa1a0 commit d246cee
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Elements/src/extension.dib
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using System;
using System.IO;

var viewerSrc = @"
<div id=""main_DIV_ID"" style=""height:WIDTH_VAR;width:HEIGHT_VARpx;""></div>
<div id=""main_DIV_ID"" style=""height:HEIGHT_VARpx;width:WIDTH_VARpx;""></div>
</div>
<script type=""module"">
import * as THREE from 'https://unpkg.com/[email protected]/build/three.module.js';
Expand Down Expand Up @@ -92,10 +92,9 @@ const fitCameraToObject = function (scene, offset = 1.25) {
camera.position.copy(center.clone().add(size.clone().multiplyScalar(offset)))
}

const minZ = boundingBox.min.z;
const cameraToFarEdge = (minZ < 0) ? -minZ + cameraZ : cameraZ - minZ;
const cameraToFarEdge = camera.position.distanceTo(center) + maxDim;

camera.far = cameraToFarEdge * 10;
camera.far = cameraToFarEdge * 5;
camera.updateProjectionMatrix();

if (controls) {
Expand Down

0 comments on commit d246cee

Please sign in to comment.