Thomas, I’m mostly writing this to you. A couple weeks ago I grabbed the latest SVN version of dragdrop.js because I needed the auto-scroll functionality. I just fixed something in that script that wasn’t working correctly and thought you might want to hear about it. You may have already caught it since I grabbed the script but here it is anyway.

 

In the updateDrag() function of the Draggable object, in the “if (this.options.scroll) {}” block, you had a line that said var p = Position.page(this.options.scroll). That was giving me problems when my page was scrolled down at all. With the page scrolled down at all, the div with the overflow scrollbar would scroll itself immediately upon a draggble within it being dragged, instead of only when the draggable reached the bottom border of the scrollable div.

 

To fix this, I changed the Position.page to Position.cumulativeOffset and commented out the 2 lines below it where you were adding the scrollLeft and scrollTop values to the p[0] and p[1] values. Now it works just fine. See the new updateDrag function below. Why were you using Position.page?

 

updateDrag: function(event, pointer) {

    if(!this.dragging) this.startDrag(event);

    Position.prepare();

    Droppables.show(pointer, this.element);

    Draggables.notify('onDrag', this, event);

    this.draw(pointer);

    if(this.options.change) this.options.change(this);

   

    if(this.options.scroll) {

      //if(this.scrollInterval) this.scroll();

      this.stopScrolling();

      //var p = Position.page(this.options.scroll);

      var p = Position.cumulativeOffset(this.options.scroll);

      //p[0] += this.options.scroll.scrollLeft;

      //p[1] += this.options.scroll.scrollTop;

      p.push(p[0]+this.options.scroll.offsetWidth);

      p.push(p[1]+this.options.scroll.offsetHeight);

      var speed = [0,0];

      if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);

      if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);

      if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);

      if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);

      this.startScrolling(speed);

    }

   

    // fix AppleWebKit rendering

    if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);

   

    Event.stop(event);

  },

 

 

Sincerely,

Ryan Gahl

Design Engineer

Camtronics Medical Systems (an Emageon Company)

[EMAIL PROTECTED]

262-369-3251

 

The information transmitted in this electronic mail is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material.  Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers.

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to