You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/07/25 15:36:41 UTC
[incubator-echarts] branch datazoom-brush updated: fix(dataZoom):
optimize brushing interaction
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch datazoom-brush
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/datazoom-brush by this push:
new d330531 fix(dataZoom): optimize brushing interaction
d330531 is described below
commit d330531ce036e9da041d345ef2c9e73da4fffa20
Author: pissang <bm...@gmail.com>
AuthorDate: Sat Jul 25 23:36:16 2020 +0800
fix(dataZoom): optimize brushing interaction
---
src/component/dataZoom/SliderZoomView.ts | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/component/dataZoom/SliderZoomView.ts b/src/component/dataZoom/SliderZoomView.ts
index f18bf3c..f9cc371 100644
--- a/src/component/dataZoom/SliderZoomView.ts
+++ b/src/component/dataZoom/SliderZoomView.ts
@@ -107,6 +107,7 @@ class SliderZoomView extends DataZoomView {
private _location: PointLike;
private _brushStart: PointLike;
+ private _brushStartTime: number;
private _dragging: boolean;
@@ -847,6 +848,8 @@ class SliderZoomView extends DataZoomView {
this._brushStart = new graphic.Point(x, y);
this._brushing = true;
+
+ this._brushStartTime = +new Date();
// this._updateBrushRect(x, y);
}
@@ -856,14 +859,25 @@ class SliderZoomView extends DataZoomView {
}
const brushRect = this._displayables.brushRect;
- if (brushRect) {
- brushRect.ignore = true;
- }
this._brushing = false;
+ if (!brushRect) {
+ return;
+ }
+
+ brushRect.attr('ignore', true);
+
+ const brushShape = brushRect.shape;
+
+ const brushEndTime = +new Date();
+ // console.log(brushEndTime - this._brushStartTime);
+ if (brushEndTime - this._brushStartTime < 200 && Math.abs(brushShape.width) < 5) {
+ // Will treat it as a click
+ return;
+ }
+
const viewExtend = this._getViewExtent();
const percentExtent = [0, 100];
- const brushShape = brushRect.shape;
this._range = asc([
linearMap(brushShape.x, viewExtend, percentExtent, true),
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org