From fac789c6351dbb41cfb20fe59f38ab2f90c228e8 Mon Sep 17 00:00:00 2001 From: wanli Date: Mon, 9 Jan 2023 17:09:44 +0800 Subject: [PATCH] =?UTF-8?q?[Frontend]=20=E5=A2=9E=E5=8A=A0=E5=87=BD?= =?UTF-8?q?=E5=BC=8F=20=E7=A7=BB=E5=8B=95=E8=A6=96=E8=A7=92=E8=87=B3?= =?UTF-8?q?=E8=A8=AD=E5=82=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/js/forge/forgemodel.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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