Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleMouseMove(event) {
const { brush, onBrushDrag } = this.props;
// only update the brush region if we're dragging
if (!brush.isBrushing) return;
const { extent: region } = this;
const { x, y } = getCoordsFromEvent(this.svg, event);
onBrushDrag(constrainToRegion({ region, x, y }));
}
handleMouseDown(event) {
const { onBrushStart } = this.props;
const { extent: region } = this;
const { x, y } = getCoordsFromEvent(this.svg, event);
onBrushStart(constrainToRegion({ region, x, y }));
}
handleMouseUp(event) {
const { brush, onBrushEnd, onBrushReset } = this.props;
const { extent: region } = this;
if (brush.end) {
const { x, y } = getCoordsFromEvent(this.svg, event);
onBrushEnd(constrainToRegion({ region, x, y }));
return;
}
onBrushReset(event);
this.scaleReset();
}