summaryrefslogtreecommitdiff
path: root/xstatic/pkg/jquery_ui/data/ui/jquery.ui.draggable.js
diff options
context:
space:
mode:
Diffstat (limited to 'xstatic/pkg/jquery_ui/data/ui/jquery.ui.draggable.js')
-rw-r--r--xstatic/pkg/jquery_ui/data/ui/jquery.ui.draggable.js154
1 files changed, 79 insertions, 75 deletions
diff --git a/xstatic/pkg/jquery_ui/data/ui/jquery.ui.draggable.js b/xstatic/pkg/jquery_ui/data/ui/jquery.ui.draggable.js
index 149035c..3768022 100644
--- a/xstatic/pkg/jquery_ui/data/ui/jquery.ui.draggable.js
+++ b/xstatic/pkg/jquery_ui/data/ui/jquery.ui.draggable.js
@@ -1,11 +1,12 @@
/*!
- * jQuery UI Draggable 1.8.24
+ * jQuery UI Draggable 1.9.2
+ * http://jqueryui.com
*
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license.
* http://jquery.org/license
*
- * http://docs.jquery.com/UI/Draggables
+ * http://api.jqueryui.com/draggable/
*
* Depends:
* jquery.ui.core.js
@@ -15,6 +16,7 @@
(function( $, undefined ) {
$.widget("ui.draggable", $.ui.mouse, {
+ version: "1.9.2",
widgetEventPrefix: "drag",
options: {
addClasses: true,
@@ -54,17 +56,9 @@ $.widget("ui.draggable", $.ui.mouse, {
},
- destroy: function() {
- if(!this.element.data('draggable')) return;
- this.element
- .removeData("draggable")
- .unbind(".draggable")
- .removeClass("ui-draggable"
- + " ui-draggable-dragging"
- + " ui-draggable-disabled");
+ _destroy: function() {
+ this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
this._mouseDestroy();
-
- return this;
},
_mouseCapture: function(event) {
@@ -79,18 +73,16 @@ $.widget("ui.draggable", $.ui.mouse, {
this.handle = this._getHandle(event);
if (!this.handle)
return false;
-
- if ( o.iframeFix ) {
- $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
- $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
- .css({
- width: this.offsetWidth+"px", height: this.offsetHeight+"px",
- position: "absolute", opacity: "0.001", zIndex: 1000
- })
- .css($(this).offset())
- .appendTo("body");
- });
- }
+
+ $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
+ $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
+ .css({
+ width: this.offsetWidth+"px", height: this.offsetHeight+"px",
+ position: "absolute", opacity: "0.001", zIndex: 1000
+ })
+ .css($(this).offset())
+ .appendTo("body");
+ });
return true;
@@ -165,12 +157,12 @@ $.widget("ui.draggable", $.ui.mouse, {
if ($.ui.ddmanager && !o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this, event);
-
+
this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
-
+
//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);
-
+
return true;
},
@@ -209,7 +201,7 @@ $.widget("ui.draggable", $.ui.mouse, {
dropped = this.dropped;
this.dropped = false;
}
-
+
//if the original element is no longer in the DOM don't bother to continue (see #8269)
var element = this.element[0], elementInDom = false;
while ( element && (element = element.parentNode) ) {
@@ -221,10 +213,10 @@ $.widget("ui.draggable", $.ui.mouse, {
return false;
if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
- var self = this;
+ var that = this;
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
- if(self._trigger("stop", event) !== false) {
- self._clear();
+ if(that._trigger("stop", event) !== false) {
+ that._clear();
}
});
} else {
@@ -235,29 +227,29 @@ $.widget("ui.draggable", $.ui.mouse, {
return false;
},
-
+
_mouseUp: function(event) {
//Remove frame helpers
- $("div.ui-draggable-iframeFix").each(function() {
- this.parentNode.removeChild(this);
+ $("div.ui-draggable-iframeFix").each(function() {
+ this.parentNode.removeChild(this);
});
-
+
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);
-
+
return $.ui.mouse.prototype._mouseUp.call(this, event);
},
-
+
cancel: function() {
-
+
if(this.helper.is(".ui-draggable-dragging")) {
this._mouseUp({});
} else {
this._clear();
}
-
+
return this;
-
+
},
_getHandle: function(event) {
@@ -320,13 +312,13 @@ $.widget("ui.draggable", $.ui.mouse, {
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
- if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
+ if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
po.left += this.scrollParent.scrollLeft();
po.top += this.scrollParent.scrollTop();
}
if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
- || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix
po = { top: 0, left: 0 };
return {
@@ -378,7 +370,7 @@ $.widget("ui.draggable", $.ui.mouse, {
];
if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
- var c = $(o.containment);
+ var c = $(o.containment);
var ce = c[0]; if(!ce) return;
var co = c.offset();
var over = ($(ce).css("overflow") != 'hidden');
@@ -401,20 +393,20 @@ $.widget("ui.draggable", $.ui.mouse, {
if(!pos) pos = this.position;
var mod = d == "absolute" ? 1 : -1;
- var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
return {
top: (
pos.top // The absolute mouse position
+ this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
- - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
),
left: (
pos.left // The absolute mouse position
+ this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
- - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
)
};
@@ -422,7 +414,7 @@ $.widget("ui.draggable", $.ui.mouse, {
_generatePosition: function(event) {
- var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
var pageX = event.pageX;
var pageY = event.pageY;
@@ -432,18 +424,18 @@ $.widget("ui.draggable", $.ui.mouse, {
*/
if(this.originalPosition) { //If we are not dragging yet, we won't check for options
- var containment;
- if(this.containment) {
- if (this.relative_container){
- var co = this.relative_container.offset();
- containment = [ this.containment[0] + co.left,
- this.containment[1] + co.top,
- this.containment[2] + co.left,
- this.containment[3] + co.top ];
- }
- else {
- containment = this.containment;
- }
+ var containment;
+ if(this.containment) {
+ if (this.relative_container){
+ var co = this.relative_container.offset();
+ containment = [ this.containment[0] + co.left,
+ this.containment[1] + co.top,
+ this.containment[2] + co.left,
+ this.containment[3] + co.top ];
+ }
+ else {
+ containment = this.containment;
+ }
if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left;
if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top;
@@ -468,14 +460,14 @@ $.widget("ui.draggable", $.ui.mouse, {
- this.offset.click.top // Click offset (relative to the element)
- this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
- this.offset.parent.top // The offsetParent's offset without borders (offset + border)
- + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
),
left: (
pageX // The absolute mouse position
- this.offset.click.left // Click offset (relative to the element)
- this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
- this.offset.parent.left // The offsetParent's offset without borders (offset + border)
- + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
)
};
@@ -511,10 +503,6 @@ $.widget("ui.draggable", $.ui.mouse, {
});
-$.extend($.ui.draggable, {
- version: "1.8.24"
-});
-
$.ui.plugin.add("draggable", "connectToSortable", {
start: function(event, ui) {
@@ -570,7 +558,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
},
drag: function(event, ui) {
- var inst = $(this).data("draggable"), self = this;
+ var inst = $(this).data("draggable"), that = this;
var checkPos = function(o) {
var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
@@ -582,14 +570,30 @@ $.ui.plugin.add("draggable", "connectToSortable", {
};
$.each(inst.sortables, function(i) {
-
+
+ var innermostIntersecting = false;
+ var thisSortable = this;
//Copy over some variables to allow calling the sortable's native _intersectsWith
this.instance.positionAbs = inst.positionAbs;
this.instance.helperProportions = inst.helperProportions;
this.instance.offset.click = inst.offset.click;
-
+
if(this.instance._intersectsWith(this.instance.containerCache)) {
+ innermostIntersecting = true;
+ $.each(inst.sortables, function () {
+ this.instance.positionAbs = inst.positionAbs;
+ this.instance.helperProportions = inst.helperProportions;
+ this.instance.offset.click = inst.offset.click;
+ if (this != thisSortable
+ && this.instance._intersectsWith(this.instance.containerCache)
+ && $.ui.contains(thisSortable.instance.element[0], this.instance.element[0]))
+ innermostIntersecting = false;
+ return innermostIntersecting;
+ });
+ }
+
+ if(innermostIntersecting) {
//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
if(!this.instance.isOver) {
@@ -597,7 +601,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
//Now we fake the start of dragging for the sortable instance,
//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
- this.instance.currentItem = $(self).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
+ this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
this.instance.options.helper = function() { return ui.helper[0]; };
@@ -630,13 +634,13 @@ $.ui.plugin.add("draggable", "connectToSortable", {
this.instance.isOver = 0;
this.instance.cancelHelperRemoval = true;
-
+
//Prevent reverting on this forced stop
this.instance.options.revert = false;
-
+
// The out event needs to be triggered independently
this.instance._trigger('out', event, this.instance._uiHash(this.instance));
-
+
this.instance._mouseStop(event, true);
this.instance.options.helper = this.instance.options._helper;
@@ -806,7 +810,7 @@ $.ui.plugin.add("draggable", "stack", {
return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
});
if (!group.length) { return; }
-
+
var min = parseInt(group[0].style.zIndex) || 0;
$(group).each(function(i) {
this.style.zIndex = min + i;