]> source.dussan.org Git - jquery-ui.git/commitdiff
draggable: fixed absolute positioned element's scroll positions
authorPaul Bakaus <paul.bakaus@googlemail.com>
Sun, 25 May 2008 16:06:24 +0000 (16:06 +0000)
committerPaul Bakaus <paul.bakaus@googlemail.com>
Sun, 25 May 2008 16:06:24 +0000 (16:06 +0000)
ui/source/ui.draggable.js

index 13d60f7364a8438360c85cceb4499501ba3f07b2..f012e6f53365653bec54ff7eb40fff38a702177d 100644 (file)
                        this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size\r
                        if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);\r
                        \r
+                       this.mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position\r
                        return true;\r
                },\r
                convertPositionTo: function(d, pos) {\r
                                        pos.top                                                                                                                                 // the calculated relative position\r
                                        + this.offset.relative.top      * mod                                                                           // Only for relative positioned nodes: Relative offset from element to offset parent\r
                                        + this.offset.parent.top * mod                                                                                  // The offsetParent's offset without borders (offset + border)\r
-                                       - (this.cssPosition == "fixed" || this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) * mod     // The offsetParent's scroll position, not if the element is fixed\r
+                                       - (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollTop) * mod // The offsetParent's scroll position, not if the element is fixed\r
                                        + (this.cssPosition == "fixed" ? this.offsetParent[0].scrollTop : 0) * mod\r
                                        + this.margins.top * mod                                                                                                //Add the margin (you don't want the margin counting in intersection methods)\r
                                ),\r
                                        pos.left                                                                                                                                // the calculated relative position\r
                                        + this.offset.relative.left     * mod                                                                           // Only for relative positioned nodes: Relative offset from element to offset parent\r
                                        + this.offset.parent.left * mod                                                                                 // The offsetParent's offset without borders (offset + border)\r
-                                       - (this.cssPosition == "fixed" || this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft) * mod    // The offsetParent's scroll position, not if the element is fixed\r
+                                       - (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollLeft) * mod        // The offsetParent's scroll position, not if the element is fixed\r
                                        + (this.cssPosition == "fixed" ? this.offsetParent[0].scrollLeft : 0) * mod\r
                                        + this.margins.left * mod                                                                                               //Add the margin (you don't want the margin counting in intersection methods)\r
                                )\r
                                        - this.offset.click.top                                                                                                 // Click offset (relative to the element)\r
                                        - this.offset.relative.top                                                                                              // Only for relative positioned nodes: Relative offset from element to offset parent\r
                                        - this.offset.parent.top                                                                                                // The offsetParent's offset without borders (offset + border)\r
-                                       + (this.cssPosition == "fixed" || this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)   // The offsetParent's scroll position, not if the element is fixed\r
+                                       + (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollTop)       // The offsetParent's scroll position, not if the element is fixed\r
                                        - (this.cssPosition == "fixed" ? this.offsetParent[0].scrollTop : 0)\r
                                ),\r
                                left: (\r
                                        - this.offset.click.left                                                                                                // Click offset (relative to the element)\r
                                        - this.offset.relative.left                                                                                             // Only for relative positioned nodes: Relative offset from element to offset parent\r
                                        - this.offset.parent.left                                                                                               // The offsetParent's offset without borders (offset + border)\r
-                                       + (this.cssPosition == "fixed" || this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft)  // The offsetParent's scroll position, not if the element is fixed\r
+                                       + (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollLeft)      // The offsetParent's scroll position, not if the element is fixed\r
                                        - (this.cssPosition == "fixed" ? this.offsetParent[0].scrollLeft : 0)\r
                                )\r
                        };\r