mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2025-03-13 22:50:01 -04:00
Enforce state update before propogating change through props.
This commit is contained in:
parent
243b8ccbb6
commit
0279ba095c
1 changed files with 9 additions and 6 deletions
|
@ -68,16 +68,19 @@ class ColorPicker extends React.Component {
|
|||
[50, 100, 100] : colorStringToHsv(color);
|
||||
}
|
||||
handleHueChange (hue) {
|
||||
this.setState({hue: hue});
|
||||
this.handleColorChange();
|
||||
this.setState({hue: hue}, () => {
|
||||
this.handleColorChange();
|
||||
});
|
||||
}
|
||||
handleSaturationChange (saturation) {
|
||||
this.setState({saturation: saturation});
|
||||
this.handleColorChange();
|
||||
this.setState({saturation: saturation}, () => {
|
||||
this.handleColorChange();
|
||||
});
|
||||
}
|
||||
handleBrightnessChange (brightness) {
|
||||
this.setState({brightness: brightness});
|
||||
this.handleColorChange();
|
||||
this.setState({brightness: brightness}, () => {
|
||||
this.handleColorChange();
|
||||
});
|
||||
}
|
||||
handleColorChange () {
|
||||
this.props.onChangeColor(hsvToHex(
|
||||
|
|
Loading…
Reference in a new issue