git.ithinksw.org
/
extjs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Upgrade to ExtJS 3.1.0 - Released 12/16/2009
[extjs.git]
/
src
/
widgets
/
Slider.js
diff --git
a/src/widgets/Slider.js
b/src/widgets/Slider.js
index
c68049e
..
87dae02
100644
(file)
--- a/
src/widgets/Slider.js
+++ b/
src/widgets/Slider.js
@@
-1,5
+1,5
@@
/*!
/*!
- * Ext JS Library 3.
0
.0
+ * Ext JS Library 3.
1
.0
* Copyright(c) 2006-2009 Ext JS, LLC
* licensing@extjs.com
* http://www.extjs.com/license
* Copyright(c) 2006-2009 Ext JS, LLC
* licensing@extjs.com
* http://www.extjs.com/license
@@
-162,12
+162,13
@@
Ext.Slider = Ext.extend(Ext.BoxComponent, {
autoStart: 300
\r
});
\r
this.tracker.initEl(this.thumb);
\r
autoStart: 300
\r
});
\r
this.tracker.initEl(this.thumb);
\r
- this.on('beforedestroy', this.tracker.destroy, this.tracker);
\r
},
\r
\r
// private override
\r
onMouseDown : function(e){
\r
},
\r
\r
// private override
\r
onMouseDown : function(e){
\r
- if(this.disabled) {return;}
\r
+ if(this.disabled){
\r
+ return;
\r
+ }
\r
if(this.clickToChange && e.target != this.thumb.dom){
\r
var local = this.innerEl.translatePoints(e.getXY());
\r
this.onClickChange(local);
\r
if(this.clickToChange && e.target != this.thumb.dom){
\r
var local = this.innerEl.translatePoints(e.getXY());
\r
this.onClickChange(local);
\r
@@
-212,11
+213,12
@@
Ext.Slider = Ext.extend(Ext.BoxComponent, {
\r
// private
\r
doSnap : function(value){
\r
\r
// private
\r
doSnap : function(value){
\r
- if(!
this.increment || this.increment == 1 || !value)
{
\r
+ if(!
(this.increment && value))
{
\r
return value;
\r
}
\r
return value;
\r
}
\r
- var newValue = value, inc = this.increment;
\r
- var m = value % inc;
\r
+ var newValue = value,
\r
+ inc = this.increment,
\r
+ m = value % inc;
\r
if(m != 0){
\r
newValue -= m;
\r
if(m * 2 > inc){
\r
if(m != 0){
\r
newValue -= m;
\r
if(m * 2 > inc){
\r
@@
-244,8
+246,8
@@
Ext.Slider = Ext.extend(Ext.BoxComponent, {
\r
// private
\r
getRatio : function(){
\r
\r
// private
\r
getRatio : function(){
\r
- var w = this.innerEl.getWidth()
;
\r
-
var
v = this.maxValue - this.minValue;
\r
+ var w = this.innerEl.getWidth()
,
\r
+
v = this.maxValue - this.minValue;
\r
return v == 0 ? w : (w/v);
\r
},
\r
\r
return v == 0 ? w : (w/v);
\r
},
\r
\r
@@
-278,12
+280,12
@@
Ext.Slider = Ext.extend(Ext.BoxComponent, {
// private
\r
translateValue : function(v){
\r
var ratio = this.getRatio();
\r
// private
\r
translateValue : function(v){
\r
var ratio = this.getRatio();
\r
- return (v * ratio)
-(this.minValue * ratio)-
this.halfThumb;
\r
+ return (v * ratio)
- (this.minValue * ratio) -
this.halfThumb;
\r
},
\r
\r
reverseValue : function(pos){
\r
var ratio = this.getRatio();
\r
},
\r
\r
reverseValue : function(pos){
\r
var ratio = this.getRatio();
\r
- return (pos
+this.halfThumb+(this.minValue * ratio))/
ratio;
\r
+ return (pos
+ this.halfThumb + (this.minValue * ratio)) /
ratio;
\r
},
\r
\r
// private
\r
},
\r
\r
// private
\r
@@
-359,7
+361,7
@@
Ext.Slider = Ext.extend(Ext.BoxComponent, {
this.thumb.removeClass(this.disabledClass);
\r
if(Ext.isIE){
\r
this.innerEl.removeClass(this.disabledClass).dom.disabled = false;
\r
this.thumb.removeClass(this.disabledClass);
\r
if(Ext.isIE){
\r
this.innerEl.removeClass(this.disabledClass).dom.disabled = false;
\r
- if
(this.thumbHolder){
\r
+ if(this.thumbHolder){
\r
this.thumbHolder.hide();
\r
}
\r
this.thumb.show();
\r
this.thumbHolder.hide();
\r
}
\r
this.thumb.show();
\r
@@
-385,6
+387,12
@@
Ext.Slider = Ext.extend(Ext.BoxComponent, {
*/
\r
getValue : function(){
\r
return this.value;
\r
*/
\r
getValue : function(){
\r
return this.value;
\r
+ },
\r
+
\r
+ // private
\r
+ beforeDestroy : function(){
\r
+ Ext.destroyMembers(this, 'endEl', 'innerEl', 'thumb', 'halfThumb', 'focusEl', 'tracker', 'thumbHolder');
\r
+ Ext.Slider.superclass.beforeDestroy.call(this);
\r
}
\r
});
\r
Ext.reg('slider', Ext.Slider);
\r
}
\r
});
\r
Ext.reg('slider', Ext.Slider);
\r
@@
-397,8
+405,8
@@
Ext.Slider.Vertical = {
},
\r
\r
getRatio : function(){
\r
},
\r
\r
getRatio : function(){
\r
- var h = this.innerEl.getHeight()
;
\r
-
var
v = this.maxValue - this.minValue;
\r
+ var h = this.innerEl.getHeight()
,
\r
+
v = this.maxValue - this.minValue;
\r
return h/v;
\r
},
\r
\r
return h/v;
\r
},
\r
\r
@@
-411,15
+419,15
@@
Ext.Slider.Vertical = {
},
\r
\r
onDrag: function(e){
\r
},
\r
\r
onDrag: function(e){
\r
- var pos = this.innerEl.translatePoints(this.tracker.getXY())
;
\r
-
var
bottom = this.innerEl.getHeight()-pos.top;
\r
+ var pos = this.innerEl.translatePoints(this.tracker.getXY())
,
\r
+
bottom = this.innerEl.getHeight()-pos.top;
\r
this.setValue(this.minValue + Ext.util.Format.round(bottom/this.getRatio(), this.decimalPrecision), false);
\r
this.fireEvent('drag', this, e);
\r
},
\r
\r
onClickChange : function(local){
\r
if(local.left > this.clickRange[0] && local.left < this.clickRange[1]){
\r
this.setValue(this.minValue + Ext.util.Format.round(bottom/this.getRatio(), this.decimalPrecision), false);
\r
this.fireEvent('drag', this, e);
\r
},
\r
\r
onClickChange : function(local){
\r
if(local.left > this.clickRange[0] && local.left < this.clickRange[1]){
\r
- var bottom = this.innerEl.getHeight()
-
local.top;
\r
+ var bottom = this.innerEl.getHeight()
-
local.top;
\r
this.setValue(this.minValue + Ext.util.Format.round(bottom/this.getRatio(), this.decimalPrecision), undefined, true);
\r
}
\r
}
\r
this.setValue(this.minValue + Ext.util.Format.round(bottom/this.getRatio(), this.decimalPrecision), undefined, true);
\r
}
\r
}
\r