廖杰:风机状态颜色修复+修复选中模式多次发送请求
This commit is contained in:
@@ -13,6 +13,7 @@ import { editTunnelInit } from "./editTunnelInit";
|
||||
import { addEquipment, removeEquipment } from "./editEquipment";
|
||||
import previewtunnelModeInit from "./previewTunnelInit"
|
||||
import { StreetSignTag } from "./utils/StreetSignTag/StreetSignTag.js";
|
||||
// import { fa } from "element-plus/es/locale/index.js";
|
||||
// import { ref } from "vue";
|
||||
export default class Demo {
|
||||
// 摄像机看向位置s
|
||||
@@ -255,11 +256,11 @@ export default class Demo {
|
||||
} else {
|
||||
if (isedit != true) {
|
||||
// console.log(isedit);
|
||||
//附着点设置方框
|
||||
//附着点设置方框(已经被选中了的情况)
|
||||
this.setBoxHelper(intersects[0].object);
|
||||
this._handleLHover(intersects[0].object);
|
||||
}
|
||||
|
||||
}
|
||||
this.preHover.material.color.set("white");
|
||||
this.preHover = intersects[0].object;
|
||||
}
|
||||
@@ -434,6 +435,7 @@ export default class Demo {
|
||||
v.material.color = new this.THREE.Color(0xC0C0C0);
|
||||
if (/^leaf/.test(v.name) || /^roller/.test(v.name)) {
|
||||
group.add(v.clone());
|
||||
// console.log(group);
|
||||
v.visible = false;
|
||||
// console.log(v);
|
||||
}
|
||||
|
||||
@@ -185,6 +185,21 @@ function handleFanEqu(
|
||||
this.fanSpinArray = [];
|
||||
}
|
||||
const equMesh = this.equMap.get("equ_fan").clone();
|
||||
// console.log(this.equMap.get("equ_fan"));
|
||||
// console.log(this.equMap.get("equ_fan").material.clone());
|
||||
// equMesh.material = this.equMap.get("equ_fan").material.clone();
|
||||
// console.log(equMesh);
|
||||
//深层次克隆
|
||||
equMesh.children.map(function (item) {
|
||||
// console.log(item);
|
||||
if (item.isMesh) {
|
||||
item.material = item.material.clone();
|
||||
}
|
||||
})
|
||||
// equMesh.geometry = this.equMap.get("equ_fan").geometry.clone();
|
||||
// console.log(equMesh);
|
||||
|
||||
|
||||
const worldP = targetPoint.getWorldPosition(new this.THREE.Vector3());
|
||||
equMesh.position.copy(worldP);
|
||||
equMesh.translateY(-0.6);
|
||||
@@ -197,10 +212,17 @@ function handleFanEqu(
|
||||
id: equMesh.id, //模型在场景id
|
||||
...equipmentInfo,
|
||||
};
|
||||
//我们把风机的附着点挂在原型上,这样应该可以进行处理
|
||||
if (targetPoint.info.equipmentName.slice(0, 1) == '1') {
|
||||
this.scene.Fan1targetPoint = targetPoint
|
||||
} else {
|
||||
this.scene.Fan2targetPoint = targetPoint
|
||||
}
|
||||
//这里感觉情况改变风机的颜色
|
||||
changeFanColor(fanData, targetPoint, this.scene)
|
||||
|
||||
|
||||
|
||||
// 定义风机旋转
|
||||
const fanLeaf = equMesh.getObjectByName("fan_leafs");
|
||||
const fanSpin = new this.TWEEN.Tween({ rotation: 0 });
|
||||
@@ -285,7 +307,7 @@ function deleteItem(array, item) {
|
||||
return array
|
||||
}
|
||||
|
||||
//这里是改变风机颜色的代码
|
||||
// 这里是改变风机颜色的代码
|
||||
function changeFanColor(fanData, targetPoint, scene) {
|
||||
if (fanData !== undefined) {
|
||||
//保证是预览模式才进行这里的操作(!=1)
|
||||
|
||||
@@ -1,54 +1,57 @@
|
||||
export function handleLHover(targetPoint) {
|
||||
// 保存进入状态
|
||||
this._saveState();
|
||||
// this.clearTagsObj();
|
||||
// 全局临时标记该选中的模型;
|
||||
this.targetPoint = targetPoint;
|
||||
const worldPosition = new this.THREE.Vector3();
|
||||
//获取附着点的世界坐标系
|
||||
targetPoint.getWorldPosition(worldPosition);
|
||||
this._checkAnimation(worldPosition);
|
||||
if (this.tag3CSS2DObj.element.style.opacity != '1') {
|
||||
// 保存进入状态
|
||||
this._saveState();
|
||||
// this.clearTagsObj();
|
||||
// 全局临时标记该选中的模型;
|
||||
this.targetPoint = targetPoint;
|
||||
const worldPosition = new this.THREE.Vector3();
|
||||
//获取附着点的世界坐标系
|
||||
targetPoint.getWorldPosition(worldPosition);
|
||||
this._checkAnimation(worldPosition);
|
||||
|
||||
// 设置标签位置
|
||||
this.tag3CSS2DObj.position.set(
|
||||
worldPosition.x,
|
||||
worldPosition.y,
|
||||
worldPosition.z
|
||||
);
|
||||
this.isControlOrbit(false);
|
||||
this.position = worldPosition;
|
||||
if (/tr$/.test(targetPoint.name)) {
|
||||
this.tag3CSS2DObj.translateX(3);
|
||||
this.tag3CSS2DObj.translateZ(10);
|
||||
this.tag3CSS2DObj.translateY(-5);
|
||||
intoAnimation.call(this);
|
||||
} else if (/tl$/.test(targetPoint.name)) {
|
||||
this.tag3CSS2DObj.translateX(-3);
|
||||
this.tag3CSS2DObj.translateZ(10);
|
||||
this.tag3CSS2DObj.translateY(-5);
|
||||
intoAnimation.call(this);
|
||||
} else if (/tc$/.test(targetPoint.name)) {
|
||||
this.tag3CSS2DObj.translateX(0);
|
||||
this.tag3CSS2DObj.translateZ(10);
|
||||
this.tag3CSS2DObj.translateY(-6);
|
||||
intoAnimation.call(this);
|
||||
} else if (/br$/.test(targetPoint.name)) {
|
||||
this.tag3CSS2DObj.translateX(2);
|
||||
this.tag3CSS2DObj.translateZ(10);
|
||||
this.tag3CSS2DObj.translateY(3);
|
||||
intoAnimation.call(this);
|
||||
} else if (/bl$/.test(targetPoint.name)) {
|
||||
this.tag3CSS2DObj.translateX(-2);
|
||||
this.tag3CSS2DObj.translateZ(10);
|
||||
this.tag3CSS2DObj.translateY(3);
|
||||
intoAnimation.call(this);
|
||||
// 设置标签位置
|
||||
this.tag3CSS2DObj.position.set(
|
||||
worldPosition.x,
|
||||
worldPosition.y,
|
||||
worldPosition.z
|
||||
);
|
||||
this.isControlOrbit(false);
|
||||
this.position = worldPosition;
|
||||
if (/tr$/.test(targetPoint.name)) {
|
||||
this.tag3CSS2DObj.translateX(3);
|
||||
this.tag3CSS2DObj.translateZ(10);
|
||||
this.tag3CSS2DObj.translateY(-5);
|
||||
intoAnimation.call(this);
|
||||
} else if (/tl$/.test(targetPoint.name)) {
|
||||
this.tag3CSS2DObj.translateX(-3);
|
||||
this.tag3CSS2DObj.translateZ(10);
|
||||
this.tag3CSS2DObj.translateY(-5);
|
||||
intoAnimation.call(this);
|
||||
} else if (/tc$/.test(targetPoint.name)) {
|
||||
this.tag3CSS2DObj.translateX(0);
|
||||
this.tag3CSS2DObj.translateZ(10);
|
||||
this.tag3CSS2DObj.translateY(-6);
|
||||
intoAnimation.call(this);
|
||||
} else if (/br$/.test(targetPoint.name)) {
|
||||
this.tag3CSS2DObj.translateX(2);
|
||||
this.tag3CSS2DObj.translateZ(10);
|
||||
this.tag3CSS2DObj.translateY(3);
|
||||
intoAnimation.call(this);
|
||||
} else if (/bl$/.test(targetPoint.name)) {
|
||||
this.tag3CSS2DObj.translateX(-2);
|
||||
this.tag3CSS2DObj.translateZ(10);
|
||||
this.tag3CSS2DObj.translateY(3);
|
||||
intoAnimation.call(this);
|
||||
}
|
||||
this.scene.add(this.tag3CSS2DObj);
|
||||
// 返回给编辑组件的回调函数
|
||||
this.editDev(targetPoint)
|
||||
}
|
||||
this.scene.add(this.tag3CSS2DObj);
|
||||
// 返回给编辑组件的回调函数
|
||||
this.editDev(targetPoint);
|
||||
}
|
||||
|
||||
function intoAnimation() {
|
||||
this.tag3CSS2DObj.element.style.opacity = "1";
|
||||
this.tag3CSS2DObj.element.style.display = "block";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user