Bug Tracker

Changeset 5136

Show
Ignore:
Timestamp:
03/28/08 11:51:31 (10 months ago)
Author:
paul.bakaus
Message:

ui-slider: made improvements to mousedown/mouseup logics (fixes #2596)
ui-base: improved the start of mouseInteraction: You don't have to drag one px to start the interaction now (if the old behaviour is desired, set distance to 1)

Location:
trunk/ui
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/ui/ui.base.js

    r5134 r5136  
    132132                || (this.options.condition && !this.options.condition.apply(this.options.executor || this, [e, this.element])) //Prevent execution on condition 
    133133            ) return true; 
    134              
     134                 
    135135            var self = this; 
    136136            var initialize = function() { 
     
    138138                $(document).bind('mouseup.draggable', function() { return self.stop.apply(self, arguments); }); 
    139139                $(document).bind('mousemove.draggable', function() { return self.drag.apply(self, arguments); }); 
     140                 
     141                if(!self.initalized && Math.abs(self._MP.left-e.pageX) >= self.options.distance || Math.abs(self._MP.top-e.pageY) >= self.options.distance) {                
     142                    if(self.options.start) self.options.start.call(self.options.executor || self, e, self.element); 
     143                    self.initialized = true; 
     144                } 
    140145            }; 
    141146 
     
    146151                initialize(); 
    147152            } 
    148              
     153                 
    149154            return false; 
    150155             
     
    166171            if ($.browser.msie && !e.button) return this.stop.apply(this, [e]); // IE mouseup check 
    167172             
    168             if(!this.initialized && (Math.abs(this._MP.left-e.pageX) >= o.distance || Math.abs(this._MP.top-e.pageY) >= o.distance)) { 
     173            if(!this.initialized && (Math.abs(this._MP.left-e.pageX) >= o.distance || Math.abs(this._MP.top-e.pageY) >= o.distance)) {               
    169174                if(this.options.start) this.options.start.call(this.options.executor || this, e, this.element); 
    170175                this.initialized = true; 
  • trunk/ui/ui.slider.js

    r5134 r5136  
    7676                } 
    7777            }) 
    78             .wrap('<a href="javascript:void(0)"></a>') 
     78            .wrap('<a href="javascript:void(0)" style="cursor:default;"></a>') 
    7979            .parent() 
    8080                .bind('focus', function(e) { self.focus(this.firstChild); }) 
     
    8787        ; 
    8888         
    89         //Position the node 
    90         if(o.helper == 'original' && (this.element.css('position') == 'static' || this.element.css('position') == '')) this.element.css('position', 'relative'); 
    91          
    9289        //Prepare dynamic properties for later use 
    9390        if(o.axis == 'horizontal') { 
     
    10097         
    10198        //Bind the click to the slider itself 
    102         this.element.bind('click.slider', function(e) { self.click.apply(self, [e]); }); 
     99        this.element.bind('mousedown.slider', function(e) { 
     100            self.click.apply(self, [e]); 
     101            self.currentHandle.data("ui-mouse").trigger(e); 
     102        }); 
    103103         
    104104        //Move the first handle to the startValue 
     
    207207            //Move focussed handle to the clicked position 
    208208            this.offset = this.element.offset(); 
    209             this.moveTo(this.convertValue(e[this.properties[0] == 'top' ? 'pageY' : 'pageX'] - this.offset[this.properties[0]] - this.handleSize()/2)); 
     209            this.moveTo(this.convertValue(e[this.properties[0] == 'top' ? 'pageY' : 'pageX'] - this.offset[this.properties[0]] - this.handleSize()/2), null, true); 
    210210        }, 
    211211        start: function(e, handle) { 
    212              
     212         
    213213            var o = this.options; 
    214              
     214            if(!this.currentHandle) this.currentHandle = this.previousHandle; //This is a especially ugly fix for strange blur events happening on mousemove events 
     215 
    215216            this.offset = this.element.offset(); 
    216217            this.handleOffset = this.currentHandle.offset(); 
     
    266267            var o = this.options; 
    267268            var position = { top: e.pageY - this.offset.top - this.clickOffset.top, left: e.pageX - this.offset.left - this.clickOffset.left}; 
     269            if(!this.currentHandle) this.currentHandle = this.previousHandle; //This is a especially ugly fix for strange blur events happening on mousemove events 
    268270 
    269271            var modifier = position[this.properties[0]]; 
     
    278280             
    279281            modifier = this.translateRange(modifier); 
    280              
     282 
    281283            this.currentHandle.css(this.properties[0], modifier); 
    282284            if (this.rangeElement)