refactor: move centering to 3mf gen

This commit is contained in:
hyper
2026-03-17 12:49:49 +08:00
parent c24c3b920d
commit b099d5695d
2 changed files with 11 additions and 9 deletions
-8
View File
@@ -51,14 +51,6 @@ export default function MdTokenViewer(props: TokenViewerProps) {
// 3MF 文件可能返回一个 Group,包含多个 Mesh
group = object instanceof THREE.Group ? object : new THREE.Group().add(object);
// 计算边界框并居中
const box = new THREE.Box3().setFromObject(group);
const center = box.getCenter(new THREE.Vector3());
group.position.x = -center.x;
group.position.y = -center.y;
group.position.z = -center.z;
group.rotateX(Math.PI);
// 为每个 mesh 启用原始颜色