From 35ddaca1fe74191a9861f42b1d6d5f1ed93651a5 Mon Sep 17 00:00:00 2001
From: ZhangXianQiang <1135831638@qq.com>
Date: 星期三, 17 四月 2024 15:33:47 +0800
Subject: [PATCH] feat:添加角度限制

---
 src/views/screen/components/screen-map-three/experience/camera.js           |    5 +++++
 src/views/screen/components/screen-map-three/experience/world/enviroment.js |    4 ++--
 src/views/screen/components/screen-map-three/experience/world/map.js        |    2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/views/screen/components/screen-map-three/experience/camera.js b/src/views/screen/components/screen-map-three/experience/camera.js
index 792beeb..8a541f2 100644
--- a/src/views/screen/components/screen-map-three/experience/camera.js
+++ b/src/views/screen/components/screen-map-three/experience/camera.js
@@ -1,3 +1,4 @@
+import {MathUtils} from 'three';
 import { PerspectiveCamera, CameraHelper } from 'three';
 import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
 
@@ -26,6 +27,10 @@
         this.controls = new OrbitControls(this.instance, this.canvas);
         this.controls.target.set(0, 0, 5);
         this.controls.enableDamping = true;
+        this.controls.minDistance = 20;
+        this.controls.maxDistance = 80;
+        this.controls.maxPolarAngle = MathUtils.degToRad(80);
+        // this.controls.maxPolarAngle = (-Math.PI / 2);
     }
 
     resize() {
diff --git a/src/views/screen/components/screen-map-three/experience/world/enviroment.js b/src/views/screen/components/screen-map-three/experience/world/enviroment.js
index 9fb8d80..6ee6381 100644
--- a/src/views/screen/components/screen-map-three/experience/world/enviroment.js
+++ b/src/views/screen/components/screen-map-three/experience/world/enviroment.js
@@ -36,7 +36,7 @@
       width: 48,
       height: 48,
       texture: rotatingApertureTexture,
-      positionList: [0, 0.4, 0.3],
+      positionList: [0, 0.4, 0],
       scaleList: [1, 1, 1],
       rotateList: [-Math.PI / 2, 0, 0]
     };
@@ -44,7 +44,7 @@
       width: 40,
       height: 40,
       texture: rotatingPointTexture,
-      positionList: [0, 0.3, 0.3],
+      positionList: [0, 0.3, 0],
       scaleList: [1, 1, 1],
       rotateList: [-Math.PI / 2, 0, 0]
     };
diff --git a/src/views/screen/components/screen-map-three/experience/world/map.js b/src/views/screen/components/screen-map-three/experience/world/map.js
index 5620c65..d7da5f6 100644
--- a/src/views/screen/components/screen-map-three/experience/world/map.js
+++ b/src/views/screen/components/screen-map-three/experience/world/map.js
@@ -80,7 +80,7 @@
             }
             this.map.add(province);
         });
-        this.map.position.set(1, 1, 0.15);
+        this.map.position.set(1, 1, -2);
         this.map.scale.set(10, 10, 10);
         this.map.rotation.set(THREE.MathUtils.degToRad(-90), 0, THREE.MathUtils.degToRad(20));
         this.container = new THREE.Object3D();

--
Gitblit v1.8.0