aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.draggable.js
diff options
context:
space:
mode:
authorEduardo Lundgren <eduardolundgren@gmail.com>2008-11-28 15:43:32 +0000
committerEduardo Lundgren <eduardolundgren@gmail.com>2008-11-28 15:43:32 +0000
commit95c6c6dd62684c388590087b97001bd67ce46a07 (patch)
treeb21f02b8f9e57fd35072f345edf4b96644db7d05 /ui/ui.draggable.js
parent91232f6ed53abdc2e2d36929a5129f9a7d8069b9 (diff)
downloadjquery-ui-95c6c6dd62684c388590087b97001bd67ce46a07.tar.gz
jquery-ui-95c6c6dd62684c388590087b97001bd67ce46a07.zip
Source formatting
Diffstat (limited to 'ui/ui.draggable.js')
-rw-r--r--ui/ui.draggable.js28
1 files changed, 14 insertions, 14 deletions
diff --git a/ui/ui.draggable.js b/ui/ui.draggable.js
index 5c4bcd4af..b9c622f0d 100644
--- a/ui/ui.draggable.js
+++ b/ui/ui.draggable.js
@@ -54,7 +54,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
//Create and append the visible helper
this.helper = this._createHelper(event);
-
+
//Cache the helper size
this._cacheHelperProportions();
@@ -73,9 +73,9 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
//Store the helper's css position
this.cssPosition = this.helper.css("position");
this.scrollParent = this.helper.scrollParent();
-
+
//The element's absolute position on the page minus margins
- this.offset = this.element.offset();
+ this.offset = this.element.offset();
this.offset = {
top: this.offset.top - this.margins.top,
left: this.offset.left - this.margins.left
@@ -89,7 +89,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
parent: this._getParentOffset(),
relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
});
-
+
//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
if(o.cursorAt)
this._adjustOffsetFromHelper(o.cursorAt);
@@ -188,14 +188,14 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
if(obj.top != undefined) this.offset.click.top = obj.top + this.margins.top;
if(obj.bottom != undefined) this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
},
-
+
_getParentOffset: function() {
this.offsetParent = this.helper.offsetParent(); var po = this.offsetParent.offset(); //Get the offsetParent and cache its position
if((this.offsetParent[0] == document.body && $.browser.mozilla) //Ugly FF3 fix
|| (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
- po = { top: 0, left: 0 };
+ po = { top: 0, left: 0 };
return {
top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
@@ -203,7 +203,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
};
},
-
+
_getRelativeOffset: function() {
if(this.cssPosition == "relative") {
@@ -215,9 +215,9 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
} else {
return { top: 0, left: 0 };
}
-
+
},
-
+
_cacheMargins: function() {
this.margins = {
left: (parseInt(this.element.css("marginLeft"),10) || 0),
@@ -283,7 +283,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
_generatePosition: function(event) {
- var o = this.options, scroll = this[(this.cssPosition == 'absolute' ? 'offset' : 'scroll')+'Parent'], scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+ var o = this.options, scroll = this[(this.cssPosition == 'absolute' ? 'offset' : 'scroll')+'Parent'], scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
var position = {
top: (
@@ -558,14 +558,14 @@ $.ui.plugin.add("draggable", "scroll", {
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
-
+
if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
- i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
-
+ i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
+
} else {
-
+
if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)