Skip to content

Commit

Permalink
[bug]: Fixed range slider null selection bug (#1413)
Browse files Browse the repository at this point in the history
Signed-off-by: Giuseppe Macri <macri.giuseppe@gmail.com>

Co-authored-by: Giuseppe Macrì <macri.giuseppe@gmail.com>
  • Loading branch information
heshan0131 and macrigiuseppe committed Mar 21, 2021
1 parent df3fee5 commit 173811a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/common/range-brush.js
Expand Up @@ -95,16 +95,22 @@ function RangeBrushFactory() {
return;
}
if (event.selection) {
this._lastSel = event.selection;
this.brushing = true;
this._brushed(event);
}
})
.on('end', event => {
if (!this.brushing && this._startSel && !event.selection) {
// handle click

this._click(this._startSel);
if (!event.selection) {
if (this.brushing) {
// handle null selection
this._click(this._lastSel);
} else if (this._startSel) {
// handle click
this._click(this._startSel);
}
}

if (typeof this.props.onBrushEnd === 'function') this.props.onBrushEnd();

this.brushing = false;
Expand Down

0 comments on commit 173811a

Please sign in to comment.