From d57cf3a04590c99d7a3208efc3ee12d8403e4d10 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期日, 07 四月 2024 14:36:10 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js | 8 +++++---
zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx | 4 +++-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js b/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
index 58ee56c..5c2913e 100644
--- a/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
+++ b/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
@@ -64,9 +64,6 @@
initScene = () => {
const scene = new THREE.Scene();
- // scene.background = new THREE.Color(0xf0f0f0);
- // scene.background = new THREE.Color(0x333333);
-
// scene.background = new THREE.Color(0xf8f8f8);
scene.background = new THREE.Color(0x7a7a7a);
scene.fog = new THREE.Fog(scene.background, 1, 5000);
@@ -203,6 +200,11 @@
}
}
+ rePerspective = (maxHeight) => {
+ this.camera.position.set(-maxHeight * 0.8, maxHeight * 0.8, maxHeight * 0.8);
+ this.controls.target = new THREE.Vector3(0, maxHeight * 0.55, 0);
+ }
+
destroy = () => {
cancelAnimationFrame(this.animationFrame);
window.removeEventListener('resize', this.resizeHandler);
diff --git a/zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx b/zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx
index a6b460b..6b8cdd5 100644
--- a/zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx
+++ b/zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx
@@ -61,11 +61,12 @@
if (res?.data && shelfThree) {
shelfThree.generateMesh((loader, addObject) => {
const promises = [];
+ const singleHeight = 123;
for (const item of res.data) {
const { lev } = Utils.parseLocNo(item.locNo);
promises.push(new Promise((resolve) => {
loader.load('model/04.fbx', (mesh) => {
- mesh.position.set(0, 123 * (lev - 1), 0);
+ mesh.position.set(0, singleHeight * (lev - 1), 0);
mesh.scale.set(5, 5, 5);
mesh.name = item.locNo;
mesh.traverse(function (child) {
@@ -95,6 +96,7 @@
Promise.all(promises).then(() => {
shelfThree.setNewSelectedMesh(locNo);
+ shelfThree.rePerspective(singleHeight * res.data.length);
}).catch(error => {
console.error(error);
});
--
Gitblit v1.9.1