mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-01 02:53:15 +01:00
Merge pull request #101 from orangemug/fix/issue-44
Alpha value slider fix (#44)
This commit is contained in:
commit
68859d279d
1 changed files with 11 additions and 2 deletions
|
@ -50,11 +50,20 @@ class ColorField extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
get color() {
|
get color() {
|
||||||
return Color(this.props.value || '#fff')
|
return Color(this.props.value || '#fff').rgb()
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const offset = this.calcPickerOffset()
|
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
|
const picker = <div
|
||||||
className="maputnik-color-picker-offset"
|
className="maputnik-color-picker-offset"
|
||||||
style={{
|
style={{
|
||||||
|
@ -64,7 +73,7 @@ class ColorField extends React.Component {
|
||||||
top: offset.top,
|
top: offset.top,
|
||||||
}}>
|
}}>
|
||||||
<ChromePicker
|
<ChromePicker
|
||||||
color={this.color.object()}
|
color={currentColor}
|
||||||
onChange={c => this.props.onChange(formatColor(c))}
|
onChange={c => this.props.onChange(formatColor(c))}
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
|
|
Loading…
Reference in a new issue