#Preventing Infinite Recursion on Sliders

1 messages · Page 1 of 1 (latest)

dawn mesa
#

Hey there! I'm trying to create three sliders which sum to 100% (or 1.0, doesn't matter). So for example, if the sliders are 0.40, 0.40, 0.20, and the user changes the first slider to 0.85, the other two sliders should become 0.1 and 0.05 (proportionally the same). My current problem is that I'm using onValueChanged to change the values, which causes infinite recursion. What's a better way to flow the logic?

#

(i know i should use lists or arrays for my sliders, i'm just prototyping rn)

pure prism
#

But really, it would be easier if you just went the array method. Even for prototyping.

dawn mesa
#

Thanks!!!

dawn mesa
#

You mean just for making changes uniformly?

pure prism
#

You can just directly modify them, and you could easily cache the index of the one being controlled.