Ticket #5017: parent_of_draggable.diff
| File parent_of_draggable.diff, 2.2 kB (added by tomg@byu.net, 2 years ago) |
|---|
-
src/dragdrop.js
old new 237 237 if(!this.handle) this.handle = $(options.handle); 238 238 if(!this.handle) this.handle = this.element; 239 239 240 if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) 240 if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { 241 241 options.scroll = $(options.scroll); 242 this._isScrollChild = Element.childOf(this.element, options.scroll); 243 } 242 244 243 245 Element.makePositioned(this.element); // fix IE 244 246 … … 403 405 var d = this.currentDelta(); 404 406 pos[0] -= d[0]; pos[1] -= d[1]; 405 407 406 if(this.options.scroll && (this.options.scroll != window )) {408 if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { 407 409 pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; 408 410 pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; 409 411 } … … 466 468 Position.prepare(); 467 469 Droppables.show(Draggables._lastPointer, this.element); 468 470 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 } 477 481 478 482 if(this.options.change) this.options.change(this); 479 483 },