fix: 3d model preview overflow
ci/woodpecker/push/woodpecker Pipeline was successful Details

feat/axum
Tomáš Mládek 2023-09-05 22:03:24 +02:00
parent 520dec104d
commit 2a23bb545f
1 changed files with 5 additions and 4 deletions

View File

@ -16,7 +16,7 @@
const camera = new THREE.PerspectiveCamera(
70,
root.clientWidth / root.clientHeight
root.clientWidth / root.clientHeight,
);
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
@ -47,16 +47,16 @@
geometry.computeBoundingBox();
geometry.boundingBox.getCenter(middle);
mesh.geometry.applyMatrix4(
new THREE.Matrix4().makeTranslation(-middle.x, -middle.y, -middle.z)
new THREE.Matrix4().makeTranslation(-middle.x, -middle.y, -middle.z),
);
mesh.geometry.applyMatrix4(
new THREE.Matrix4().makeRotationX(-Math.PI / 2)
new THREE.Matrix4().makeRotationX(-Math.PI / 2),
);
const largestDimension = Math.max(
geometry.boundingBox.max.x,
geometry.boundingBox.max.y,
geometry.boundingBox.max.z
geometry.boundingBox.max.z,
);
camera.position.z = largestDimension * 2;
});
@ -77,6 +77,7 @@
<style>
.modelviewer {
width: 100%;
max-height: 100%;
}
.modelviewer.lookonly {