From afa59e8666c01099decc7458d78e2542ac9291cf Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 28 三月 2024 17:04:27 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 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 86f98c5..6436449 100644
--- a/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
+++ b/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
@@ -9,8 +9,6 @@
constructor(dom) {
this.dom = dom;
- this.fullWidth = dom.offsetWidth;
- this.fullHeight = dom.offsetHeight;
this.objects = [];
}
@@ -41,7 +39,15 @@
this.stats.update();
// Rotate the scene
this.controls.update()
- this.controls.autoRotateSpeed = 0.6;
+ this.controls.autoRotateSpeed = 2;
+ }
+
+ getFullWidth = () => {
+ return this.dom.offsetWidth;
+ }
+
+ getFullHeight = () => {
+ return this.dom.offsetHeight;
}
addObject = (object) => {
@@ -52,7 +58,7 @@
initScene = () => {
const scene = new THREE.Scene();
// scene.background = new THREE.Color(0xf0f0f0);
- // scene.background = new THREE.Color(0x333333);
+ scene.background = new THREE.Color(0x333333);
if (help) {
scene.add(new THREE.AxesHelper(1000));
}
@@ -60,7 +66,7 @@
}
initCamera = () => {
- const camera = new THREE.PerspectiveCamera(70, this.fullWidth / this.fullHeight, 1, 60000);
+ const camera = new THREE.PerspectiveCamera(70, this.getFullWidth() / this.getFullHeight(), 1, 60000);
camera.position.set(-300, 300, 300);
this.scene.add(camera);
return camera;
@@ -75,7 +81,7 @@
// this.renderer.toneMapping = THREE.ReinhardToneMapping;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.setPixelRatio(window.devicePixelRatio);
- renderer.setSize(this.fullWidth, this.fullHeight);
+ renderer.setSize(this.getFullWidth(), this.getFullHeight());
this.dom.appendChild(renderer.domElement);
return renderer;
}
@@ -109,9 +115,9 @@
windowResize = () => {
this.resizeHandler = () => {
- this.camera.aspect = this.fullWidth / this.fullHeight;
+ this.camera.aspect = this.getFullWidth() / this.getFullHeight();
this.camera.updateProjectionMatrix();
- this.renderer.setSize(this.fullWidth, this.fullHeight);
+ this.renderer.setSize(this.getFullWidth(), this.getFullHeight());
};
window.addEventListener('resize', this.resizeHandler, false);
}
--
Gitblit v1.9.1