shx-3d-render

main
Jan Umbach 2024-06-23 12:25:03 +02:00
parent c97852ff20
commit 04fdb285f9
1 changed files with 31 additions and 0 deletions

View File

@ -407,6 +407,36 @@
return html;
}
function SHX_IFC_genSwatchSelect(inputID, labelText, inputName, inputVal, options, section_id) {
let html = `
<label class="form__label custom shx-ifc-form_label" for="${inputID}-label">${labelText}: <span class="shx-ifc-form_label_selected shx-ifc-form_label_selected_${inputID}">${SHX_getFilamentById(inputVal).name}</span></label>
<div id="${inputID}" class="shx-ifc-colorselect">
`;
// Iterate over the Map
for (let swatch in options) {
let swatchObj = options[swatch];
console.log("swatch",swatch);
html += `
<input type="radio" id="${inputID}-${swatch}" form="product-form-${section_id}" name="properties[${inputName}]" value="${swatchObj.name} #${color}" ${inputVal === swatch ? 'checked' : ''}>
<label for="${inputID}-${swatch}" style="background-color: #f55;">
`;
html += `</label>`;
}
html += `</div>`;
return html;
}
const defaultStyle = `<style>.custom.form__label{margin-bottom: 0.6rem}.field.custom{margin-top: 0.6rem}.custom .field__input{padding-top:0.8rem}</style>`;
let globalInputFormsObj = {
@ -436,6 +466,7 @@
html += SHX_IFC_genTextInput('shx-text1', 'Custom Text 1', 'Text', globalInputFormsObjValues['TextOne']['text1'], section_id);
html += SHX_IFC_genDropdownSelect('shx-font', 'Schriftart', 'Schriftart', globalInputFormsObjValues['TextOne']['font'], ['LT Beverage', "Rose", 'Arial'], section_id);
html += SHX_IFC_genSwatchSelect('shx-color', 'Farbe', 'Farbe', globalInputFormsObjValues['TextOne']['surface_finish'], {"matte": {name: "Matt"}, "silk": {name: "Glänzend"}}, section_id);
html += SHX_IFC_genColorSelect('shx-color', 'Farbe', 'Farbe', globalInputFormsObjValues['TextOne']['color'], [], section_id);
return html;