test( "appendTo, default, switching after initialization", function() {
expect( 2 );
- var element = $( "#draggable1" ).draggable({ helper : "clone" });
+ var element = $( "#draggable1" ).draggable({ helper: "clone" });
TestHelpers.draggable.trackAppendedParent( element );
test( "axis, default, switching after initialization", function() {
expect( 6 );
- var element = $( "#draggable1" ).draggable({ axis : false });
+ var element = $( "#draggable1" ).draggable({ axis: false });
// Any Direction
TestHelpers.draggable.shouldMove( element, "axis: default" );
var deltaX = -3,
deltaY = -3,
tests = {
- "false": { cursorAt : false },
- "{ left: -5, top: -5 }": { x: -5, y: -5, cursorAt : { left: -5, top: -5 } },
- "[ 10, 20 ]": { x: 10, y: 20, cursorAt : [ 10, 20 ] },
- "'10 20'": { x: 10, y: 20, cursorAt : "10 20" },
- "{ left: 20, top: 40 }": { x: 20, y: 40, cursorAt : { left: 20, top: 40 } },
- "{ right: 10, bottom: 20 }": { x: 10, y: 20, cursorAt : { right: 10, bottom: 20 } }
+ "false": { cursorAt: false },
+ "{ left: -5, top: -5 }": { x: -5, y: -5, cursorAt: { left: -5, top: -5 } },
+ "[ 10, 20 ]": { x: 10, y: 20, cursorAt: [ 10, 20 ] },
+ "'10 20'": { x: 10, y: 20, cursorAt: "10 20" },
+ "{ left: 20, top: 40 }": { x: 20, y: 40, cursorAt: { left: 20, top: 40 } },
+ "{ right: 10, bottom: 20 }": { x: 10, y: 20, cursorAt: { right: 10, bottom: 20 } }
};
$.each( tests, function( testName, testData ) {
var element = $( "#draggable" + ( i + 1 ) ).draggable({
cursorAt: testData.cursorAt,
drag: function( event, ui ) {
- if( !testData.cursorAt ) {
+ if ( !testData.cursorAt ) {
equal( ui.position.left - ui.originalPosition.left, deltaX, testName + " " + position + " left" );
equal( ui.position.top - ui.originalPosition.top, deltaY, testName + " " + position + " top" );
- } else if( testData.cursorAt.right ) {
+ } else if ( testData.cursorAt.right ) {
equal( ui.helper.width() - ( event.clientX - ui.offset.left ), testData.x - TestHelpers.draggable.unreliableOffset, testName + " " + position + " left" );
equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y - TestHelpers.draggable.unreliableOffset, testName + " " +position + " top" );
} else {
var deltaX = -3,
deltaY = -3,
tests = {
- "false": { cursorAt : false },
- "{ left: -5, top: -5 }": { x: -5, y: -5, cursorAt : { left: -5, top: -5 } },
- "[ 10, 20 ]": { x: 10, y: 20, cursorAt : [ 10, 20 ] },
- "'10 20'": { x: 10, y: 20, cursorAt : "10 20" },
- "{ left: 20, top: 40 }": { x: 20, y: 40, cursorAt : { left: 20, top: 40 } },
- "{ right: 10, bottom: 20 }": { x: 10, y: 20, cursorAt : { right: 10, bottom: 20 } }
+ "false": { cursorAt: false },
+ "{ left: -5, top: -5 }": { x: -5, y: -5, cursorAt: { left: -5, top: -5 } },
+ "[ 10, 20 ]": { x: 10, y: 20, cursorAt: [ 10, 20 ] },
+ "'10 20'": { x: 10, y: 20, cursorAt: "10 20" },
+ "{ left: 20, top: 40 }": { x: 20, y: 40, cursorAt: { left: 20, top: 40 } },
+ "{ right: 10, bottom: 20 }": { x: 10, y: 20, cursorAt: { right: 10, bottom: 20 } }
};
$.each( tests, function( testName, testData ) {
element.draggable({
drag: function( event, ui ) {
- if( !testData.cursorAt ) {
+ if ( !testData.cursorAt ) {
equal( ui.position.left - ui.originalPosition.left, deltaX, testName + " " + position + " left" );
equal( ui.position.top - ui.originalPosition.top, deltaY, testName + " " + position + " top" );
- } else if( testData.cursorAt.right ) {
+ } else if ( testData.cursorAt.right ) {
equal( ui.helper.width() - ( event.clientX - ui.offset.left ), testData.x - TestHelpers.draggable.unreliableOffset, testName + " " + position + " left" );
equal( ui.helper.height() - ( event.clientY - ui.offset.top ), testData.y - TestHelpers.draggable.unreliableOffset, testName + " " +position + " top" );
} else {
});
/* jshint loopfunc: true */
-(function(){
+(function() {
var k, l, m,
scrollElements = {
"no elements": [],
for ( m = 0 ; m < helpers.length; m++ ) {
for ( l = 0; l < positions.length; l++ ) {
for ( k in scrollElements ) {
- (function( position, helper, scrollElements, scrollElementsTitle ){
+ (function( position, helper, scrollElements, scrollElementsTitle ) {
test( "{ helper: '" + helper + "' }, " + position + ", with scroll offset on " + scrollElementsTitle, function() {
expect( scrollPositions.length * 2 );
// TODO: remove the unreliable offset hacks
unreliableOffset: $.ui.ie && ( !document.documentMode || document.documentMode < 8 ) ? 2 : 0,
// Support: Opera 12.10, Safari 5.1, jQuery <1.8
- unreliableContains: (function(){
+ unreliableContains: (function() {
var element = $( "<div>" );
return $.contains( element[ 0 ].ownerDocument, element[ 0 ] );
})(),
$( el ).one( "dragstop", function( event, ui ) {
var positionExpected = { left: ui.originalPosition.left + expectedDX, top: ui.originalPosition.top + expectedDY };
deepEqual( ui.position, positionExpected, "position dragged[" + dx + ", " + dy + "] " + msg );
- } );
+ });
},
testDragOffset: function( el, dx, dy, expectedDX, expectedDY, msg ) {
msg = msg ? msg + "." : "";
+ var offsetBefore = el.offset(),
+ offsetExpected = { left: offsetBefore.left + expectedDX, top: offsetBefore.top + expectedDY };
+
+ $( el ).one( "dragstop", function( event, ui ) {
+ deepEqual( ui.offset, offsetExpected, "offset dragged[" + dx + ", " + dy + "] " + msg );
+ });
+ },
+ testDragHelperOffset: function( el, dx, dy, expectedDX, expectedDY, msg ) {
+ msg = msg ? msg + "." : "";
+
var offsetBefore = el.offset(),
offsetExpected = { left: offsetBefore.left + expectedDX, top: offsetBefore.top + expectedDY };
$( el ).one( "dragstop", function( event, ui ) {
deepEqual( ui.helper.offset(), offsetExpected, "offset dragged[" + dx + ", " + dy + "] " + msg );
- } );
+ });
},
testDrag: function( el, handle, dx, dy, expectedDX, expectedDY, msg ) {
TestHelpers.draggable.testDragPosition( el, dx, dy, expectedDX, expectedDY, msg );
handle = handle || el;
$( el ).bind( "dragstop", function() {
ok( false, "should not drag " + msg );
- } );
+ });
$( handle ).simulate( "drag", {
dx: 100,
dy: 100
});
$( el ).unbind( "dragstop" );
},
- setScrollable: function ( what, isScrollable ) {
+ setScrollable: function( what, isScrollable ) {
var overflow = isScrollable ? "scroll" : "hidden";
$( what ).css({ overflow: overflow, overflowX: overflow, overflowY: overflow });
},
dy: y
});
},
- trackMouseCss : function( el ) {
+ trackMouseCss: function( el ) {
el.bind( "drag", function() {
el.data( "last_dragged_cursor", $( "body" ).css( "cursor" ) );
});
},
- trackAppendedParent : function( el ) {
+ trackAppendedParent: function( el ) {
// TODO: appendTo is currently ignored if helper is original (see #7044)
el.draggable( "option", "helper", "clone" );
el.data( "last_dragged_parent", ui.helper.parent()[ 0 ] );
});
}
-};
\ No newline at end of file
+};
$(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",
+ width: this.offsetWidth + "px", height: this.offsetHeight + "px",
position: "absolute", opacity: "0.001", zIndex: 1000
})
.css($(this).offset())
this._cacheHelperProportions();
//If ddmanager is used for droppables, set the global draggable
- if($.ui.ddmanager) {
+ if ($.ui.ddmanager) {
$.ui.ddmanager.current = this;
}
this._setContainment();
//Trigger event + callbacks
- if(this._trigger("start", event) === false) {
+ if (this._trigger("start", event) === false) {
this._clear();
return false;
}
$.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)
//Call plugins and callbacks and use the resulting position if something is returned
if (!noPropagation) {
var ui = this._uiHash();
- if(this._trigger("drag", event, ui) === false) {
+ if (this._trigger("drag", event, ui) === false) {
this._mouseUp({});
return false;
}
this.helper[ 0 ].style.left = this.position.left + "px";
this.helper[ 0 ].style.top = this.position.top + "px";
- if($.ui.ddmanager) {
+ if ($.ui.ddmanager) {
$.ui.ddmanager.drag(this, event);
}
}
//if a drop comes from outside (a sortable)
- if(this.dropped) {
+ if (this.dropped) {
dropped = this.dropped;
this.dropped = 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))) {
+ 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))) {
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
- if(that._trigger("stop", event) !== false) {
+ if (that._trigger("stop", event) !== false) {
that._clear();
}
});
} else {
- if(this._trigger("stop", event) !== false) {
+ if (this._trigger("stop", event) !== false) {
this._clear();
}
}
});
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
- if( $.ui.ddmanager ) {
+ if ( $.ui.ddmanager ) {
$.ui.ddmanager.dragStop(this, event);
}
cancel: function() {
- if(this.helper.is(".ui-draggable-dragging")) {
+ if (this.helper.is(".ui-draggable-dragging")) {
this._mouseUp({});
} else {
this._clear();
_createHelper: function(event) {
var o = this.options,
- helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper === "clone" ? this.element.clone().removeAttr("id") : this.element);
+ helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[ 0 ], [ event ])) : (o.helper === "clone" ? this.element.clone().removeAttr("id") : this.element);
- if(!helper.parents("body").length) {
+ if (!helper.parents("body").length) {
helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
}
- if(helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
+ if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
helper.css("position", "absolute");
}
obj = obj.split(" ");
}
if ($.isArray(obj)) {
- obj = {left: +obj[0], top: +obj[1] || 0};
+ obj = { left: +obj[0], top: +obj[1] || 0 };
}
if ("left" in obj) {
this.offset.click.left = obj.left + this.margins.left;
// 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 && $.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();
}
c = $( o.containment );
ce = c[ 0 ];
- if( !ce ) {
+ if ( !ce ) {
return;
}
this.containment = [
( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
- ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ) ,
+ ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - this.helperProportions.width - this.margins.left - this.margins.right,
( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - this.helperProportions.height - this.margins.top - this.margins.bottom
];
_convertPositionTo: function(d, pos) {
- if(!pos) {
+ if (!pos) {
pos = this.position;
}
this.containment[ 2 ] + co.left,
this.containment[ 3 ] + co.top
];
- }
- else {
+ } else {
containment = this.containment;
}
- if(event.pageX - this.offset.click.left < containment[0]) {
+ 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]) {
+ if (event.pageY - this.offset.click.top < containment[1]) {
pageY = containment[1] + this.offset.click.top;
}
- if(event.pageX - this.offset.click.left > containment[2]) {
+ if (event.pageX - this.offset.click.left > containment[2]) {
pageX = containment[2] + this.offset.click.left;
}
- if(event.pageY - this.offset.click.top > containment[3]) {
+ if (event.pageY - this.offset.click.top > containment[3]) {
pageY = containment[3] + this.offset.click.top;
}
}
- if(o.grid) {
+ if (o.grid) {
//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
_clear: function() {
this.helper.removeClass("ui-draggable-dragging");
- if(this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
+ if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
this.helper.remove();
}
this.helper = null;
ui = ui || this._uiHash();
$.ui.plugin.call( this, type, [ event, ui, this ], true );
//The absolute position has to be recalculated after plugins
- if(type === "drag") {
+ if (type === "drag") {
this.positionAbs = this._convertPositionTo("absolute");
}
return $.Widget.prototype._trigger.call(this, type, event, ui);
});
$.each(inst.sortables, function() {
- if(this.instance.isOver) {
+ if (this.instance.isOver) {
this.instance.isOver = 0;
this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
//The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: "valid/invalid"
- if(this.shouldRevert) {
+ if (this.shouldRevert) {
this.instance.options.revert = this.shouldRevert;
}
this.instance.options.helper = this.instance.options._helper;
//If the helper has been the original item, restore properties in the sortable
- if(inst.options.helper === "original") {
+ if (inst.options.helper === "original") {
this.instance.currentItem.css({ top: "auto", left: "auto" });
}
this.instance.helperProportions = inst.helperProportions;
this.instance.offset.click = inst.offset.click;
- if(this.instance._intersectsWith(this.instance.containerCache)) {
+ if (this.instance._intersectsWith(this.instance.containerCache)) {
innermostIntersecting = true;
- $.each(inst.sortables, function () {
+ $.each(inst.sortables, function() {
this.instance.positionAbs = inst.positionAbs;
this.instance.helperProportions = inst.helperProportions;
this.instance.offset.click = inst.offset.click;
});
}
-
- if(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) {
+ if (!this.instance.isOver) {
this.instance.isOver = 1;
//Now we fake the start of dragging for the sortable instance,
}
//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
- if(this.instance.currentItem) {
+ if (this.instance.currentItem) {
this.instance._mouseDrag(event);
}
//If it doesn't intersect with the sortable, and it intersected before,
//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
- if(this.instance.isOver) {
+ if (this.instance.isOver) {
this.instance.isOver = 0;
this.instance.cancelHelperRemoval = true;
//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
this.instance.currentItem.remove();
- if(this.instance.placeholder) {
+ if (this.instance.placeholder) {
this.instance.placeholder.remove();
}
start: function( event, ui, instance ) {
var t = $( ui.helper ),
o = instance.options;
- if(t.css("opacity")) {
+ if (t.css("opacity")) {
o._opacity = t.css("opacity");
}
t.css("opacity", o.opacity);
},
stop: function( event, ui, instance ) {
var o = instance.options;
- if(o._opacity) {
+ if (o._opacity) {
$(ui.helper).css("opacity", o._opacity);
}
}
$.ui.plugin.add("draggable", "scroll", {
start: function( event, ui, i ) {
- if( i.scrollParent[ 0 ] !== i.document[ 0 ] && i.scrollParent[ 0 ].tagName !== "HTML" ) {
+ if ( i.scrollParent[ 0 ] !== i.document[ 0 ] && i.scrollParent[ 0 ].tagName !== "HTML" ) {
i.overflowOffset = i.scrollParent.offset();
}
},
scrolled = false,
document = i.document[ 0 ];
- if( i.scrollParent[ 0 ] !== document && i.scrollParent[ 0 ].tagName !== "HTML" ) {
- if(!o.axis || o.axis !== "x") {
- if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
+ if ( i.scrollParent[ 0 ] !== document && i.scrollParent[ 0 ].tagName !== "HTML" ) {
+ if (!o.axis || o.axis !== "x") {
+ if ((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
- } else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) {
+ } else if (event.pageY - i.overflowOffset.top < o.scrollSensitivity) {
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
}
}
- if(!o.axis || o.axis !== "y") {
- if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
+ if (!o.axis || o.axis !== "y") {
+ 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) {
+ } else if (event.pageX - i.overflowOffset.left < o.scrollSensitivity) {
i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
}
}
} else {
- if(!o.axis || o.axis !== "x") {
- if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
+ if (!o.axis || o.axis !== "x") {
+ if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
- } else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
+ } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
}
}
- if(!o.axis || o.axis !== "y") {
- if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
+ if (!o.axis || o.axis !== "y") {
+ if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
- } else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
+ } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
}
}
}
- if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
+ if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
$.ui.ddmanager.prepareOffsets(i, event);
}
$(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
var $t = $(this),
$o = $t.offset();
- if(this !== i.element[0]) {
+ if (this !== i.element[0]) {
i.snapElements.push({
item: this,
width: $t.outerWidth(), height: $t.outerHeight(),
b = t + inst.snapElements[i].height;
if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) {
- if(inst.snapElements[i].snapping) {
+ if (inst.snapElements[i].snapping) {
(inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
}
inst.snapElements[i].snapping = false;
continue;
}
- if(o.snapMode !== "inner") {
+ if (o.snapMode !== "inner") {
ts = Math.abs(t - y2) <= d;
bs = Math.abs(b - y1) <= d;
ls = Math.abs(l - x2) <= d;
rs = Math.abs(r - x1) <= d;
- if(ts) {
+ if (ts) {
ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
}
- if(bs) {
+ if (bs) {
ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
}
- if(ls) {
+ if (ls) {
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
}
- if(rs) {
+ if (rs) {
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
}
}
first = (ts || bs || ls || rs);
- if(o.snapMode !== "outer") {
+ if (o.snapMode !== "outer") {
ts = Math.abs(t - y1) <= d;
bs = Math.abs(b - y2) <= d;
ls = Math.abs(l - x1) <= d;
rs = Math.abs(r - x2) <= d;
- if(ts) {
+ if (ts) {
ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
}
- if(bs) {
+ if (bs) {
ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
}
- if(ls) {
+ if (ls) {
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
}
- if(rs) {
+ if (rs) {
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
}
}
- if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
+ if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
}
inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
var t = $( ui.helper ),
o = instance.options;
- if(t.css("zIndex")) {
+ if (t.css("zIndex")) {
o._zIndex = t.css("zIndex");
}
t.css("zIndex", o.zIndex);
stop: function( event, ui, instance ) {
var o = instance.options;
- if(o._zIndex) {
+ if (o._zIndex) {
$(ui.helper).css("zIndex", o._zIndex);
}
}