Changeset 1096

Show
Ignore:
Timestamp:
12/11/08 05:39:15 (9 months ago)
Author:
paul.bakaus
Message:

sortable,draggable: fixed issues with _convertPositionTo, missed from latest re-factor, miscalculated the absolute position including scroll

Location:
trunk/ui
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/ui/ui.draggable.js

    r1023 r1096  
    263263                if(!pos) pos = this.position; 
    264264                var mod = d == "absolute" ? 1 : -1; 
     265                var scroll = this[(this.cssPosition == 'absolute' ? 'offset' : 'scroll')+'Parent'], scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 
    265266 
    266267                return { 
     
    269270                                + this.offset.relative.top      * mod                                                                           // Only for relative positioned nodes: Relative offset from element to offset parent 
    270271                                + this.offset.parent.top * mod                                                                                  // The offsetParent's offset without borders (offset + border) 
    271                                 + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : this[(this.cssPosition == 'absolute' ? 'offset' : 'scroll')+'Parent'].scrollTop() ) * mod 
     272                                + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod 
    272273                                + this.margins.top * mod                                                                                                //Add the margin (you don't want the margin counting in intersection methods) 
    273274                        ), 
     
    276277                                + this.offset.relative.left     * mod                                                                           // Only for relative positioned nodes: Relative offset from element to offset parent 
    277278                                + this.offset.parent.left * mod                                                                                 // The offsetParent's offset without borders (offset + border) 
    278                                 + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : this[(this.cssPosition == 'absolute' ? 'offset' : 'scroll')+'Parent'].scrollLeft() ) * mod 
     279                                + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : ( scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) * mod 
    279280                                + this.margins.left * mod                                                                                               //Add the margin (you don't want the margin counting in intersection methods) 
    280281                        ) 
  • trunk/ui/ui.sortable.js

    r1095 r1096  
    726726                if(!pos) pos = this.position; 
    727727                var mod = d == "absolute" ? 1 : -1; 
     728                var scroll = this[(this.cssPosition == 'absolute' ? 'offset' : 'scroll')+'Parent'], scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); 
    728729 
    729730                return { 
     
    732733                                + this.offset.relative.top      * mod                                                                           // Only for relative positioned nodes: Relative offset from element to offset parent 
    733734                                + this.offset.parent.top * mod                                                                                  // The offsetParent's offset without borders (offset + border) 
    734                                 + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : this[(this.cssPosition == 'absolute' ? 'offset' : 'scroll')+'Parent'].scrollTop() ) * mod 
     735                                + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod 
    735736                                + this.margins.top * mod                                                                                                //Add the margin (you don't want the margin counting in intersection methods) 
    736737                        ), 
     
    739740                                + this.offset.relative.left     * mod                                                                           // Only for relative positioned nodes: Relative offset from element to offset parent 
    740741                                + this.offset.parent.left * mod                                                                                 // The offsetParent's offset without borders (offset + border) 
    741                                 + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : this[(this.cssPosition == 'absolute' ? 'offset' : 'scroll')+'Parent'].scrollLeft() ) * mod 
     742                                + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : ( scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) * mod 
    742743                                + this.margins.left * mod                                                                                               //Add the margin (you don't want the margin counting in intersection methods) 
    743744                        ) 
     
    762763                                - this.offset.relative.left                                                                                             // Only for relative positioned nodes: Relative offset from element to offset parent 
    763764                                - this.offset.parent.left                                                                                               // The offsetParent's offset without borders (offset + border) 
    764                                 + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) 
     765                                + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : ( scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) 
    765766                        ) 
    766767                }; 
     
    940941$.ui.plugin.add("sortable", "scroll", { 
    941942        start: function(event, ui) { 
    942                 var o = ui.options; 
    943                 var i = $(this).data("sortable"); 
    944  
     943                var i = $(this).data("sortable"), o = i.options; 
    945944                if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset(); 
    946  
    947         }, 
    948         drag: function(event, ui) { 
    949  
    950                 var o = ui.options, scrolled = false; 
    951                 var i = $(this).data("sortable"); 
     945        }, 
     946        sort: function(event, ui) { 
     947         
     948                var i = $(this).data("sortable"), o = i.options, scrolled = false; 
    952949 
    953950                if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') { 
     
    977974                } 
    978975 
    979                 if(scrolled !== false && $.ui.ddmanager) 
     976                if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) 
    980977                        $.ui.ddmanager.prepareOffsets(i, event); 
    981978