diff --git a/Frontend/js/forge/forgemodel.js b/Frontend/js/forge/forgemodel.js index cffbc8d..131ea89 100644 --- a/Frontend/js/forge/forgemodel.js +++ b/Frontend/js/forge/forgemodel.js @@ -726,7 +726,7 @@ async function getLightData(data) { async function testNewLight(dataList) { dataList.forEach((myData, index) => { 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.castShadow = true; @@ -798,6 +798,7 @@ async function addHotPoint(data) { if (lightList != undefined && lightList != null && lightList.length > 0) { //setLightOpenOrClose(false, myData.device_guid);//關燈測試 //setLightValues(myData.device_guid, 20, 0x00ff00);//更改燈光顏色和強度的測試 + moveViewToDevice(myData.forge_dbid);//移動視角至該設備 } $(selector).trigger("autodesk:click:sprite", { event, myData }); } else { @@ -1170,4 +1171,15 @@ function setShadowShow(type = false) { viewer.impl.sceneUpdated(true); } -//============================= end =================================== \ No newline at end of file +//============================= end =================================== + +function moveViewToDevice(letter) { + if (letter != "") { + viewer.clearSelection(); + viewer.select(letter); + viewer.fitToView([letter]); + } + else { + viewer.clearSelection(); + } +} \ No newline at end of file