Browse Source

Merge pull request #1173 in VISUAL/fineui from ~WINDY/fineui:master to master

* commit '29b08f4d5585c6d53457f488f7de733b05fa3b1e':
  CHART-10863 fix: 用的gap不对
master
windy 5 years ago
parent
commit
77dd18402e
  1. 12
      src/widget/singleslider/singleslider.js
  2. 12
      src/widget/singleslider/singleslider.label.js
  3. 12
      src/widget/singleslider/singleslider.normal.js

12
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,

12
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,

12
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,

Loading…
Cancel
Save