#
luxiaotao1123
2024-03-28 a18933e1988d48aa3049bf5079fc07183d116da8
#
1个文件已修改
18 ■■■■■ 已修改文件
zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
@@ -9,8 +9,6 @@
    constructor(dom) {
        this.dom = dom;
        this.fullWidth = dom.offsetWidth;
        this.fullHeight = dom.offsetHeight;
        this.objects = [];
    }
@@ -44,6 +42,14 @@
        this.controls.autoRotateSpeed = 2;
    }
    getFullWidth = () => {
        return this.dom.offsetWidth;
    }
    getFullHeight = () => {
        return this.dom.offsetHeight;
    }
    addObject = (object) => {
        this.scene.add(object);
        this.objects.push(object);
@@ -60,7 +66,7 @@
    }
    initCamera = () => {
        const camera = new THREE.PerspectiveCamera(70, this.fullWidth / this.fullHeight, 1, 60000);
        const camera = new THREE.PerspectiveCamera(70, this.getFullWidth() / this.getFullHeight(), 1, 60000);
        camera.position.set(-300, 300, 300);
        this.scene.add(camera);
        return camera;
@@ -75,7 +81,7 @@
        // this.renderer.toneMapping = THREE.ReinhardToneMapping;
        renderer.toneMapping = THREE.ACESFilmicToneMapping;
        renderer.setPixelRatio(window.devicePixelRatio);
        renderer.setSize(this.fullWidth, this.fullHeight);
        renderer.setSize(this.getFullWidth(), this.getFullHeight());
        this.dom.appendChild(renderer.domElement);
        return renderer;
    }
@@ -109,9 +115,9 @@
    windowResize = () => {
        this.resizeHandler = () => {
            this.camera.aspect = this.fullWidth / this.fullHeight;
            this.camera.aspect = this.getFullWidth() / this.getFullHeight();
            this.camera.updateProjectionMatrix();
            this.renderer.setSize(this.fullWidth, this.fullHeight);
            this.renderer.setSize(this.getFullWidth(), this.getFullHeight());
        };
        window.addEventListener('resize', this.resizeHandler, false);
    }