Просмотр исходного кода

[Mod 0000]优化模型加载动画

hongrunxia 1 месяц назад
Родитель
Сommit
0f6046783e
1 измененных файлов с 23 добавлено и 2 удалено
  1. 23 2
      src/views/vent/home/configurable/gasInjection.vue

+ 23 - 2
src/views/vent/home/configurable/gasInjection.vue

@@ -55,6 +55,8 @@
   import { getHomeData } from './configurable.api';
   // import { useRoute } from 'vue-router';
   import { testConfigGasInject, testConfigGasInjectZq, testConfigGasInjectCc, testConfigGasInjectSy } from './configurable.data';
+  import { animateCamera } from '/@/utils/threejs/util';
+
   const { configs, fetchConfigs } = useInitConfigs();
   const { mainTitle, data, updateData } = useInitPage('注气驱替智能管控系统');
   // const route = useRoute();
@@ -81,8 +83,22 @@
     }
 
     // 刷新/
-    nextTick(() => {
+    nextTick(async () => {
       three3D.value?.resizeRenderer();
+      const modal = three3D.value.getModal();
+      if (modal) {
+        const oldCamera = modal.camera;
+        const oldCameraPosition = { x: oldCamera.position.x, y: oldCamera.position.y, z: oldCamera.position.z };
+        if (param == 'zqxt') {
+          const newP = { x: -26.587483577770445, y: -1.885170491810538, z: 39.104309663143255 };
+          const newT = { x: 10.919881491980828, y: -4.7228274957026946, z: 38.87645926712004 };
+          await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, newP, newT, modal);
+        } else {
+          const newP = { x: -45.69228602978097, y: 49.59721939545517, z: 2.6454258202266985 };
+          const newT = { x: 9.289291846942458, y: -21.608842010051386, z: 2.7675348357947906 };
+          await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, newP, newT, modal);
+        }
+      }
     });
   }
   onMounted(() => {
@@ -101,6 +117,7 @@
     clearInterval(interval);
   });
 </script>
+
 <style lang="less" scoped>
   @import '/@/design/theme.less';
 
@@ -216,7 +233,11 @@
   }
 
   .modal-box {
-    width: 100%; height: 100%; position: relative; pointer-events: auto, padding: 20px;
+    width: 100%;
+    height: 100%;
+    position: relative;
+    pointer-events: auto;
+    padding: 20px;
   }
 
   // 试验区模型区域样式