From 3ff78473653985d0e7ac96b87bd31bcb9250a762 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期六, 18 十二月 2021 15:05:48 +0800
Subject: [PATCH] #

---
 static/js/app.js |   49 ++++++++++++++++++++++++++++++-------------------
 1 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/static/js/app.js b/static/js/app.js
index dcf21ef..a428ab9 100644
--- a/static/js/app.js
+++ b/static/js/app.js
@@ -61,24 +61,29 @@
 			this.scene = new THREE.Scene();
 		}
 		this.initCamera = function () {
-			//澹版槑涓�涓�忚鐩告満锛�
-			// 瑙嗚锛�60锛�
-			// 绾垫í姣攁spect:鍏ㄥ睆锛屼娇鐢ㄧ殑鏄祻瑙堝櫒鐨勫搴�/楂樺害
-			//杩戝钩闈ear锛�0.1
-			//杩滃钩闈㈣瑙抐ar:10000
-			this.camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 50000);
-			/*
-            璁剧疆鐩告満浣嶇疆锛屾敞鎰弔hreejs涓殑鍧愭爣绯婚噰鐢ㄧ殑鏄彸鎵嬪潗鏍囩郴
-             */
-			// this.camera.position.x = 0;
-			// this.camera.position.y = 1000;
-			// this.camera.position.z = 600;
-			// //鐩告満鐨勬湞鍚�
-			// this.camera.lookAt(0, 0, 0);
-			this.camera.position.set( - 350, 1070, 1550 );
-			this.camera.lookAt( this.scene.position );
-			//灏嗙浉鏈烘斁鍒板満鏅腑
-			this.scene.add(this.camera);
+			if (this.camera === null) {
+				//澹版槑涓�涓�忚鐩告満锛�
+				// 瑙嗚锛�60锛�
+				// 绾垫í姣攁spect:鍏ㄥ睆锛屼娇鐢ㄧ殑鏄祻瑙堝櫒鐨勫搴�/楂樺害
+				//杩戝钩闈ear锛�0.1
+				//杩滃钩闈㈣瑙抐ar:10000
+				this.camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 50000);
+				/*
+                璁剧疆鐩告満浣嶇疆锛屾敞鎰弔hreejs涓殑鍧愭爣绯婚噰鐢ㄧ殑鏄彸鎵嬪潗鏍囩郴
+                 */
+				// this.camera.position.x = 0;
+				// this.camera.position.y = 1000;
+				// this.camera.position.z = 600;
+				// //鐩告満鐨勬湞鍚�
+				// this.camera.lookAt(0, 0, 0);
+				this.camera.position.set( - 350, 1070, 1550 );
+				this.camera.lookAt( this.scene.position );
+				//灏嗙浉鏈烘斁鍒板満鏅腑
+				this.scene.add(this.camera);
+			} else {
+				this.camera.position.set( - 350, 1070, 1550 );
+				this.camera.lookAt( this.scene.position );
+			}
 		}
 		this.initRenderer = function () {
 			this.renderer = new THREE.WebGLRenderer();
@@ -239,7 +244,13 @@
 						break;
 				}
 			};
-
+			this.controls.addEventListener( 'lock', function () {
+				console.log("绗竴浜虹О瑙嗚")
+			} );
+			this.controls.addEventListener( 'unlock', function () {
+				console.log("涓婂笣瑙嗚");
+				object.initCamera();
+			} );
 			document.addEventListener( 'keydown', onKeyDown );
 			document.addEventListener( 'keyup', onKeyUp );
 

--
Gitblit v1.9.1