cleanup, few fixes
This commit is contained in:
@@ -14,7 +14,6 @@ const Customizer = () => {
|
|||||||
const handleRender2 = ()=>handleRender(getParams(ref.current))
|
const handleRender2 = ()=>handleRender(getParams(ref.current))
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
console.log({ jsCadCustomizerElement, customizerParams, lastParameters })
|
|
||||||
if (jsCadCustomizerElement && customizerParams) {
|
if (jsCadCustomizerElement && customizerParams) {
|
||||||
genParams(customizerParams, jsCadCustomizerElement, lastParameters || {}, (values, source)=>{
|
genParams(customizerParams, jsCadCustomizerElement, lastParameters || {}, (values, source)=>{
|
||||||
if(source === 'group'){
|
if(source === 'group'){
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ export const render: DefaultKernelExport['render'] = async ({
|
|||||||
if (data.error) {
|
if (data.error) {
|
||||||
response = createUnhealthyResponse(new Date(), data.error)
|
response = createUnhealthyResponse(new Date(), data.error)
|
||||||
} else {
|
} else {
|
||||||
console.log('lastParameters',lastParameters)
|
|
||||||
response = createHealthyResponse({
|
response = createHealthyResponse({
|
||||||
type: 'geometry',
|
type: 'geometry',
|
||||||
data: [...data.entities.map(CSG2Object3D).filter((o) => o)],
|
data: [...data.entities.map(CSG2Object3D).filter((o) => o)],
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export function genParams(defs, target, storedParams={}, callback=undefined, but
|
|||||||
let ret = '<div type="radio">'
|
let ret = '<div type="radio">'
|
||||||
|
|
||||||
for(let i =0; i<values.length; i++){
|
for(let i =0; i<values.length; i++){
|
||||||
let checked = (value == values[i] || value == captions[i] ) ? 'selected':''
|
let checked = (value == values[i] || value == captions[i] ) ? 'checked':''
|
||||||
ret += `<label><input type="radio" _type="${type}" name="${name}" numeric="${typeof values[0] == 'number' ? '1':'0'}" value="${values[i]}" ${checked}/>${captions[i]}</label>`
|
ret += `<label><input type="radio" _type="${type}" name="${name}" numeric="${typeof values[0] == 'number' ? '1':'0'}" value="${values[i]}" ${checked}/>${captions[i]}</label>`
|
||||||
}
|
}
|
||||||
return ret +'</div>'
|
return ret +'</div>'
|
||||||
@@ -182,7 +182,10 @@ export function getParams(target){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(numeric[elem.getAttribute('type')] || elem.getAttribute('numeric') == '1') value = parseFloat(value || 0)
|
if(numeric[elem.getAttribute('type')] || elem.getAttribute('numeric') == '1') value = parseFloat(value || 0)
|
||||||
params[name] = value
|
|
||||||
|
if(elem.type == 'radio' && !elem.checked) return // skip if not checked radio button
|
||||||
|
|
||||||
|
params[name] = value
|
||||||
})
|
})
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ const getParameterDefinitions = ()=>{
|
|||||||
{ name: 'slider', type: 'slider', initial: 3, min: 1, max: 10, step: 1, caption: 'Slider:' },
|
{ name: 'slider', type: 'slider', initial: 3, min: 1, max: 10, step: 1, caption: 'Slider:' },
|
||||||
{ name: 'choice1', type: 'choice', caption: 'Dropdown Menu:', values: [0, 1, 2, 3], captions: ['No', 'Yes', 'Maybe', 'So so'], initial: 2 },
|
{ name: 'choice1', type: 'choice', caption: 'Dropdown Menu:', values: [0, 1, 2, 3], captions: ['No', 'Yes', 'Maybe', 'So so'], initial: 2 },
|
||||||
{ name: 'choice3', type: 'choice', caption: 'Dropdown Menu:', values: ['No', 'Yes', 'Maybe', 'So so'], initial: 'No' },
|
{ name: 'choice3', type: 'choice', caption: 'Dropdown Menu:', values: ['No', 'Yes', 'Maybe', 'So so'], initial: 'No' },
|
||||||
{ name: 'choice2', type: 'radio', caption: 'Radio Buttons:', values:[0, 1, 2, 3], captions: ['No', 'Yes', 'Maybe', 'So so'], initial: 5 },
|
{ name: 'choice2', type: 'radio', caption: 'Radio Buttons:', values:[0, 1, 2, 3], captions: ['No', 'Yes', 'Maybe', 'So so'], initial: 2 },
|
||||||
|
|
||||||
{ name: 'group3', type: 'group', initial: 'closed', caption: 'Group 3: Initially Closed Group' },
|
{ name: 'group3', type: 'group', initial: 'closed', caption: 'Group 3: Initially Closed Group' },
|
||||||
{ name: 'checkbox2', type: 'checkbox', checked: true, initial: '20', caption: 'Optional Checkbox:' },
|
{ name: 'checkbox2', type: 'checkbox', checked: true, initial: '20', caption: 'Optional Checkbox:' },
|
||||||
|
|||||||
@@ -179,6 +179,10 @@ input.error, textarea.error {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
#jscad-customizer-block > .form-line[type="checkbox"] > label > input{
|
||||||
|
position: absolute;
|
||||||
|
right: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
#jscad-customizer-block > .form-line > label i{
|
#jscad-customizer-block > .form-line > label i{
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
Reference in New Issue
Block a user