debounce function in continuous

This commit is contained in:
Colin Megill
2017-11-26 23:19:12 -08:00
parent 2af16dc4c6
commit 4a412bb05c
+9 -9
View File
@@ -106,16 +106,16 @@ class Continuous extends React.Component {
} }
} }
maybeDrawLines(nextProps) { maybeDrawLines = _.debounce((nextProps) => { /* https://stackoverflow.com/questions/23123138/perform-debounce-in-react-js */
if ( if (
nextProps.ranges && nextProps.ranges &&
nextProps.continuousSelection && nextProps.continuousSelection &&
nextProps.axesHaveBeenDrawn nextProps.axesHaveBeenDrawn
) { ) {
// if (this.state._drawLinesCanvas) { if (this.state._drawLinesCanvas) {
// this.state._drawLinesCanvas.invalidate(); /* this is only necessary if the internals of drawLinesCanvas are using the render queue */ this.state._drawLinesCanvas.invalidate(); /* this is only necessary if the internals of drawLinesCanvas are using the render queue */
// } }
this.state.ctx.clearRect(0, 0, width, height); this.state.ctx.clearRect(0, 0, width, height);
@@ -130,12 +130,12 @@ class Continuous extends React.Component {
nextProps.colorScale, nextProps.colorScale,
); );
// this.setState({ this.setState({
// // dimensions, // dimensions,
// _drawLinesCanvas, /* this will only exist if the internals of drawLinesCanvas are using the render queue */ _drawLinesCanvas, /* this will only exist if the internals of drawLinesCanvas are using the render queue */
// }) })
} }
} }, 200)
handleBrushAction (selection) { handleBrushAction (selection) {
this.props.dispatch({ this.props.dispatch({