Ticket #2679: slide.diff
| File slide.diff, 1.7 kB (added by therve, 9 months ago) |
|---|
-
ui.slider.js
125 125 if (!isNaN(o.startValue)) 126 126 this.moveTo(o.startValue, 0, true); 127 127 128 this.saveSize(); 128 129 //If we only have one handle, set the previous handle to this one to allow clicking before selecting the handle 129 130 if(this.handle.length == 1) this.previousHandle = this.handle; 130 131 if(this.handle.length == 2 && o.range) this.createRange(); … … 184 185 focus: function(handle,hard) { 185 186 this.currentHandle = $(handle).addClass('ui-slider-handle-active'); 186 187 if(hard) this.currentHandle.parent()[0].focus(); 188 this.saveSize(); 187 189 }, 188 190 blur: function(handle) { 189 191 $(handle).removeClass('ui-slider-handle-active'); … … 209 211 if(!axis) axis = this.options.axis == "vertical" ? 2 : 1; 210 212 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)); 211 213 }, 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 }, 212 221 handleSize: function(handle,axis) { 213 222 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"]; 215 224 }, 216 225 click: function(e) { 217 226
