shx-3d-render

main
Jan Umbach 2024-06-21 20:16:03 +02:00
parent ebb375a596
commit 597705687c
1 changed files with 42 additions and 4 deletions

View File

@ -91,6 +91,17 @@
<script type="text/javascript">
let FilamentList = {
"#10": {
"name": "Schwarz (Matt)",
"hex": "#000000"
},
"#11": {
"name": "Weiß (Matt)",
"hex": "#FFFFFF"
},
}
let globalInputFormsObjValues = {
"test1": {
@ -139,7 +150,21 @@
return html;
}
function SHX_IFC_genColorSelect(inputID, labelText, inputName, inputVal, options, section_id) {
function SHX_IFC_genColorSelect(inputID, labelText, inputName, inputVal, colorWhiteList, section_id) {
let options = {};
if(!colorWhiteList || colorWhiteList.length === 0) {
options = {...FilamentList};
} else for(let i = 0; i < colorWhiteList.length; i++) {
if(FilamentList[colorWhiteList[i]]) {
options[i] = FilamentList[colorWhiteList[i]];
} else {
console.error("Color not found in FilamentList", colorWhiteList[i]);
}
}
let html = `
<label class="form__label custom shx-ifc-form_label" for="${inputID}-label">${labelText}</label>
<div id="${inputID}" class="shx-ifc-colorselect">
@ -321,10 +346,23 @@
// update globalInputFormsObjValues from input fields
for(let key in globalInputFormsObj) {
if(key === this.currentVariant) {
let inputs = this.content.querySelectorAll('input');
let inputs = this.content.querySelectorAll('input');
for(let i = 0; i < inputs.length; i++) {
let name = inputs[i].id.replace('shx-', '');
globalInputFormsObjValues[key][name] = inputs[i].value;
let input = inputs[i];
if(input.type === 'radio') {
if(input.checked) {
let name = input.id.replace('shx-', '');
name = name.slice(0, name.indexOf('-'));
globalInputFormsObjValues[key][name] = input.value;
}
}
else {
let name = input.id.replace('shx-', '');
globalInputFormsObjValues[key][name] = input.value;
}
}
let selects = this.content.querySelectorAll('select');