From 29b08f4d5585c6d53457f488f7de733b05fa3b1e Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 24 Oct 2019 18:19:25 +0800 Subject: [PATCH] =?UTF-8?q?CHART-10863=20fix:=20=E7=94=A8=E7=9A=84gap?= =?UTF-8?q?=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/singleslider/singleslider.js | 12 +++++++----- src/widget/singleslider/singleslider.label.js | 12 +++++++----- src/widget/singleslider/singleslider.normal.js | 12 +++++++----- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/widget/singleslider/singleslider.js b/src/widget/singleslider/singleslider.js index 243e1c5b2d..c3c8e2c6e7 100644 --- a/src/widget/singleslider/singleslider.js +++ b/src/widget/singleslider/singleslider.js @@ -8,7 +8,9 @@ BI.SingleSlider = BI.inherit(BI.Single, { SLIDER_WIDTH_HALF: 15, SLIDER_WIDTH: 30, SLIDER_HEIGHT: 30, - TRACK_HEIGHT: 24 + TRACK_HEIGHT: 24, + TRACK_GAP_HALF: 7, + TRACK_GAP: 14 }, props: { @@ -52,15 +54,15 @@ BI.SingleSlider = BI.inherit(BI.Single, { sliderVertical.element.click(function (e) { if (self.enable && self.isEnabled()) { var offset = e.clientX - self.element.offset().left - c.SLIDER_WIDTH_HALF; - var trackLength = self.track.element[0].scrollWidth; + var trackLength = self.track.element[0].scrollWidth - c.TRACK_GAP; var percent = 0; if (offset < 0) { percent = 0; } - if (offset > 0 && offset < (trackLength - c.SLIDER_WIDTH)) { + if (offset > 0 && offset < trackLength) { percent = offset * 100 / self._getGrayTrackLength(); } - if (offset > (trackLength - c.SLIDER_WIDTH)) { + if (offset >= trackLength) { percent = 100; } var significantPercent = BI.parseFloat(percent.toFixed(1)); @@ -111,7 +113,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { height: c.TRACK_HEIGHT }] }], - hgap: 7, + hgap: c.TRACK_GAP_HALF, height: c.TRACK_HEIGHT }, top: 23, diff --git a/src/widget/singleslider/singleslider.label.js b/src/widget/singleslider/singleslider.label.js index ff1d356072..034d22f141 100644 --- a/src/widget/singleslider/singleslider.label.js +++ b/src/widget/singleslider/singleslider.label.js @@ -9,7 +9,9 @@ BI.SingleSliderLabel = BI.inherit(BI.Single, { SLIDER_WIDTH_HALF: 15, SLIDER_WIDTH: 30, SLIDER_HEIGHT: 30, - TRACK_HEIGHT: 24 + TRACK_HEIGHT: 24, + TRACK_GAP_HALF: 7, + TRACK_GAP: 14 }, _defaultConfig: function () { return BI.extend(BI.SingleSliderLabel.superclass._defaultConfig.apply(this, arguments), { @@ -54,15 +56,15 @@ BI.SingleSliderLabel = BI.inherit(BI.Single, { sliderVertical.element.click(function (e) { if (self.enable && self.isEnabled()) { var offset = e.clientX - self.element.offset().left - c.SLIDER_WIDTH_HALF; - var trackLength = self.track.element[0].scrollWidth; + var trackLength = self.track.element[0].scrollWidth - c.TRACK_GAP; var percent = 0; if (offset < 0) { percent = 0; } - if (offset > 0 && offset < (trackLength - c.SLIDER_WIDTH)) { + if (offset > 0 && offset < trackLength) { percent = offset * 100 / self._getGrayTrackLength(); } - if (offset > (trackLength - c.SLIDER_WIDTH)) { + if (offset >= trackLength) { percent = 100; } var significantPercent = BI.parseFloat(percent.toFixed(1)); @@ -95,7 +97,7 @@ BI.SingleSliderLabel = BI.inherit(BI.Single, { height: c.TRACK_HEIGHT }] }], - hgap: 7, + hgap: c.TRACK_GAP_HALF, height: c.TRACK_HEIGHT }, top: 13, diff --git a/src/widget/singleslider/singleslider.normal.js b/src/widget/singleslider/singleslider.normal.js index 965a28cc09..347906fae3 100644 --- a/src/widget/singleslider/singleslider.normal.js +++ b/src/widget/singleslider/singleslider.normal.js @@ -9,7 +9,9 @@ BI.SingleSliderNormal = BI.inherit(BI.Single, { SLIDER_WIDTH_HALF: 15, SLIDER_WIDTH: 30, SLIDER_HEIGHT: 30, - TRACK_HEIGHT: 24 + TRACK_HEIGHT: 24, + TRACK_GAP_HALF: 7, + TRACK_GAP: 14 }, props: { @@ -42,15 +44,15 @@ BI.SingleSliderNormal = BI.inherit(BI.Single, { sliderVertical.element.click(function (e) { if (self.enable && self.isEnabled()) { var offset = e.clientX - self.element.offset().left - c.SLIDER_WIDTH_HALF; - var trackLength = self.track.element[0].scrollWidth; + var trackLength = self.track.element[0].scrollWidth - c.TRACK_GAP; var percent = 0; if (offset < 0) { percent = 0; } - if (offset > 0 && offset < (trackLength - c.SLIDER_WIDTH)) { + if (offset > 0 && offset < trackLength) { percent = offset * 100 / self._getGrayTrackLength(); } - if (offset > (trackLength - c.SLIDER_WIDTH)) { + if (offset >= trackLength) { percent = 100; } var significantPercent = BI.parseFloat(percent.toFixed(1)); @@ -75,7 +77,7 @@ BI.SingleSliderNormal = BI.inherit(BI.Single, { height: c.TRACK_HEIGHT }] }], - hgap: 7, + hgap: c.TRACK_GAP_HALF, height: c.TRACK_HEIGHT }, top: 3,