ZhangXianQiang
2024-04-17 35ddaca1fe74191a9861f42b1d6d5f1ed93651a5
feat:添加角度限制
3个文件已修改
11 ■■■■ 已修改文件
src/views/screen/components/screen-map-three/experience/camera.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/screen/components/screen-map-three/experience/world/enviroment.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/screen/components/screen-map-three/experience/world/map.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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() {
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]
    };
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();