@ -58,16 +58,18 @@ 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" ,
{
items : [
type : "bi.absolute" ,
{
items : [
el : this . slider ,
{
top : 8 ,
el : this . slider ,
}
top : 8 ,
] ,
}
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,41 +126,49 @@ BI.SingleSlider = BI.inherit(BI.Single, {
this . _setVisible ( false ) ;
this . _setVisible ( false ) ;
return {
return {
type : "bi.absolute" ,
type : "bi.absolute" ,
items : [ {
items : [
el : {
{
type : "bi.vertical" ,
el : {
items : [ {
type : "bi.vertical" ,
type : "bi.absolute" ,
items : [
items : [ {
{
el : this . track ,
type : "bi.absolute" ,
width : "100%" ,
items : [
height : c . TRACK _HEIGHT
{
} ]
el : this . track ,
} ] ,
width : "100%" ,
hgap : c . TRACK _GAP _HALF ,
height : c . TRACK _HEIGHT
height : c . TRACK _HEIGHT
}
} ,
]
top : 23 ,
}
left : 0 ,
] ,
width : "100%"
hgap : c . TRACK _GAP _HALF ,
} , {
height : c . TRACK _HEIGHT
el : sliderVertical ,
} ,
top : 20 ,
top : 23 ,
left : 0 ,
left : 0 ,
width : "100%"
width : "100%"
} , {
} , {
el : {
el : sliderVertical ,
type : "bi.vertical" ,
top : 20 ,
items : [ {
left : 0 ,
type : "bi.horizontal_auto" ,
width : "100%"
items : [ this . label ]
} , {
} ] ,
el : {
// height: c.EDITOR_HEIGHT
type : "bi.vertical" ,
} ,
items : [
top : 0 ,
{
left : 0 ,
type : "bi.horizontal_auto" ,
width : "100%"
items : [ this . label ]
} ]
}
] ,
// height: c.EDITOR_HEIGHT
} ,
top : 0 ,
left : 0 ,
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,30 +224,36 @@ 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 : {
{
type : "bi.vertical" ,
el : {
items : [ {
type : "bi.vertical" ,
type : "bi.absolute" ,
items : [
items : [ {
{
el : this . grayTrack ,
type : "bi.absolute" ,
top : 0 ,
items : [
left : 0 ,
{
width : "100%"
el : this . grayTrack ,
} , {
top : 0 ,
el : this . blueTrack ,
left : 0 ,
top : 0 ,
width : "100%"
left : 0 ,
} , {
width : "0%"
el : this . blueTrack ,
} ]
top : 0 ,
} ] ,
left : 0 ,
hgap : 8 ,
width : "0%"
height : 8
}
} ,
]
top : 8 ,
}
left : 0 ,
] ,
width : "100%"
hgap : 8 ,
} ]
height : 8
} ,
top : 8 ,
left : 0 ,
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 ;
}
}