From 736973883280e9a6059c5da2f2e67d5a6aecdcef Mon Sep 17 00:00:00 2001 From: zhang <zc857179121@qq.com> Date: 星期五, 29 八月 2025 15:03:22 +0800 Subject: [PATCH] 1 --- zy-acs-flow/src/map/insight/agv/AgvThree.js | 25 +++++++++++++++---------- 1 files changed, 15 insertions(+), 10 deletions(-) diff --git a/zy-acs-flow/src/map/insight/agv/AgvThree.js b/zy-acs-flow/src/map/insight/agv/AgvThree.js index e45c5da..b4671bd 100644 --- a/zy-acs-flow/src/map/insight/agv/AgvThree.js +++ b/zy-acs-flow/src/map/insight/agv/AgvThree.js @@ -71,7 +71,7 @@ renderer.setClearAlpha(0); renderer.shadowMap.enabled = true; renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.setPixelRatio(window.devicePixelRatio); + renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); renderer.setSize(this.getFullWidth(), this.getFullHeight()); this.dom?.appendChild(renderer.domElement); return renderer; @@ -159,23 +159,28 @@ if (this.renderer) { this.renderer.dispose(); this.renderer.forceContextLoss(); - this.renderer.context = null; - this.renderer.domElement = null; + if (this.dom && this.renderer.domElement && this.dom.contains(this.renderer.domElement)) { + try { + this.dom.removeChild(this.renderer.domElement); + } catch (error) { + console.warn('Failed to remove renderer.domElement:', error); + } + } this.renderer = null; } if (this.controls) { this.controls.dispose(); this.controls = null; } - this.camera = null; - this.objects = []; - if (this.dom) { - while (this.dom.firstChild) { - if (this.dom.contains(this.dom.firstChild)) { - this.dom.removeChild(this.dom.firstChild); - } + if (this.stats && this.stats.domElement && this.dom.contains(this.stats.domElement)) { + try { + this.dom.removeChild(this.stats.domElement); + } catch (error) { + console.warn('Failed to remove stats.domElement:', error); } } + this.camera = null; + this.objects = []; } removeEntity = (object) => { -- Gitblit v1.9.1