mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2025-01-09 14:12:13 -05:00
Don't treat slider handles as background clicks
This commit is contained in:
parent
a436c6f3a8
commit
1d5b032c3d
1 changed files with 3 additions and 0 deletions
|
@ -47,6 +47,9 @@ class SliderComponent extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleClickBackground (event) {
|
handleClickBackground (event) {
|
||||||
|
// Because the slider handle is a child of the "background" element this handler is registered to, it calls this
|
||||||
|
// when clicked as well. We only want to change the slider value if the user clicked on the background itself.
|
||||||
|
if (event.target !== this.background) return;
|
||||||
// Move slider handle's center to the cursor
|
// Move slider handle's center to the cursor
|
||||||
this.handleClickOffset = HANDLE_WIDTH / 2;
|
this.handleClickOffset = HANDLE_WIDTH / 2;
|
||||||
this.props.onChange(this.scaleMouseToSliderPosition(event));
|
this.props.onChange(this.scaleMouseToSliderPosition(event));
|
||||||
|
|
Loading…
Reference in a new issue