|
|
@ -58,7 +58,8 @@ BI.SingleSlider = BI.inherit(BI.Single, { |
|
|
|
type: "bi.vertical_adapt", |
|
|
|
type: "bi.vertical_adapt", |
|
|
|
cls: "slider-wrapper", |
|
|
|
cls: "slider-wrapper", |
|
|
|
columnSize: ["fill"], |
|
|
|
columnSize: ["fill"], |
|
|
|
items: [{ |
|
|
|
items: [ |
|
|
|
|
|
|
|
{ |
|
|
|
type: "bi.absolute", |
|
|
|
type: "bi.absolute", |
|
|
|
items: [ |
|
|
|
items: [ |
|
|
|
{ |
|
|
|
{ |
|
|
@ -67,7 +68,8 @@ BI.SingleSlider = BI.inherit(BI.Single, { |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
], |
|
|
|
height: c.SLIDER_HEIGHT |
|
|
|
height: c.SLIDER_HEIGHT |
|
|
|
}], |
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
hgap: c.SLIDER_WIDTH_HALF, |
|
|
|
hgap: c.SLIDER_WIDTH_HALF, |
|
|
|
height: c.SLIDER_HEIGHT |
|
|
|
height: c.SLIDER_HEIGHT |
|
|
|
}); |
|
|
|
}); |
|
|
@ -124,17 +126,22 @@ BI.SingleSlider = BI.inherit(BI.Single, { |
|
|
|
this._setVisible(false); |
|
|
|
this._setVisible(false); |
|
|
|
return { |
|
|
|
return { |
|
|
|
type: "bi.absolute", |
|
|
|
type: "bi.absolute", |
|
|
|
items: [{ |
|
|
|
items: [ |
|
|
|
|
|
|
|
{ |
|
|
|
el: { |
|
|
|
el: { |
|
|
|
type: "bi.vertical", |
|
|
|
type: "bi.vertical", |
|
|
|
items: [{ |
|
|
|
items: [ |
|
|
|
|
|
|
|
{ |
|
|
|
type: "bi.absolute", |
|
|
|
type: "bi.absolute", |
|
|
|
items: [{ |
|
|
|
items: [ |
|
|
|
|
|
|
|
{ |
|
|
|
el: this.track, |
|
|
|
el: this.track, |
|
|
|
width: "100%", |
|
|
|
width: "100%", |
|
|
|
height: c.TRACK_HEIGHT |
|
|
|
height: c.TRACK_HEIGHT |
|
|
|
}] |
|
|
|
} |
|
|
|
}], |
|
|
|
] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
hgap: c.TRACK_GAP_HALF, |
|
|
|
hgap: c.TRACK_GAP_HALF, |
|
|
|
height: c.TRACK_HEIGHT |
|
|
|
height: c.TRACK_HEIGHT |
|
|
|
}, |
|
|
|
}, |
|
|
@ -149,16 +156,19 @@ BI.SingleSlider = BI.inherit(BI.Single, { |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
el: { |
|
|
|
el: { |
|
|
|
type: "bi.vertical", |
|
|
|
type: "bi.vertical", |
|
|
|
items: [{ |
|
|
|
items: [ |
|
|
|
|
|
|
|
{ |
|
|
|
type: "bi.horizontal_auto", |
|
|
|
type: "bi.horizontal_auto", |
|
|
|
items: [this.label] |
|
|
|
items: [this.label] |
|
|
|
}], |
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
// height: c.EDITOR_HEIGHT
|
|
|
|
// height: c.EDITOR_HEIGHT
|
|
|
|
}, |
|
|
|
}, |
|
|
|
top: 0, |
|
|
|
top: 0, |
|
|
|
left: 0, |
|
|
|
left: 0, |
|
|
|
width: "100%" |
|
|
|
width: "100%" |
|
|
|
}] |
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -198,7 +208,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { |
|
|
|
self.fireEvent(BI.SingleSlider.EVENT_CHANGE); |
|
|
|
self.fireEvent(BI.SingleSlider.EVENT_CHANGE); |
|
|
|
}, window); |
|
|
|
}, window); |
|
|
|
widget.element.on("mousedown", function (event) { |
|
|
|
widget.element.on("mousedown", function (event) { |
|
|
|
if(!widget.isEnabled()) { |
|
|
|
if (!widget.isEnabled()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
defaultSize = this.offsetLeft; |
|
|
|
defaultSize = this.offsetLeft; |
|
|
@ -206,7 +216,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { |
|
|
|
mouseMoveTracker.captureMouseMoves(event); |
|
|
|
mouseMoveTracker.captureMouseMoves(event); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function optimizeSize (s) { |
|
|
|
function optimizeSize(s) { |
|
|
|
return BI.clamp(s, 0, self._getGrayTrackLength()); |
|
|
|
return BI.clamp(s, 0, self._getGrayTrackLength()); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -214,12 +224,15 @@ BI.SingleSlider = BI.inherit(BI.Single, { |
|
|
|
_createTrackWrapper: function () { |
|
|
|
_createTrackWrapper: function () { |
|
|
|
return BI.createWidget({ |
|
|
|
return BI.createWidget({ |
|
|
|
type: "bi.absolute", |
|
|
|
type: "bi.absolute", |
|
|
|
items: [{ |
|
|
|
items: [ |
|
|
|
|
|
|
|
{ |
|
|
|
el: { |
|
|
|
el: { |
|
|
|
type: "bi.vertical", |
|
|
|
type: "bi.vertical", |
|
|
|
items: [{ |
|
|
|
items: [ |
|
|
|
|
|
|
|
{ |
|
|
|
type: "bi.absolute", |
|
|
|
type: "bi.absolute", |
|
|
|
items: [{ |
|
|
|
items: [ |
|
|
|
|
|
|
|
{ |
|
|
|
el: this.grayTrack, |
|
|
|
el: this.grayTrack, |
|
|
|
top: 0, |
|
|
|
top: 0, |
|
|
|
left: 0, |
|
|
|
left: 0, |
|
|
@ -229,15 +242,18 @@ BI.SingleSlider = BI.inherit(BI.Single, { |
|
|
|
top: 0, |
|
|
|
top: 0, |
|
|
|
left: 0, |
|
|
|
left: 0, |
|
|
|
width: "0%" |
|
|
|
width: "0%" |
|
|
|
}] |
|
|
|
} |
|
|
|
}], |
|
|
|
] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
hgap: 8, |
|
|
|
hgap: 8, |
|
|
|
height: 8 |
|
|
|
height: 8 |
|
|
|
}, |
|
|
|
}, |
|
|
|
top: 8, |
|
|
|
top: 8, |
|
|
|
left: 0, |
|
|
|
left: 0, |
|
|
|
width: "100%" |
|
|
|
width: "100%" |
|
|
|
}] |
|
|
|
} |
|
|
|
|
|
|
|
] |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -245,9 +261,9 @@ BI.SingleSlider = BI.inherit(BI.Single, { |
|
|
|
var o = this.options; |
|
|
|
var o = this.options; |
|
|
|
var valid = false; |
|
|
|
var valid = false; |
|
|
|
if (BI.isNumeric(v) && !(BI.isNull(v) || v < this.min || v > this.max)) { |
|
|
|
if (BI.isNumeric(v) && !(BI.isNull(v) || v < this.min || v > this.max)) { |
|
|
|
if(o.digit === false) { |
|
|
|
if (o.digit === false) { |
|
|
|
valid = true; |
|
|
|
valid = true; |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
var dotText = (v + "").split(".")[1] || ""; |
|
|
|
var dotText = (v + "").split(".")[1] || ""; |
|
|
|
valid = (dotText.length === o.digit); |
|
|
|
valid = (dotText.length === o.digit); |
|
|
|
} |
|
|
|
} |
|
|
@ -256,7 +272,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_setBlueTrack: function (percent) { |
|
|
|
_setBlueTrack: function (percent) { |
|
|
|
this.blueTrack.element.css({width: percent + "%"}); |
|
|
|
this.blueTrack.element.css({ width: percent + "%" }); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_setLabelPosition: function (percent) { |
|
|
|
_setLabelPosition: function (percent) { |
|
|
@ -264,7 +280,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_setSliderPosition: function (percent) { |
|
|
|
_setSliderPosition: function (percent) { |
|
|
|
this.slider.element.css({left: percent + "%"}); |
|
|
|
this.slider.element.css({ left: percent + "%" }); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_setAllPosition: function (percent) { |
|
|
|
_setAllPosition: function (percent) { |
|
|
@ -314,7 +330,7 @@ BI.SingleSlider = BI.inherit(BI.Single, { |
|
|
|
|
|
|
|
|
|
|
|
_setEnable: function (b) { |
|
|
|
_setEnable: function (b) { |
|
|
|
BI.SingleSlider.superclass._setEnable.apply(this, [b]); |
|
|
|
BI.SingleSlider.superclass._setEnable.apply(this, [b]); |
|
|
|
if(b) { |
|
|
|
if (b) { |
|
|
|
this.blueTrack.element.removeClass("disabled-blue-track").addClass("blue-track"); |
|
|
|
this.blueTrack.element.removeClass("disabled-blue-track").addClass("blue-track"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.blueTrack.element.removeClass("blue-track").addClass("disabled-blue-track"); |
|
|
|
this.blueTrack.element.removeClass("blue-track").addClass("disabled-blue-track"); |
|
|
@ -322,9 +338,9 @@ BI.SingleSlider = BI.inherit(BI.Single, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setMinAndMax: function (v) { |
|
|
|
setMinAndMax: function (v) { |
|
|
|
var minNumber = BI.parseFloat(v.min); |
|
|
|
var minNumber = this.options.min = BI.parseFloat(v.min); |
|
|
|
var maxNumber = BI.parseFloat(v.max); |
|
|
|
var maxNumber = this.options.max = BI.parseFloat(v.max); |
|
|
|
if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber > minNumber )) { |
|
|
|
if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber > minNumber)) { |
|
|
|
this.min = minNumber; |
|
|
|
this.min = minNumber; |
|
|
|
this.max = maxNumber; |
|
|
|
this.max = maxNumber; |
|
|
|
} |
|
|
|
} |
|
|
|