controlling a swatch with two dials - and vice-versa
Here's my patch, where I use two dials to control the Hue and Luminance values of a HSL colour definition, and feed that to a swatch object.
The swatch object is settable by clicking on it, and if the user does so, I want the dials to reflect this. So I've added this functionality in a kind of loopback (being careful not to actually create an infinite loop).
The patch works almost perfectly, except for one small thing - if you move the right hand dial, and then the left dial, the right dial jumps to the initial value of the left dial.
All my debugging efforts have not been able to figure out why this is happening, and so I'm hoping someone here can help.
Max Patch
Copy patch and select New From Clipboard in Max.
The patch includes a js object, the source file for which I have attached to this post.