Bug Tracker

Ticket #2679: slide.diff

File slide.diff, 1.7 kB (added by therve, 9 months ago)

Patch fixing my problem

  • ui.slider.js

     
    125125        if (!isNaN(o.startValue)) 
    126126            this.moveTo(o.startValue, 0, true); 
    127127         
     128        this.saveSize(); 
    128129        //If we only have one handle, set the previous handle to this one to allow clicking before selecting the handle 
    129130        if(this.handle.length == 1) this.previousHandle = this.handle; 
    130131        if(this.handle.length == 2 && o.range) this.createRange(); 
     
    184185        focus: function(handle,hard) { 
    185186            this.currentHandle = $(handle).addClass('ui-slider-handle-active'); 
    186187            if(hard) this.currentHandle.parent()[0].focus(); 
     188            this.saveSize(); 
    187189        }, 
    188190        blur: function(handle) { 
    189191            $(handle).removeClass('ui-slider-handle-active'); 
     
    209211            if(!axis) axis = this.options.axis == "vertical" ? 2 : 1; 
    210212            return ((value - this.options.min[axis == 1 ? "x" : "y"]) / this.options.realMax[axis == 1 ? "x" : "y"]) * (this.actualSize[axis == 1 ? "width" : "height"] - this.handleSize(null,axis)); 
    211213        }, 
     214        saveSize: function() { 
     215            var self = this; 
     216            this.handleSavedSize = this.handle.map(function(elt) { 
     217                var h = $(self.handle[elt]); 
     218                return {width: h.outerWidth(), height: h.outerHeight()}; 
     219            }); 
     220        }, 
    212221        handleSize: function(handle,axis) { 
    213222            if(!axis) axis = this.options.axis == "vertical" ? 2 : 1; 
    214             return $(handle != undefined && handle !== null ? this.handle[handle] : this.currentHandle)[axis == 1 ? "outerWidth" : "outerHeight"]();    
     223            return (handle != undefined && handle !== null ? this.handleSavedSize[handle] : this.handleSavedSize[this.handleIndex()])[axis == 1 ? "width" : "height"]; 
    215224        }, 
    216225        click: function(e) { 
    217226