<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,5 @@
+* Updated to slider.js as of script.aculo.us 1.5 final
+
 * Updated copyright notice
 
 * Updated to slider.js as of script.aculo.us changeset [2936]
\ No newline at end of file</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -64,6 +64,7 @@ Control.Slider.prototype = {
     this.alignY = parseInt(this.options.alignY || '0');
     
     this.trackLength = this.maximumOffset() - this.minimumOffset();
+    this.handleLength = this.isVertical() ? this.handles[0].offsetHeight : this.handles[0].offsetWidth;
 
     this.active   = false;
     this.dragging = false;
@@ -151,21 +152,24 @@ Control.Slider.prototype = {
     this.values[handleIdx] = sliderValue;
     this.value = this.values[0]; // assure backwards compat
     
-    this.handles[handleIdx].style[ this.isVertical() ? 'top' : 'left'] = 
+    this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = 
       this.translateToPx(sliderValue);
     
     this.drawSpans();
-    if(!this.event) this.updateFinished();
+    if(!this.dragging || !this.event) this.updateFinished();
   },
   setValueBy: function(delta, handleIdx) {
     this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, 
       handleIdx || this.activeHandleIdx || 0);
   },
   translateToPx: function(value) {
-    return Math.round((this.trackLength / (this.range.end - this.range.start)) * (value - this.range.start)) + &quot;px&quot;;
+    return Math.round(
+      ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * 
+      (value - this.range.start)) + &quot;px&quot;;
   },
   translateToValue: function(offset) {
-    return ((offset/this.trackLength) * (this.range.end - this.range.start)) + this.range.start;
+    return ((offset/(this.trackLength-this.handleLength) * 
+      (this.range.end-this.range.start)) + this.range.start);
   },
   getRange: function(range) {
     var v = this.values.sortBy(Prototype.K); 
@@ -215,11 +219,11 @@ Control.Slider.prototype = {
         var pointer  = [Event.pointerX(event), Event.pointerY(event)];
         if(handle==this.track) {
           var offsets  = Position.cumulativeOffset(this.track); 
-          this.event = event;         
+          this.event = event;
           this.setValue(this.translateToValue( 
-            this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0]
+           (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2)
           ));
-          offsets  = Position.cumulativeOffset(this.activeHandle);
+          var offsets  = Position.cumulativeOffset(this.activeHandle);
           this.offsetX = (pointer[0] - offsets[0]);
           this.offsetY = (pointer[1] - offsets[1]);
         } else {
@@ -241,10 +245,7 @@ Control.Slider.prototype = {
   },
   update: function(event) {
    if(this.active) {
-      if(!this.dragging) {
-        this.dragging = true;
-        if(this.activeHandle.style.position==&quot;&quot;) style.position = &quot;relative&quot;;
-      }
+      if(!this.dragging) this.dragging = true;
       this.draw(event);
       // fix AppleWebKit rendering
       if(navigator.appVersion.indexOf('AppleWebKit')&gt;0) window.scrollBy(0,0);
@@ -258,7 +259,8 @@ Control.Slider.prototype = {
     pointer[1] -= this.offsetY + offsets[1];
     this.event = event;
     this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] ));
-    if(this.initialized &amp;&amp; this.options.onSlide) this.options.onSlide(this.values.length&gt;1 ? this.values : this.value, this);
+    if(this.initialized &amp;&amp; this.options.onSlide)
+      this.options.onSlide(this.values.length&gt;1 ? this.values : this.value, this);
   },
   endDrag: function(event) {
     if(this.active &amp;&amp; this.dragging) {</diff>
      <filename>javascripts/slider.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>001e13a36df6052ecadd92ed6926e16995ad4d1e</id>
    </parent>
  </parents>
  <author>
    <name>Thomas Fuchs</name>
    <email>thomas@fesch.at</email>
  </author>
  <url>http://github.com/rails/scriptaculous_slider/commit/13bcb5981a511917172568ccca9a19aff4d3232f</url>
  <id>13bcb5981a511917172568ccca9a19aff4d3232f</id>
  <committed-date>2005-12-14T02:03:04-08:00</committed-date>
  <authored-date>2005-12-14T02:03:04-08:00</authored-date>
  <message>Update slider.js in slider plugin to latest version</message>
  <tree>85354b2da38cd5fe0607d4cc37b5ec715d3c96d5</tree>
  <committer>
    <name>Thomas Fuchs</name>
    <email>thomas@fesch.at</email>
  </committer>
</commit>
