Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[bug]: Fixed range slider null selection bug (#1413)

Shan He173811a34d3b
diff --git a/src/components/common/range-brush.js b/src/components/common/range-brush.js
index 04e12ce25..45c1abf0a 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;