Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #5017: parent_of_draggable.diff

File parent_of_draggable.diff, 2.2 kB (added by tomg@byu.net, 2 years ago)

PATCH

  • src/dragdrop.js

    old new  
    237237    if(!this.handle) this.handle = $(options.handle); 
    238238    if(!this.handle) this.handle = this.element; 
    239239     
    240     if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) 
     240    if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { 
    241241      options.scroll = $(options.scroll); 
     242      this._isScrollChild = Element.childOf(this.element, options.scroll); 
     243    } 
    242244 
    243245    Element.makePositioned(this.element); // fix IE     
    244246 
     
    403405    var d = this.currentDelta(); 
    404406    pos[0] -= d[0]; pos[1] -= d[1]; 
    405407     
    406     if(this.options.scroll && (this.options.scroll != window)) { 
     408    if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { 
    407409      pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; 
    408410      pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; 
    409411    } 
     
    466468    Position.prepare(); 
    467469    Droppables.show(Draggables._lastPointer, this.element); 
    468470    Draggables.notify('onDrag', this); 
    469     Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); 
    470     Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; 
    471     Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; 
    472     if (Draggables._lastScrollPointer[0] < 0) 
    473       Draggables._lastScrollPointer[0] = 0; 
    474     if (Draggables._lastScrollPointer[1] < 0) 
    475       Draggables._lastScrollPointer[1] = 0; 
    476     this.draw(Draggables._lastScrollPointer); 
     471    if (this._isScrollChild) { 
     472      Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); 
     473      Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; 
     474      Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; 
     475      if (Draggables._lastScrollPointer[0] < 0) 
     476        Draggables._lastScrollPointer[0] = 0; 
     477      if (Draggables._lastScrollPointer[1] < 0) 
     478        Draggables._lastScrollPointer[1] = 0; 
     479      this.draw(Draggables._lastScrollPointer); 
     480    } 
    477481     
    478482    if(this.options.change) this.options.change(this); 
    479483  },