Ticket #1883: bug1883.patch
| File bug1883.patch, 2.7 kB (added by nostrademons, 1 year ago) |
|---|
-
ui.slider.js
79 79 o = o || {}; 80 80 $.extend(options, o); 81 81 $.extend(options, { 82 axis: o.axis || (el.offsetWidth < el.offsetHeight ? 'vertical' : 'horizontal'),83 82 maxValue: parseInt(o.maxValue) || 100, 84 83 minValue: parseInt(o.minValue) || 0, 85 84 startValue: parseInt(o.startValue) || 0, 86 85 _start: function(h, p, c, t, e) { 86 calcDimensions(t.options); 87 87 self.start.apply(t, [self, e]); // Trigger the start callback 88 88 }, 89 89 _beforeStop: function(h, p, c, t, e) { 90 self.stop.apply(t, [self, e]); // Trigger the st artcallback90 self.stop.apply(t, [self, e]); // Trigger the stop callback 91 91 }, 92 92 _drag: function(h, p, c, t, e) { 93 self.drag.apply(t, [self, e ]); // Trigger the startcallback93 self.drag.apply(t, [self, e, p]); // Trigger the drag callback 94 94 }, 95 95 startCondition: function() { 96 96 return !self.disabled; … … 103 103 o.stepping = parseInt(o.stepping) || (o.steps ? o.maxValue/o.steps : 0); 104 104 o.realValue = (o.maxValue - o.minValue); 105 105 106 function calcDimensions(opt) { 107 opt.axis = options.axis || (el.offsetWidth < el.offsetHeight ? 'vertical' : 'horizontal'); 108 if(opt.axis == 'horizontal') { 109 self.parentSize = $(self.element).outerWidth() - self.handle.outerWidth(); 110 self.prop = 'left'; 111 } 112 113 if(opt.axis == 'vertical') { 114 self.parentSize = $(self.element).outerHeight() - self.handle.outerHeight(); 115 self.prop = 'top'; 116 } 117 } 106 118 119 107 120 this.handle = options.handle ? $(options.handle, el) : $('.ui-slider-handle', el); 108 121 if(this.handle.length == 1) { 109 122 this.interaction = new $.ui.mouseInteraction(this.handle[0], options); … … 119 132 this.element = el; 120 133 $(this.element).addClass("ui-slider"); 121 134 135 calcDimensions(o); 122 136 123 if(o.axis == 'horizontal') {124 this.parentSize = $(this.element).outerWidth() - this.handle.outerWidth();125 this.prop = 'left';126 }127 128 if(o.axis == 'vertical') {129 this.parentSize = $(this.element).outerHeight() - this.handle.outerHeight();130 this.prop = 'top';131 }132 133 137 if(!this.multipleHandles) { 134 138 $(el).bind('click', function(e) { self.click.apply(self, [e]); }); 135 139 if(!isNaN(o.startValue)) this.moveTo(o.startValue,options.realValue, null, false); … … 258 262 if(this.multipleHandles) return false; //TODO: Multiple handle moveTo function 259 263 260 264 var o = this.interaction.options; 261 var offset = $(this.interaction.element).offsetParent().offset({ border: false });262 265 this.interaction.pickValue = this.interaction.curValue; 263 266 value = value-o.minValue; 264 267
