mirror of
https://github.com/maputnik/editor.git
synced 2025-12-25 15:40:00 +00:00
Fixed alpha value slider (fixes #44)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user