From cde33ae9a00845313f3508337fe1c290ac4264b7 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Fri, 3 Jan 2020 10:27:21 +0800 Subject: [PATCH] CHART-12259 && BI-58432 --- changelog.md | 3 +++ src/widget/datetimepane/card.static.datetimepane.js | 3 +-- src/widget/singleslider/singleslider.js | 4 +++- src/widget/singleslider/singleslider.label.js | 2 +- src/widget/singleslider/singleslider.normal.js | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 251859dd5..1c0dec991 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # 更新日志 +2.0(2020-1) +- 修复单值系滑块滑动松手后发两次EVENT_CHANGE的问题 + 2.0(2019-12) - 修复多层级单选下拉树主动设置container后搜索面板弹出问题 - bi.search_editor支持搜索中间含有空格的字符串 diff --git a/src/widget/datetimepane/card.static.datetimepane.js b/src/widget/datetimepane/card.static.datetimepane.js index c94f7592d..f17fe9104 100644 --- a/src/widget/datetimepane/card.static.datetimepane.js +++ b/src/widget/datetimepane/card.static.datetimepane.js @@ -36,8 +36,7 @@ BI.StaticDateTimePaneCard = BI.inherit(BI.Widget, { } self.selectedTime = BI.extend(self.selectedTime, { year: value.year, - month: value.month, - day: day + month: value.month }); day !== 0 && (self.selectedTime.day = day); self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime)); diff --git a/src/widget/singleslider/singleslider.js b/src/widget/singleslider/singleslider.js index c3c8e2c6e..1a1f1aabe 100644 --- a/src/widget/singleslider/singleslider.js +++ b/src/widget/singleslider/singleslider.js @@ -52,7 +52,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { }); // 这边其实是有问题的,拖拽区域是个圆,在圆的边缘拖拽后放开,这边计算出来的蓝条宽度实际上会比放开时长一点或者短一点 sliderVertical.element.click(function (e) { - if (self.enable && self.isEnabled()) { + if (self.enable && self.isEnabled() && sliderVertical.element[0] === e.originalEvent.target) { var offset = e.clientX - self.element.offset().left - c.SLIDER_WIDTH_HALF; var trackLength = self.track.element[0].scrollWidth - c.TRACK_GAP; var percent = 0; @@ -71,6 +71,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { v = o.digit === false ? v : v.toFixed(o.digit); self.label.setValue(v); self.value = v; + console.log("click"); self.fireEvent(BI.SingleSlider.EVENT_CHANGE); } }); @@ -173,6 +174,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { } widget.element.removeClass("dragging"); mouseMoveTracker.releaseMouseMoves(); + console.log("drag"); self.fireEvent(BI.SingleSlider.EVENT_CHANGE); }, window); widget.element.on("mousedown", function (event) { diff --git a/src/widget/singleslider/singleslider.label.js b/src/widget/singleslider/singleslider.label.js index 034d22f14..fce46f013 100644 --- a/src/widget/singleslider/singleslider.label.js +++ b/src/widget/singleslider/singleslider.label.js @@ -54,7 +54,7 @@ BI.SingleSliderLabel = BI.inherit(BI.Single, { height: c.SLIDER_HEIGHT }); sliderVertical.element.click(function (e) { - if (self.enable && self.isEnabled()) { + if (self.enable && self.isEnabled() && sliderVertical.element[0] === e.originalEvent.target) { var offset = e.clientX - self.element.offset().left - c.SLIDER_WIDTH_HALF; var trackLength = self.track.element[0].scrollWidth - c.TRACK_GAP; var percent = 0; diff --git a/src/widget/singleslider/singleslider.normal.js b/src/widget/singleslider/singleslider.normal.js index 347906fae..2ba74c8b9 100644 --- a/src/widget/singleslider/singleslider.normal.js +++ b/src/widget/singleslider/singleslider.normal.js @@ -42,7 +42,7 @@ BI.SingleSliderNormal = BI.inherit(BI.Single, { height: c.SLIDER_HEIGHT }); sliderVertical.element.click(function (e) { - if (self.enable && self.isEnabled()) { + if (self.enable && self.isEnabled() && sliderVertical.element[0] === e.originalEvent.target) { var offset = e.clientX - self.element.offset().left - c.SLIDER_WIDTH_HALF; var trackLength = self.track.element[0].scrollWidth - c.TRACK_GAP; var percent = 0;