r1004 - trunk/ui

r1004 - trunk/ui


Author: paul.bakaus
Date: Mon Nov 24 09:02:26 2008
New Revision: 1004
Modified:
trunk/ui/ui.slider.js
Log:
slider: fixed regression caused by a recent change in the mouse core -
since the mouse core doesn't stop mousedown propagation by default now, the
mousedown event was triggered twice - once by the bound handle, and once by
the actual element.
Modified: trunk/ui/ui.slider.js
==============================================================================
--- trunk/ui/ui.slider.js    (original)
+++ trunk/ui/ui.slider.js    Mon Nov 24 09:02:26 2008
@@ -72,9 +72,18 @@
        // Bind the click to the slider itself
        this.element.bind('mousedown.slider', function(event) {
+            
+            if($(event.target).is('.ui-slider-handle')) return;
+            
+            //Go to the actual clicked posiion, apply a click
            self._click.apply(self, [event]);
-            self.currentHandle.data("mouse").trigger(event);
-            self.firstValue = self.firstValue + 1; //This is for always triggering
the change event
+            
+            //initiate a handle drag, so we can click+drag somewhere
+             self.currentHandle.data("mouse").trigger(event);
+            
+             //This is for always triggering the change event
+            self.firstValue = self.firstValue + 1;
+            
        });
        // Move the first handle to the startValue