From 7c32ab19d3bf4c601212314a1617bbb51c5fdd2a Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 29 三月 2024 16:01:36 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js |   26 +++++++++-----------------
 1 files changed, 9 insertions(+), 17 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 1bd730c..0ed9899 100644
--- a/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
+++ b/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
@@ -3,7 +3,7 @@
 import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
 import TWEEN from '@tweenjs/tween.js';
 
-const help = true;
+const help = false;
 
 export default class ShelfThree {
 
@@ -66,7 +66,7 @@
 
     initCamera = () => {
         const camera = new THREE.PerspectiveCamera(70, this.getFullWidth() / this.getFullHeight(), 1, 60000);
-        camera.position.set(-300, 800, 300);
+        camera.position.set(-400, 400, 400);
         this.scene.add(camera);
         return camera;
     }
@@ -99,7 +99,7 @@
         controls.rotateSpeed = 0.6; // 瑙嗚绉诲姩閫熷害鍑忔參
         controls.autoRotate = true; // 鑷姩鏃嬭浆
 
-        controls.target = new THREE.Vector3(0, 0, 0)  // 骞虫浛 camera鐨刲ookAt
+        controls.target = new THREE.Vector3(0, 250, 0)  // 灞忓箷涓績鐐� 骞虫浛 camera鐨刲ookAt
         return controls;
     }
 
@@ -126,10 +126,9 @@
         const raycaster = new THREE.Raycaster();
         const mouse = new THREE.Vector2();
 
-        this.dom.addEventListener("click", (event) => {
-            this.handleClick("null");
-        })
         this.dom.addEventListener("dblclick", (event) => {
+        })
+        this.dom.addEventListener("click", (event) => {
             let x, y;
             if (event.changedTouches) {
                 x = event.changedTouches[0].pageX;
@@ -139,34 +138,27 @@
                 y = event.clientY;
             }
             event.preventDefault();
+            // mouse.x = (x / this.getFullWidth()) * 2 - 1;
+            // mouse.y = -(y / this.getFullHeight()) * 2 + 1;
             mouse.x = (x / window.innerWidth) * 2 - 1;
             mouse.y = -(y / window.innerHeight) * 2 + 1;
             raycaster.setFromCamera(mouse, that.camera);
             let intersects = raycaster.intersectObjects(that.objects, true);
+            console.log(intersects);
             if (intersects.length === 0) {
-                this.handleClick("null");
                 return;
             }
             let objName = intersects[0].object.name;
             if (objName.startsWith("locNo")) {
-
                 if (this.handleClick) {
                     this.handleClick(objName, x, y);
                 }
-
-            } else {
-                this.handleClick("null");
             }
-
         }, false);
     }
 
     generateMesh = (fn) => {
-        fn(this.scene);
-    }
-
-    handleClick = () => {
-
+        fn(this.addObject);
     }
 
     destroy = () => {

--
Gitblit v1.9.1