From 173811a34d3b957034968c2771cfa5333d2d94f6 Mon Sep 17 00:00:00 2001 From: Shan He Date: Sun, 21 Mar 2021 01:35:35 -0700 Subject: [PATCH] [bug]: Fixed range slider null selection bug (#1413) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Giuseppe Macri Co-authored-by: Giuseppe Macrì --- src/components/common/range-brush.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/common/range-brush.js b/src/components/common/range-brush.js index 04e12ce253..45c1abf0af 100644 --- a/src/components/common/range-brush.js +++ b/src/components/common/range-brush.js @@ -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;