Skip to content

Commit

Permalink
Reduce push delay.
Browse files Browse the repository at this point in the history
  • Loading branch information
zebulonj committed Sep 7, 2018
1 parent 6e49581 commit 7228c18
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/javascript/components/ScoreInput/ScoreInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ export class ScoreInput extends Component {
}

onClick( evt ) {
const { onChange } = this.props;
const { left, width } = evt.target.getBoundingClientRect();
const score = Math.min( 1, Math.max( 0, ( evt.clientX - left ) / width ) );

this.setState({ score: Math.min( 1, Math.max( 0, ( evt.clientX - left ) / width ) ) });
this.setState({ score });
onChange( score );
}

onMouseDown( evt ) {
Expand All @@ -42,7 +45,10 @@ export class ScoreInput extends Component {
}

onMouseUp() {
const { onChange } = this.props;
this.setState({ engaged: false });

onChange( this.state.score );
}

onMouseMove( evt ) {
Expand Down

0 comments on commit 7228c18

Please sign in to comment.