Merge pull request #101 from orangemug/fix/issue-44

Alpha value slider fix (#44)
This commit is contained in:
Lukas Martinelli 2017-03-07 10:12:17 -05:00 committed by GitHub
commit 68859d279d

View file

@ -50,11 +50,20 @@ class ColorField extends React.Component {
}
get color() {
return Color(this.props.value || '#fff')
return Color(this.props.value || '#fff').rgb()
}
render() {
const offset = this.calcPickerOffset()
var currentColor = this.color.object()
currentColor = {
r: currentColor.r,
g: currentColor.g,
b: currentColor.b,
// Rename alpha -> a for ChromePicker
a: currentColor.alpha
}
const picker = <div
className="maputnik-color-picker-offset"
style={{
@ -64,7 +73,7 @@ class ColorField extends React.Component {
top: offset.top,
}}>
<ChromePicker
color={this.color.object()}
color={currentColor}
onChange={c => this.props.onChange(formatColor(c))}
/>
<div