shx-3d-render
parent
d2a6089c9c
commit
ed489ed1db
|
@ -237,14 +237,14 @@
|
|||
|
||||
|
||||
let html = `
|
||||
<label class="form__label custom shx-ifc-form_label" for="${inputID}-label">${labelText}: <span class="shx-ifc-form_label_selected">${SHX_getFilamentById(inputVal).name}</span></label>
|
||||
<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">
|
||||
`;
|
||||
|
||||
for(let color in options) {
|
||||
html += `
|
||||
<input type="radio" id="${inputID}-${color}" form="product-form-${section_id}" name="properties[${inputName}]" value="${options[color].name} #${color}" ${inputVal === color ? 'checked' : ''}>
|
||||
<label for="${inputID}-${color}" style="background-color: ${options[color].hex};"></label>
|
||||
<input type="radio" id="${inputID}-${color}" form="product-form-${section_id}" name="properties[${inputName}]" value="${options[color].name} #${color}" ${inputVal === color ? 'checked' : ''}>
|
||||
<label for="${inputID}-${color}" style="background-color: ${options[color].hex};"></label>
|
||||
`;
|
||||
}
|
||||
|
||||
|
@ -478,7 +478,15 @@
|
|||
let input = target.previousElementSibling;
|
||||
input.checked = true;
|
||||
|
||||
target.closest('.shx-ifc-form_label').querySelector('.shx-ifc-form_label_selected').innerText = target.nextElementSibling.innerText;
|
||||
// .shx-ifc-form_label_selected_${input.id}
|
||||
|
||||
// the the last - and get the id
|
||||
let inputID = input.id.slice(0, input.id.lastIndexOf('-'));
|
||||
let filamentID = input.id.slice(inputID.indexOf('-') + 1);
|
||||
|
||||
let filament = SHX_getFilamentById(filamentID);
|
||||
document.querySelector('.shx-ifc-form_label_selected_' + inputID).innerHTML = filament.name;
|
||||
|
||||
|
||||
this.renderView();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue