Changeset 4785
- Timestamp:
- 08/18/06 05:54:57 (2 years ago)
- Files:
-
- spinoffs/scriptaculous/CHANGELOG (modified) (1 diff)
- spinoffs/scriptaculous/src/dragdrop.js (modified) (3 diffs)
- spinoffs/scriptaculous/test/functional/dragdrop7_test.html (added)
- spinoffs/scriptaculous/test/functional/index.html (modified) (1 diff)
- spinoffs/scriptaculous/test/unit/element_test.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spinoffs/scriptaculous/CHANGELOG
r4772 r4785 1 1 *SVN* 2 3 * Fix autoscrolling when dragging an element unto a scrollable container, fixes #5017 [thx tomg] 2 4 3 5 * Fix a condition where overriding the endeffect on Draggables without overriding the starteffect too leads to a Javascript error [thx Javier Martinez] spinoffs/scriptaculous/src/dragdrop.js
r4772 r4785 259 259 if(!this.handle) this.handle = this.element; 260 260 261 if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) 261 if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { 262 262 options.scroll = $(options.scroll); 263 this._isScrollChild = Element.childOf(this.element, options.scroll); 264 } 263 265 264 266 Element.makePositioned(this.element); // fix IE … … 427 429 pos[0] -= d[0]; pos[1] -= d[1]; 428 430 429 if(this.options.scroll && (this.options.scroll != window )) {431 if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { 430 432 pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; 431 433 pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; … … 491 493 Droppables.show(Draggables._lastPointer, this.element); 492 494 Draggables.notify('onDrag', this); 493 Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); 494 Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; 495 Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; 496 if (Draggables._lastScrollPointer[0] < 0) 497 Draggables._lastScrollPointer[0] = 0; 498 if (Draggables._lastScrollPointer[1] < 0) 499 Draggables._lastScrollPointer[1] = 0; 500 this.draw(Draggables._lastScrollPointer); 495 if (this._isScrollChild) { 496 Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); 497 Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; 498 Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; 499 if (Draggables._lastScrollPointer[0] < 0) 500 Draggables._lastScrollPointer[0] = 0; 501 if (Draggables._lastScrollPointer[1] < 0) 502 Draggables._lastScrollPointer[1] = 0; 503 this.draw(Draggables._lastScrollPointer); 504 } 501 505 502 506 if(this.options.change) this.options.change(this); spinoffs/scriptaculous/test/functional/index.html
r4117 r4785 42 42 <li><a href="dragdrop5_test.html" target="test">dragdrop5_test</a></li> 43 43 <li><a href="dragdrop6_test.html" target="test">dragdrop6_test: snap option</a></li> 44 <li><a href="dragdrop7_test.html" target="test">dragdrop7_test</a></li> 44 45 </ul> 45 46 <ul> spinoffs/scriptaculous/test/unit/element_test.html
r4628 r4785 48 48 49 49 <!-- Test Element.childrenWithClassName --> 50 <div id="Container" >50 <div id="Container" class="moo hoo"> 51 51 <span id="1" class="firstClass">First class</span> 52 52 <span id="2" class="secondClass">Second class</span> … … 71 71 elems.each($) 72 72 },1); 73 }}, 74 75 testElementUp: function() { with(this) { 76 assertEqual('Container', $('collect').up().id); 77 assertEqual('Container', $('collect').up(1).id); 78 assertEqual('Container', $('5').up(2).id); 79 80 assertEqual('Container', $('collect').up({tagName:'DIV'}).id); 81 assertEqual('4', $('5').up({className:'thirdClass'}).id); 82 83 assertEqual('Container',$('5').up({className:'moo',tagName:'DIV'}).id); 84 assertEqual('Container',$('5').up({tag:'div'}).id); 85 assertEqual('Container',$('5').up({'class':'moo','tag':'div'}).id); 86 assertNull($('5').up({className:'moo',tagName:'IMG'})); 73 87 }}, 74 88