pmndrs / leva

🌋 React-first components GUI
https://leva.pmnd.rs
MIT License
5.04k stars 202 forks source link

help in using setter function with folder #491

Open rmrbytes opened 9 months ago

rmrbytes commented 9 months ago

Hello:

I am using a folder as below:

const r1 = useControls({Blue: folder({
        x: {value: ring1json.position[0], min: -3, max: 3, step:0.1},
        y: {value: ring1json.position[1], min: 0.08, max: 2, step: 0.2},
        z: {value: ring1json.position[2], min: -3, max: 3, step: 0.1},
        move: {value: true}
    })});

I need to disable x, y, z when move is set to false. So I assume I need to use the set function for r1 and update the disable attribute of x, y and z. However, when I am trying to add the set function I get an "object is not iterable error"

I have tried

const [{r1}, setR1] = ...

const[r1, setR1] = ....

What is the correct syntax to get the set function? Thanks