唐润平: 传感器添加删除、标签文字设置、双击进入视角、双击空白回退视角
This commit is contained in:
@@ -72,11 +72,6 @@ export default class Demo {
|
||||
// console.log(this.camera.position);
|
||||
}
|
||||
|
||||
// 摄像头移动动画
|
||||
if (this.cameraPositionTween) {
|
||||
this.cameraPositionTween.update();
|
||||
}
|
||||
|
||||
//html标签渲染
|
||||
if (this.CSS2Renderer) {
|
||||
this.CSS2Renderer.render(this.scene, this.camera);
|
||||
@@ -101,6 +96,11 @@ export default class Demo {
|
||||
if (this.opacityTween) {
|
||||
this.opacityTween.update();
|
||||
}
|
||||
|
||||
// 双击进入动画
|
||||
if (this.dblIntoTween) {
|
||||
this.dblIntoTween.update();
|
||||
}
|
||||
}
|
||||
|
||||
// 添加世界坐标系
|
||||
@@ -280,9 +280,9 @@ export default class Demo {
|
||||
this.setBoxHelper(intersects[0].object);
|
||||
|
||||
// 处理点击左右键事件
|
||||
if (e.button === 2) {
|
||||
if (e.button === 0) {
|
||||
this._handleLClick(intersects[0].object);
|
||||
} else if (e.button === 0) {
|
||||
} else if (e.button === 2) {
|
||||
this._handleRClick(intersects[0].object);
|
||||
}
|
||||
}, 400);
|
||||
@@ -308,16 +308,14 @@ export default class Demo {
|
||||
this.tagCSS2DObj.element.style.display = "none";
|
||||
this.tag2CSS2DObj.element.style.display = "none";
|
||||
this.tag3CSS2DObj.element.style.display = "none";
|
||||
// 设置该标签初始化透明
|
||||
this.tagCSS2DObj.element.style.opacity = "1";
|
||||
this.tag2CSS2DObj.element.style.opacity = "1";
|
||||
this.tag3CSS2DObj.element.style.opacity = "1";
|
||||
// // 设置该标签初始化透明
|
||||
// this.tagCSS2DObj.element.style.opacity = "1";
|
||||
// this.tag2CSS2DObj.element.style.opacity = "1";
|
||||
|
||||
this.tagCSS2DObj.scale.set(0.1, 0.1, 0.1);
|
||||
this.tag2CSS2DObj.scale.set(0.1, 0.1, 0.1);
|
||||
|
||||
this.tag3CSS2DObj.scale.set(0.02, 0.02, 0.02); //编辑框
|
||||
this.tag3CSS2DObj.position.set(10, 0, 10);
|
||||
this.tagCSS2DObj.scale.set(0.5, 0.5, 0.5);
|
||||
}
|
||||
clearTagsObj() {
|
||||
if (this.preDBLModel) {
|
||||
@@ -326,6 +324,7 @@ export default class Demo {
|
||||
// 所有标签看不见
|
||||
this.scene.remove(this.tag2CSS2DObj);
|
||||
this.scene.remove(this.tag3CSS2DObj);
|
||||
this.tag3CSS2DObj.element.style.opacity = "0";
|
||||
// 删除标记动画
|
||||
this.scene.remove(this.group);
|
||||
}
|
||||
@@ -364,12 +363,27 @@ export default class Demo {
|
||||
v.material = new this.THREE.MeshBasicMaterial();
|
||||
v.material.color = new this.THREE.Color("#191a05");
|
||||
});
|
||||
// 初始化风机颜色
|
||||
|
||||
// 初其他传感器机颜色
|
||||
this.equMap.get("equ_sensors").scale.set(0.1, 0.1, 0.1);
|
||||
this.equMap.get("equ_sensors").traverse((v) => {
|
||||
v.material = new this.THREE.MeshBasicMaterial();
|
||||
v.material.color = new this.THREE.Color("white");
|
||||
v.material.color = new this.THREE.Color("#7e7b7b");
|
||||
});
|
||||
// 初始标签面板
|
||||
const tag = new this.THREE.Mesh(
|
||||
new this.THREE.PlaneGeometry(10, 4),
|
||||
new this.THREE.MeshBasicMaterial({ color: "white" })
|
||||
);
|
||||
|
||||
this.equMap.get("equ_sensors").add(tag);
|
||||
// const axesHelper = new this.THREE.AxesHelper(100);
|
||||
// this.equMap.get("equ_sensors").add(axesHelper);
|
||||
tag.name = "tag";
|
||||
tag.rotation.x = Math.PI / 2;
|
||||
tag.rotation.z = Math.PI / 2; //旋转这里改变文字顺序
|
||||
tag.rotation.y = Math.PI;
|
||||
tag.translateZ(2.0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user