[前台] forge 突擊平面圖原點配合點位顏色

This commit is contained in:
Celeste 2023-05-30 16:01:26 +08:00
parent 7a6b2068bd
commit 7169c33dc3
5 changed files with 5656 additions and 5661 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -922,9 +922,9 @@ async function addHotPoint(data) {
return;
} else {
spriteColor = new THREE.Color(0xffffff);
spriteIcon = "/file/img/forge/hotspot.svg";
spriteIcon = "/file/img/forge/sensor_circle.svg";
if (location.href.indexOf("localhost:5966") != -1) {
spriteIcon = "/img/forge/hotspot.svg";
spriteIcon = "/img/forge/sensor_circle.svg";
}
}
@ -973,7 +973,7 @@ async function addHotPoint(data) {
// console.log(`Sprite clicked: ${event.dbId}`);
for (let i = dbIdStart; i <= myDataList.length + 10; i++) {
!alarmDbIdList.some((dbId) => dbId == i) &&
!alarmDbIdList.some(({ spriteDbid }) => spriteDbid == i) &&
pageAct.sysSubTag !== "L1" &&
changeColorForHotspot(i);
changeScaleForHotspot(i, true);
@ -990,7 +990,7 @@ async function addHotPoint(data) {
}
$(selector).trigger("autodesk:click:sprite", { event, myData });
} else {
!alarmDbIdList.some((dbId) => dbId == i) &&
!alarmDbIdList.some(({ spriteDbid }) => spriteDbid == event.dbId) &&
pageAct.sysSubTag !== "L1" &&
changeColorForHotspot(event.dbId, null);
changeScaleForHotspot(event.dbId, false);
@ -1038,25 +1038,47 @@ async function addHotPoint(data) {
//}
}
//hex -> rgbsensor_circle
function hexToRgb(hex) {
return (
"rgb(" +
parseInt("0x" + hex.slice(1, 3)) +
"," +
parseInt("0x" + hex.slice(3, 5)) +
"," +
parseInt("0x" + hex.slice(5, 7)) +
")"
);
}
// 熱點 更換顏色
async function changeColorForHotspot(dbId, type = null, lightOn = false) {
async function changeColorForHotspot(dbId, type = null, OnOff = false) {
const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
let spriteColorFocus = new THREE.Color(0xffffff);
if (pageAct.sysSubTag == "L1") {
spriteColorFocus = lightOn
? new THREE.Color(0xffd524)
: new THREE.Color(0x40525e);
if (lightOn) {
console.log(dbId);
}
} else if (type == "focus" && pageAct.sysSubTag !== "M12") {
spriteColorFocus = OnOff
? pageAct.sysSubObj.device_normal_color
? new THREE.Color(hexToRgb(pageAct.sysSubObj.device_normal_color))
: new THREE.Color(0xffffff)
: pageAct.sysSubObj.device_close_color
? new THREE.Color(hexToRgb(pageAct.sysSubObj.device_close_color))
: new THREE.Color(0xffffff);
if (type == "focus") {
spriteColorFocus = new THREE.Color(0x00ffe1);
} else if (type == "error") {
spriteColorFocus = new THREE.Color(0xff0000);
spriteColorFocus = new THREE.Color(
hexToRgb(pageAct.sysSubObj.device_error_color)
);
spriteErrIcon = baseForgeApiUrl + "/file/img/forge/sensor_circle.svg";
if (location.href.indexOf("localhost:5966") != -1) {
spriteErrIcon = baseForgeApiUrl + "/img/forge/sensor_circle.svg";
}
}
const viewablesToUpdate = dbId;
dataVizExtn.invalidateViewables(viewablesToUpdate, (viewable) => {
return {
url: "/file/img/forge/sensor_circle.svg",
color: spriteColorFocus,
};
});

File diff suppressed because it is too large Load Diff