mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2025-01-25 05:39:52 -05:00
Merge pull request #160 from paulkaplan/fix-slider-ranges
Make color sliders go from 0 to 100
This commit is contained in:
commit
8fdab88996
1 changed files with 1 additions and 1 deletions
|
@ -32,7 +32,7 @@ class SliderComponent extends React.Component {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const backgroundBBox = this.background.getBoundingClientRect();
|
const backgroundBBox = this.background.getBoundingClientRect();
|
||||||
const x = event.clientX - backgroundBBox.left;
|
const x = event.clientX - backgroundBBox.left;
|
||||||
this.props.onChange(Math.max(1, Math.min(99, 100 * x / backgroundBBox.width)));
|
this.props.onChange(Math.max(0, Math.min(100, 100 * x / backgroundBBox.width)));
|
||||||
}
|
}
|
||||||
|
|
||||||
setBackground (ref) {
|
setBackground (ref) {
|
||||||
|
|
Loading…
Reference in a new issue