[Frontend] 增加函式 移動視角至設備
This commit is contained in:
parent
46f9ca1642
commit
fac789c635
@ -726,7 +726,7 @@ async function getLightData(data) {
|
|||||||
async function testNewLight(dataList) {
|
async function testNewLight(dataList) {
|
||||||
dataList.forEach((myData, index) => {
|
dataList.forEach((myData, index) => {
|
||||||
const position = JSON.parse(myData.device_node_coordinate_3d);
|
const position = JSON.parse(myData.device_node_coordinate_3d);
|
||||||
lightList.push({ dbid: myData.forge_dbid, device_guid: myData.device_guid, lightObject: new THREE.SpotLight(0xff0000, 200, 20, 0.6, 0.5, 10) });
|
lightList.push({ dbid: myData.forge_dbid, device_guid: myData.device_guid, lightObject: new THREE.SpotLight(0xffffff, 200, 20, 0.6, 0.5, 10) });
|
||||||
|
|
||||||
lightList[index].lightObject.position.set(position.x, position.y, position.z);
|
lightList[index].lightObject.position.set(position.x, position.y, position.z);
|
||||||
lightList[index].lightObject.castShadow = true;
|
lightList[index].lightObject.castShadow = true;
|
||||||
@ -798,6 +798,7 @@ async function addHotPoint(data) {
|
|||||||
if (lightList != undefined && lightList != null && lightList.length > 0) {
|
if (lightList != undefined && lightList != null && lightList.length > 0) {
|
||||||
//setLightOpenOrClose(false, myData.device_guid);//關燈測試
|
//setLightOpenOrClose(false, myData.device_guid);//關燈測試
|
||||||
//setLightValues(myData.device_guid, 20, 0x00ff00);//更改燈光顏色和強度的測試
|
//setLightValues(myData.device_guid, 20, 0x00ff00);//更改燈光顏色和強度的測試
|
||||||
|
moveViewToDevice(myData.forge_dbid);//移動視角至該設備
|
||||||
}
|
}
|
||||||
$(selector).trigger("autodesk:click:sprite", { event, myData });
|
$(selector).trigger("autodesk:click:sprite", { event, myData });
|
||||||
} else {
|
} else {
|
||||||
@ -1170,4 +1171,15 @@ function setShadowShow(type = false) {
|
|||||||
viewer.impl.sceneUpdated(true);
|
viewer.impl.sceneUpdated(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
//============================= end ===================================
|
//============================= end ===================================
|
||||||
|
|
||||||
|
function moveViewToDevice(letter) {
|
||||||
|
if (letter != "") {
|
||||||
|
viewer.clearSelection();
|
||||||
|
viewer.select(letter);
|
||||||
|
viewer.fitToView([letter]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
viewer.clearSelection();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user