Bug Tracker

Changeset 5064

Show
Ignore:
Timestamp:
03/17/08 18:03:13 (10 months ago)
Author:
joern.zaefferer
Message:

ui.slider: Implemented #2502, see handles option for usage/details

Location:
trunk/ui
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/ui/tests/slider.html

    r5060 r5064  
    9696 window.console = { 
    9797    log: function() { 
    98         alert(arguments[0]);     
     98        //alert(arguments[0]);   
    9999    }    
    100100 }   
     
    123123     
    124124    $('#slider1').slider({ 
    125         stepping: 20, 
     125        stepping: 10, 
    126126        maxValue: 100, 
    127127        minValue: -100,  
     
    132132        slide: function(e,ui) { 
    133133            $('#slider1_value')[0].value = ui.value; 
    134         } 
     134        }, 
     135        handles: [ 
     136            {start: -60, min: -100, max: 0}, 
     137            {start: 10, min: -20, max: 100} 
     138        ] 
    135139    }); 
    136140     
  • trunk/ui/ui.slider.js

    r5060 r5064  
    236236                    value = this.translateValue(this.value(0) + this.oneStep()); 
    237237            } 
     238            if (this.options.handles) { 
     239                var handle = this.options.handles[this.handleIndex()]; 
     240                if (value < this.translateValue(handle.min)) { 
     241                    value = this.translateValue(handle.min); 
     242                } else if (value > this.translateValue(handle.max)) { 
     243                    value = this.translateValue(handle.max); 
     244                } 
     245            } 
    238246            return value; 
     247        }, 
     248         
     249        handleIndex: function() { 
     250            return this.handle.index(this.currentHandle[0]) 
    239251        }, 
    240252