mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Update the color sliders when eyedropper changes the value.
The hsv slider values are intentionally kept separate from the field value so they are more stable when changed. They are initialized when the editor is opened and only updated by the sliders. This was causing the sliders not to update when a new color was chosen via eyedropper. To get around this, manually update the internal hsv values when coming back from the eyedropper callback so that the sliders get updated (which happens in setValue).
This commit is contained in:
parent
1afb6a2c67
commit
678aa9d805
1 changed files with 5 additions and 0 deletions
|
@ -256,6 +256,11 @@ Blockly.FieldColourSlider.prototype.sliderCallbackFactory_ = function(channel) {
|
|||
Blockly.FieldColourSlider.prototype.activateEyedropperInternal_ = function() {
|
||||
var thisField = this;
|
||||
Blockly.FieldColourSlider.activateEyedropper_(function(value) {
|
||||
// Update the internal hue/saturation/brightness values so sliders update.
|
||||
var hsv = goog.color.hexToHsv(value);
|
||||
thisField.hue_ = hsv[0];
|
||||
thisField.saturation_ = hsv[1];
|
||||
thisField.brightness_ = hsv[2];
|
||||
thisField.setValue(value);
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue