shx-3d-render
parent
4525afbb7b
commit
593a7671c5
|
@ -429,10 +429,15 @@
|
|||
<div id="${inputID}" class="shx-ifc-watchselect">
|
||||
`;
|
||||
|
||||
|
||||
// Iterate over the Map
|
||||
for (let swatch in options) {
|
||||
|
||||
setTimeout(() => {
|
||||
document.querySelector(`#${inputID}-${swatch}`).addEventListener('change', (event) => {
|
||||
document.querySelector('shx-input-forms').updateSelectSwatch(event, inputID, swatch, options);
|
||||
});
|
||||
}, 500);
|
||||
|
||||
let swatchObj = options[swatch];
|
||||
|
||||
console.log("swatch",swatch);
|
||||
|
@ -479,7 +484,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_genSwatchSelect('shx-color', 'Vordere Oberfläche', 'Vordere Oberfläche', 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;
|
||||
|
@ -728,24 +733,27 @@
|
|||
|
||||
}
|
||||
|
||||
updateSelectSwatch(event) {
|
||||
let target = event.target;
|
||||
//let input = target.previousElementSibling;
|
||||
//input.checked = true;
|
||||
updateSelectColorSwatch(event) {
|
||||
let target = event.target;
|
||||
|
||||
// .shx-ifc-form_label_selected_${input.id}
|
||||
|
||||
// the the last - and get the id
|
||||
let inputID = target.id.slice(0, target.id.lastIndexOf('-'));
|
||||
let filamentID = target.id.slice(target.id.lastIndexOf('-') + 1);
|
||||
|
||||
console.log("input.id", target.id, "inputID", inputID, "filamentID", filamentID);
|
||||
|
||||
let filament = SHX_getFilamentById(filamentID);
|
||||
document.querySelector('.shx-ifc-form_label_selected_' + inputID).innerHTML = filament.name;
|
||||
|
||||
|
||||
this.renderView(50);
|
||||
this.renderView(200);
|
||||
}
|
||||
|
||||
updateSelectSwatch(event, inputID, swatch, options) {
|
||||
let target = event.target;
|
||||
|
||||
document.querySelector('.shx-ifc-form_label_selected_' + inputID).innerHTML = options[swatch].name;
|
||||
|
||||
|
||||
this.renderView(200);
|
||||
}
|
||||
|
||||
reloadCurrentVariant(id, openAnimation = false) {
|
||||
|
@ -769,7 +777,7 @@
|
|||
|
||||
for(let i = 0; i < inputs.length; i++) {
|
||||
if(inputs[i].type === 'radio') {
|
||||
inputs[i].addEventListener('change', this.updateSelectSwatch.bind(this));
|
||||
inputs[i].addEventListener('change', this.updateSelectColorSwatch.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue