Fixed alpha value slider (fixes #44)

This commit is contained in:
orangemug 2017-03-07 09:59:11 +00:00
parent bbf26a3f38
commit e3b4fe582b

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