-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to change the color without triggering the changed event #11
Comments
Thanks for the suggestion! I agree that this would be useful, so I shall try to add it when possible. It will be a little difficult, since right now it works like this:
I'll see what I can do though :) |
Just pushed changes; now you can manually change the current color value without firing the Example: var example = new iro.ColorPicker("#example");
example.on("color:change", function(color) {
// get the current hsv value
var hsv = color.hsv;
// make changes to it
hsv.h = 360;
// set the color without triggering color:change
color.set(hsv);
// manually force the UI to update if you want
color.forceUpdate();
});
-- I should say this solution is rather hacky, I'll see if I can find a better way to solve this problem in the future. |
Thanks! |
above code
i used below syntax but i am getting error |
@ibalaji777 This answer is outdated; you can now change the color in an event callback without any extra steps: Updated example: var example = new iro.ColorPicker("#example");
example.on("color:change", function(color) {
// get the current hsv value
var hsv = color.hsv;
// make changes to it
hsv.h = 360;
// set the color without triggering color:change
color.set(hsv);
}); |
I would like to have a method for changing the current color so that this change would not trigger the
color:change
event. This would be useful for example when you want to set the color inside thecolor:change
handler function in response to some changes. Otherwise it might create even an infinite event loop.The text was updated successfully, but these errors were encountered: