fix(SDK): 修复测量不显示的bug

This commit is contained in:
ErSan 2025-11-14 23:56:30 +08:00
parent ebfa52b990
commit fed4277a7c
3 changed files with 6 additions and 5 deletions

View File

@ -39,6 +39,8 @@ class Measure extends THREE.EventDispatcher<MeasureEventMap>{
depthWrite: false,
depthTest: false
});
// 标记点图片
static MARKER_TEXTURE = new URL(import.meta.env.BASE_URL + 'static/images/logo.png', import.meta.url).href;
static MAX_DISTANCE = 500; //当相交物体的距离太远时,忽略它
static OBJ_NAME = "object_for_measure";
static LABEL_NAME = "label_for_measure";
@ -69,12 +71,13 @@ class Measure extends THREE.EventDispatcher<MeasureEventMap>{
super();
this.mode = mode;
this.scene = viewer.sceneHelpers;
this.scene = viewer.scene;
this.viewer = viewer;
// 初始化group
this.measureGroup = new THREE.Group();
this.measureGroup.name = `measure_group`;
this.measureGroup.ignore = true;
this.group = new THREE.Group();
@ -239,7 +242,7 @@ class Measure extends THREE.EventDispatcher<MeasureEventMap>{
*
*/
initPointMarkerMaterial() {
const markerTexture = new THREE.TextureLoader().load("/static/images/logo/logo.png");
const markerTexture = new THREE.TextureLoader().load(Measure.MARKER_TEXTURE);
this.spriteMaterial = new THREE.SpriteMaterial({
map: markerTexture,
depthTest: false, // 深度测试

View File

@ -1103,9 +1103,7 @@ export default class Viewer extends THREE.EventDispatcher<ViewerEventMap> {
if (this.options.edit?.enabled) this.renderer.render(this.sceneHelpers, this.camera);
}
// css2d 在sceneHelpers内
this.css2DRenderer.render(this.sceneHelpers, App.viewportCamera);
this.css2DRenderer.render(this.scene, App.viewportCamera);
this.css3DRenderer.render(this.scene, App.viewportCamera);
this.modules.viewHelper.render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB