完成了下拉框
This commit is contained in:
@@ -2,6 +2,8 @@ export default function (devInfo) {
|
||||
const dev = this.deviceList[devInfo.checkIndex].clone(); //克隆对应的moxin
|
||||
const p = this.targetPoint.getWorldPosition(new this.THREE.Vector3());
|
||||
dev.position.copy(p);
|
||||
// console.log(this.targetPoint);
|
||||
modelEffectProcess(dev, this.targetPoint)
|
||||
this.scene.add(dev);
|
||||
this.targetPoint.hasDevice = true; //标记还存在设备
|
||||
// 附着点记录信息
|
||||
@@ -15,16 +17,35 @@ export default function (devInfo) {
|
||||
return this.targetPoint.info;
|
||||
}
|
||||
|
||||
function modelEffectProcess(model, point) {
|
||||
if (model.children[0].name == "camera") {
|
||||
console.log(model);
|
||||
console.log(point);
|
||||
model.scale.set(0.1, 0.1, 0.1)
|
||||
|
||||
}
|
||||
if (model.children[0].name == "fan") {
|
||||
console.log(model);
|
||||
console.log(point);
|
||||
|
||||
}
|
||||
if (model.children[0].name == "sensors") {
|
||||
console.log(model);
|
||||
console.log(point);
|
||||
|
||||
model.scale.set(0.2, 0.2, 0.2)
|
||||
}
|
||||
}
|
||||
|
||||
function transformPosition(position, distance) {
|
||||
return `${equal(position.charAt(position.lastIndexOf("_") + 1))}边隧道${equal(
|
||||
position.charAt(position.lastIndexOf("_") + 2)
|
||||
)}侧设备约${
|
||||
(Number(
|
||||
position.substring(position.indexOf("_") + 1, position.lastIndexOf("_"))
|
||||
) +
|
||||
1) *
|
||||
distance
|
||||
}米处`;
|
||||
)}侧设备约${(Number(
|
||||
position.substring(position.indexOf("_") + 1, position.lastIndexOf("_"))
|
||||
) +
|
||||
1) *
|
||||
distance
|
||||
}米处`;
|
||||
}
|
||||
|
||||
function equal(str) {
|
||||
|
||||
@@ -13,6 +13,7 @@ function handleLoadedDevice(model) {
|
||||
const wp = this.targetPoint.getWorldPosition(new this.THREE.Vector3());
|
||||
model.position.copy(wp);
|
||||
this.targetPoint.visible = false;
|
||||
model.scale = 0.1
|
||||
|
||||
this.scene.add(model);
|
||||
if (model.name === "camera") {
|
||||
@@ -20,6 +21,7 @@ function handleLoadedDevice(model) {
|
||||
model.translateZ(4);
|
||||
model.translateY(-0.5);
|
||||
}
|
||||
|
||||
// 添加的信息请求或初始化的信息
|
||||
this.targetPoint.info = {
|
||||
name: "摄像头",
|
||||
|
||||
@@ -309,12 +309,18 @@ export default class Demo {
|
||||
this.tagCSS2DObj.element.style.display = "none";
|
||||
this.tag2CSS2DObj.element.style.display = "none";
|
||||
this.tag3CSS2DObj.element.style.display = "none";
|
||||
|
||||
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.1, 0.1, 0.1);
|
||||
this.tag3CSS2DObj.position.y = 1000;
|
||||
|
||||
|
||||
this.tagCSS2DObj.scale.set(3, 3, 3);
|
||||
|
||||
}
|
||||
|
||||
|
||||
clearTagsObj() {
|
||||
if (this.preDBLModel) {
|
||||
this.preDBLModel.remove(this.tagCSS2DObj);
|
||||
@@ -372,12 +378,7 @@ export default class Demo {
|
||||
setDistance(distance = 10) {
|
||||
this.distance = distance;
|
||||
}
|
||||
loadBackground(hdrLoader, backColorSet) {
|
||||
// hdrLoader.load("/images/background/background.hdr", (texture) => {
|
||||
// texture.mapping = this.THREE.EquirectangularReflectionMapping;
|
||||
// this.scene.background = texture;
|
||||
// this.scene.environment = texture;
|
||||
// })
|
||||
loadBackground(backColorSet) {
|
||||
this.scene.background = new this.THREE.TextureLoader().load("/images/background/background.png", function (texture) {
|
||||
texture.encoding = backColorSet;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user