Skip to content

Commit 32b3048

Browse files
danboveyjsdario
authored andcommitted
Added onColorChangeComplete prop
1 parent 9f0245c commit 32b3048

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ColorWheel.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ export class ColorWheel extends Component {
6767
if (radius < 0.1) {
6868
this.forceUpdate('#ffffff')
6969
}
70+
71+
if (this.props.onColorChangeComplete) {
72+
this.props.onColorChangeComplete(this.state.hsv);
73+
}
7074
},
7175
})
7276
}
@@ -147,9 +151,10 @@ export class ColorWheel extends Component {
147151

148152
updateColor = ({nativeEvent}) => {
149153
const {deg, radius} = this.calcPolar(nativeEvent)
150-
const currentColor = colorsys.hsv2Hex({h: deg, s: 100 * radius, v: 100})
151-
this.setState({currentColor})
152-
this.props.onColorChange({h: deg, s: 100 * radius, v: 100})
154+
const hsv = {h: deg, s: 100 * radius, v: 100};
155+
const currentColor = colorsys.hsv2Hex(hsv)
156+
this.setState({hsv, currentColor})
157+
this.props.onColorChange(hsv);
153158
}
154159

155160
forceUpdate = color => {

0 commit comments

Comments
 (0)