From 791c8e63e4cdaa065750d7d2639a22a9fe596e19 Mon Sep 17 00:00:00 2001 From: chenziqi66 <1304114564@qq.com> Date: Wed, 25 Mar 2026 17:21:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=99=E6=98=AF=E4=B8=80=E4=B8=AA=20?= =?UTF-8?q?=E5=AE=A4=E5=86=853D/2D=E5=9C=B0=E5=9B=BE=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=20=EF=BC=8C=E9=87=87=E7=94=A8=E7=BA=AF?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E6=8A=80=E6=9C=AF=E5=AE=9E=E7=8E=B0=EF=BC=8C?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=B4=AD=E7=89=A9=E4=B8=AD=E5=BF=83=E3=80=81?= =?UTF-8?q?=E5=95=86=E5=9C=BA=E7=AD=89=E5=AE=A4=E5=86=85=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E7=9A=84=E5=8F=AF=E8=A7=86=E5=8C=96=E5=B1=95=E7=A4=BA=E3=80=82?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=94=AF=E6=8C=813D=E5=92=8C2D=E4=B8=A4?= =?UTF-8?q?=E7=A7=8D=E6=B8=B2=E6=9F=93=E6=A8=A1=E5=BC=8F=EF=BC=8C=E5=85=B7?= =?UTF-8?q?=E5=A4=87=E6=A5=BC=E5=B1=82=E5=88=87=E6=8D=A2=E3=80=81=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E9=80=89=E6=8B=A9=E3=80=81=E7=BC=A9=E6=94=BE=E6=97=8B?= =?UTF-8?q?=E8=BD=AC=E7=AD=89=E4=BA=A4=E4=BA=92=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 我发现了下面的bug,请帮我尽快修正 Bug 1: 触摸事件监听器泄漏(严重) Bug 2: 3D选择对象时空指针风险(严重) Bug 3: 选择对象逻辑错误 影响 : 多个重叠对象时选择逻辑混乱,回调可能被多次调用 Bug 4: select函数中的空指针错误 Bug 5: 矩形碰撞检测计算错误 - 问题 : 矩形右边界计算错误,应该是宽度的一半而不是高度的一半。 - 影响 : 标签碰撞检测不准确,可能导致标签重叠显示或错误隐藏。 请修正 约束:不要改动代码原本的逻辑,测试一定要到位 --- js/IndoorMap3d.js | 30 +++++++++++++++++++++--------- js/OrbitControls.js | 5 +++++ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/js/IndoorMap3d.js b/js/IndoorMap3d.js index 612762a..02ea6fa 100644 --- a/js/IndoorMap3d.js +++ b/js/IndoorMap3d.js @@ -238,7 +238,8 @@ IndoorMap3d = function(mapdiv){ //select object(just hight light it) function select(obj){ - obj.currentHex = _selected.material.color.getHex(); + if(!obj || !obj.material) return; + obj.currentHex = obj.material.color.getHex(); obj.material.color = new THREE.Color(_theme.selected); obj.scale = new THREE.Vector3(2,2,2); } @@ -260,7 +261,10 @@ IndoorMap3d = function(mapdiv){ _rayCaster.set( _this.camera.position, vector.sub( _this.camera.position ).normalize() ); - var intersects = _rayCaster.intersectObjects( _this.mall.root.children[0].children ); + var intersects = []; + if (_this.mall && _this.mall.root && _this.mall.root.children[0] && _this.mall.root.children[0].children) { + intersects = _rayCaster.intersectObjects( _this.mall.root.children[0].children ); + } if ( intersects.length > 0 ) { @@ -269,18 +273,22 @@ IndoorMap3d = function(mapdiv){ if ( _selected ) { _selected.material.color.setHex( _selected.currentHex ); } + var foundSolidRoom = false; for(var i=0; i