setColor() fires onChange()
Closed this issue · 3 comments
proevilz commented
It's pretty much as the title suggest.
In my project, I offer a separate input field to type a hex code and I use setColor()
to sync it to the color picker. The only issue is that I also use the onChange()
to do a bunch of stuff too but the setColor()
fires it.
This leads to unexpected behavior...
How can I use setColor()
and not fire onChange()
simultaneously?
Sphinxxxx commented
Sorry, you can't. But you can tell yourself that you are currently syncing colors, so the onChange
handler doesn't have to do anything. For example:
var justSyncingColors = false;
...
justSyncingColors = true;
picker.setColor(myNewColor);
justSyncingColors = false;
...
function myChangeHandler(color) {
if(justSyncingColors) { return; }
...
}
Maybe a silent
parameter in setColor()
would be a good idea for a later release..
proevilz commented
I see.
Thanks for the suggestion and yes a silent
feature would be most appreciated.
Sphinxxxx commented
Fixed in v2.4.0