13 //>>docs: http://api.jqueryui.com/draggable/ |
13 //>>docs: http://api.jqueryui.com/draggable/ |
14 //>>demos: http://jqueryui.com/draggable/ |
14 //>>demos: http://jqueryui.com/draggable/ |
15 //>>css.structure: ../../themes/base/draggable.css |
15 //>>css.structure: ../../themes/base/draggable.css |
16 |
16 |
17 ( function( factory ) { |
17 ( function( factory ) { |
|
18 "use strict"; |
|
19 |
18 if ( typeof define === "function" && define.amd ) { |
20 if ( typeof define === "function" && define.amd ) { |
19 |
21 |
20 // AMD. Register as an anonymous module. |
22 // AMD. Register as an anonymous module. |
21 define( [ |
23 define( [ |
22 "jquery", |
24 "jquery", |
97 _mouseCapture: function( event ) { |
100 _mouseCapture: function( event ) { |
98 var o = this.options; |
101 var o = this.options; |
99 |
102 |
100 // Among others, prevent a drag on a resizable-handle |
103 // Among others, prevent a drag on a resizable-handle |
101 if ( this.helper || o.disabled || |
104 if ( this.helper || o.disabled || |
102 $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) { |
105 $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) { |
103 return false; |
106 return false; |
104 } |
107 } |
105 |
108 |
106 //Quit if we're not on a valid handle |
109 //Quit if we're not on a valid handle |
107 this.handle = this._getHandle( event ); |
110 this.handle = this._getHandle( event ); |
180 //Store the helper's css position |
183 //Store the helper's css position |
181 this.cssPosition = this.helper.css( "position" ); |
184 this.cssPosition = this.helper.css( "position" ); |
182 this.scrollParent = this.helper.scrollParent( true ); |
185 this.scrollParent = this.helper.scrollParent( true ); |
183 this.offsetParent = this.helper.offsetParent(); |
186 this.offsetParent = this.helper.offsetParent(); |
184 this.hasFixedAncestor = this.helper.parents().filter( function() { |
187 this.hasFixedAncestor = this.helper.parents().filter( function() { |
185 return $( this ).css( "position" ) === "fixed"; |
188 return $( this ).css( "position" ) === "fixed"; |
186 } ).length > 0; |
189 } ).length > 0; |
187 |
190 |
188 //The element's absolute position on the page minus margins |
191 //The element's absolute position on the page minus margins |
189 this.positionAbs = this.element.offset(); |
192 this.positionAbs = this.element.offset(); |
190 this._refreshOffsets( event ); |
193 this._refreshOffsets( event ); |
191 |
194 |
193 this.originalPosition = this.position = this._generatePosition( event, false ); |
196 this.originalPosition = this.position = this._generatePosition( event, false ); |
194 this.originalPageX = event.pageX; |
197 this.originalPageX = event.pageX; |
195 this.originalPageY = event.pageY; |
198 this.originalPageY = event.pageY; |
196 |
199 |
197 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied |
200 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied |
198 ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) ); |
201 if ( o.cursorAt ) { |
|
202 this._adjustOffsetFromHelper( o.cursorAt ); |
|
203 } |
199 |
204 |
200 //Set a containment if given in the options |
205 //Set a containment if given in the options |
201 this._setContainment(); |
206 this._setContainment(); |
202 |
207 |
203 //Trigger event + callbacks |
208 //Trigger event + callbacks |
287 dropped = this.dropped; |
292 dropped = this.dropped; |
288 this.dropped = false; |
293 this.dropped = false; |
289 } |
294 } |
290 |
295 |
291 if ( ( this.options.revert === "invalid" && !dropped ) || |
296 if ( ( this.options.revert === "invalid" && !dropped ) || |
292 ( this.options.revert === "valid" && dropped ) || |
297 ( this.options.revert === "valid" && dropped ) || |
293 this.options.revert === true || ( $.isFunction( this.options.revert ) && |
298 this.options.revert === true || ( typeof this.options.revert === "function" && |
294 this.options.revert.call( this.element, dropped ) ) |
299 this.options.revert.call( this.element, dropped ) ) |
295 ) { |
300 ) { |
296 $( this.helper ).animate( |
301 $( this.helper ).animate( |
297 this.originalPosition, |
302 this.originalPosition, |
298 parseInt( this.options.revertDuration, 10 ), |
303 parseInt( this.options.revertDuration, 10 ), |
360 }, |
365 }, |
361 |
366 |
362 _createHelper: function( event ) { |
367 _createHelper: function( event ) { |
363 |
368 |
364 var o = this.options, |
369 var o = this.options, |
365 helperIsFunction = $.isFunction( o.helper ), |
370 helperIsFunction = typeof o.helper === "function", |
366 helper = helperIsFunction ? |
371 helper = helperIsFunction ? |
367 $( o.helper.apply( this.element[ 0 ], [ event ] ) ) : |
372 $( o.helper.apply( this.element[ 0 ], [ event ] ) ) : |
368 ( o.helper === "clone" ? |
373 ( o.helper === "clone" ? |
369 this.element.clone().removeAttr( "id" ) : |
374 this.element.clone().removeAttr( "id" ) : |
370 this.element ); |
375 this.element ); |
381 if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) { |
386 if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) { |
382 this._setPositionRelative(); |
387 this._setPositionRelative(); |
383 } |
388 } |
384 |
389 |
385 if ( helper[ 0 ] !== this.element[ 0 ] && |
390 if ( helper[ 0 ] !== this.element[ 0 ] && |
386 !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) { |
391 !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) { |
387 helper.css( "position", "absolute" ); |
392 helper.css( "position", "absolute" ); |
388 } |
393 } |
389 |
394 |
390 return helper; |
395 return helper; |
391 |
396 |
399 |
404 |
400 _adjustOffsetFromHelper: function( obj ) { |
405 _adjustOffsetFromHelper: function( obj ) { |
401 if ( typeof obj === "string" ) { |
406 if ( typeof obj === "string" ) { |
402 obj = obj.split( " " ); |
407 obj = obj.split( " " ); |
403 } |
408 } |
404 if ( $.isArray( obj ) ) { |
409 if ( Array.isArray( obj ) ) { |
405 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; |
410 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; |
406 } |
411 } |
407 if ( "left" in obj ) { |
412 if ( "left" in obj ) { |
408 this.offset.click.left = obj.left + this.margins.left; |
413 this.offset.click.left = obj.left + this.margins.left; |
409 } |
414 } |
434 // next positioned parent |
439 // next positioned parent |
435 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't |
440 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't |
436 // the document, which means that the scroll is included in the initial calculation of the |
441 // the document, which means that the scroll is included in the initial calculation of the |
437 // offset of the parent, and never recalculated upon drag |
442 // offset of the parent, and never recalculated upon drag |
438 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document && |
443 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document && |
439 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { |
444 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { |
440 po.left += this.scrollParent.scrollLeft(); |
445 po.left += this.scrollParent.scrollLeft(); |
441 po.top += this.scrollParent.scrollTop(); |
446 po.top += this.scrollParent.scrollTop(); |
442 } |
447 } |
443 |
448 |
444 if ( this._isRootNode( this.offsetParent[ 0 ] ) ) { |
449 if ( this._isRootNode( this.offsetParent[ 0 ] ) ) { |
501 if ( o.containment === "window" ) { |
506 if ( o.containment === "window" ) { |
502 this.containment = [ |
507 this.containment = [ |
503 $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, |
508 $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, |
504 $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, |
509 $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, |
505 $( window ).scrollLeft() + $( window ).width() - |
510 $( window ).scrollLeft() + $( window ).width() - |
506 this.helperProportions.width - this.margins.left, |
511 this.helperProportions.width - this.margins.left, |
507 $( window ).scrollTop() + |
512 $( window ).scrollTop() + |
508 ( $( window ).height() || document.body.parentNode.scrollHeight ) - |
513 ( $( window ).height() || document.body.parentNode.scrollHeight ) - |
509 this.helperProportions.height - this.margins.top |
514 this.helperProportions.height - this.margins.top |
510 ]; |
515 ]; |
511 return; |
516 return; |
512 } |
517 } |
513 |
518 |
514 if ( o.containment === "document" ) { |
519 if ( o.containment === "document" ) { |
515 this.containment = [ |
520 this.containment = [ |
516 0, |
521 0, |
517 0, |
522 0, |
518 $( document ).width() - this.helperProportions.width - this.margins.left, |
523 $( document ).width() - this.helperProportions.width - this.margins.left, |
519 ( $( document ).height() || document.body.parentNode.scrollHeight ) - |
524 ( $( document ).height() || document.body.parentNode.scrollHeight ) - |
520 this.helperProportions.height - this.margins.top |
525 this.helperProportions.height - this.margins.top |
521 ]; |
526 ]; |
522 return; |
527 return; |
523 } |
528 } |
524 |
529 |
525 if ( o.containment.constructor === Array ) { |
530 if ( o.containment.constructor === Array ) { |
540 |
545 |
541 isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) ); |
546 isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) ); |
542 |
547 |
543 this.containment = [ |
548 this.containment = [ |
544 ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + |
549 ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + |
545 ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), |
550 ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), |
546 ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + |
551 ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + |
547 ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), |
552 ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), |
548 ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - |
553 ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - |
549 ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - |
554 ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - |
550 ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - |
555 ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - |
551 this.helperProportions.width - |
556 this.helperProportions.width - |
552 this.margins.left - |
557 this.margins.left - |
553 this.margins.right, |
558 this.margins.right, |
554 ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - |
559 ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - |
555 ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - |
560 ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - |
556 ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - |
561 ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - |
557 this.helperProportions.height - |
562 this.helperProportions.height - |
558 this.margins.top - |
563 this.margins.top - |
559 this.margins.bottom |
564 this.margins.bottom |
560 ]; |
565 ]; |
561 this.relativeContainer = c; |
566 this.relativeContainer = c; |
562 }, |
567 }, |
563 |
568 |
564 _convertPositionTo: function( d, pos ) { |
569 _convertPositionTo: function( d, pos ) { |
659 // argument errors in IE (see ticket #6950) |
664 // argument errors in IE (see ticket #6950) |
660 top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY - |
665 top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY - |
661 this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY; |
666 this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY; |
662 pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] || |
667 pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] || |
663 top - this.offset.click.top > containment[ 3 ] ) ? |
668 top - this.offset.click.top > containment[ 3 ] ) ? |
664 top : |
669 top : |
665 ( ( top - this.offset.click.top >= containment[ 1 ] ) ? |
670 ( ( top - this.offset.click.top >= containment[ 1 ] ) ? |
666 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top; |
671 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top; |
667 |
672 |
668 left = o.grid[ 0 ] ? this.originalPageX + |
673 left = o.grid[ 0 ] ? this.originalPageX + |
669 Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] : |
674 Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] : |
670 this.originalPageX; |
675 this.originalPageX; |
671 pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] || |
676 pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] || |
672 left - this.offset.click.left > containment[ 2 ] ) ? |
677 left - this.offset.click.left > containment[ 2 ] ) ? |
673 left : |
678 left : |
674 ( ( left - this.offset.click.left >= containment[ 0 ] ) ? |
679 ( ( left - this.offset.click.left >= containment[ 0 ] ) ? |
675 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left; |
680 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left; |
676 } |
681 } |
677 |
682 |
678 if ( o.axis === "y" ) { |
683 if ( o.axis === "y" ) { |
679 pageX = this.originalPageX; |
684 pageX = this.originalPageX; |
680 } |
685 } |
844 this.positionAbs = draggable.positionAbs; |
849 this.positionAbs = draggable.positionAbs; |
845 this.helperProportions = draggable.helperProportions; |
850 this.helperProportions = draggable.helperProportions; |
846 this.offset.click = draggable.offset.click; |
851 this.offset.click = draggable.offset.click; |
847 |
852 |
848 if ( this !== sortable && |
853 if ( this !== sortable && |
849 this._intersectsWith( this.containerCache ) && |
854 this._intersectsWith( this.containerCache ) && |
850 $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) { |
855 $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) { |
851 innermostIntersecting = false; |
856 innermostIntersecting = false; |
852 } |
857 } |
853 |
858 |
854 return innermostIntersecting; |
859 return innermostIntersecting; |
855 } ); |
860 } ); |
1005 if ( !i.scrollParentNotHidden ) { |
1010 if ( !i.scrollParentNotHidden ) { |
1006 i.scrollParentNotHidden = i.helper.scrollParent( false ); |
1011 i.scrollParentNotHidden = i.helper.scrollParent( false ); |
1007 } |
1012 } |
1008 |
1013 |
1009 if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && |
1014 if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && |
1010 i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { |
1015 i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { |
1011 i.overflowOffset = i.scrollParentNotHidden.offset(); |
1016 i.overflowOffset = i.scrollParentNotHidden.offset(); |
1012 } |
1017 } |
1013 }, |
1018 }, |
1014 drag: function( event, ui, i ) { |
1019 drag: function( event, ui, i ) { |
1015 |
1020 |
1019 document = i.document[ 0 ]; |
1024 document = i.document[ 0 ]; |
1020 |
1025 |
1021 if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { |
1026 if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { |
1022 if ( !o.axis || o.axis !== "x" ) { |
1027 if ( !o.axis || o.axis !== "x" ) { |
1023 if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < |
1028 if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < |
1024 o.scrollSensitivity ) { |
1029 o.scrollSensitivity ) { |
1025 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; |
1030 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; |
1026 } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { |
1031 } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { |
1027 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; |
1032 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; |
1028 } |
1033 } |
1029 } |
1034 } |
1030 |
1035 |
1031 if ( !o.axis || o.axis !== "y" ) { |
1036 if ( !o.axis || o.axis !== "y" ) { |
1032 if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < |
1037 if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < |
1033 o.scrollSensitivity ) { |
1038 o.scrollSensitivity ) { |
1034 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; |
1039 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; |
1035 } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { |
1040 } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { |
1036 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; |
1041 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; |
1037 } |
1042 } |
1038 } |
1043 } |
1041 |
1046 |
1042 if ( !o.axis || o.axis !== "x" ) { |
1047 if ( !o.axis || o.axis !== "x" ) { |
1043 if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) { |
1048 if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) { |
1044 scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed ); |
1049 scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed ); |
1045 } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) < |
1050 } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) < |
1046 o.scrollSensitivity ) { |
1051 o.scrollSensitivity ) { |
1047 scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed ); |
1052 scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed ); |
1048 } |
1053 } |
1049 } |
1054 } |
1050 |
1055 |
1051 if ( !o.axis || o.axis !== "y" ) { |
1056 if ( !o.axis || o.axis !== "y" ) { |
1052 if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) { |
1057 if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) { |
1053 scrolled = $( document ).scrollLeft( |
1058 scrolled = $( document ).scrollLeft( |
1054 $( document ).scrollLeft() - o.scrollSpeed |
1059 $( document ).scrollLeft() - o.scrollSpeed |
1055 ); |
1060 ); |
1056 } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) < |
1061 } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) < |
1057 o.scrollSensitivity ) { |
1062 o.scrollSensitivity ) { |
1058 scrolled = $( document ).scrollLeft( |
1063 scrolled = $( document ).scrollLeft( |
1059 $( document ).scrollLeft() + o.scrollSpeed |
1064 $( document ).scrollLeft() + o.scrollSpeed |
1060 ); |
1065 ); |
1061 } |
1066 } |
1062 } |
1067 } |
1105 r = l + inst.snapElements[ i ].width; |
1110 r = l + inst.snapElements[ i ].width; |
1106 t = inst.snapElements[ i ].top - inst.margins.top; |
1111 t = inst.snapElements[ i ].top - inst.margins.top; |
1107 b = t + inst.snapElements[ i ].height; |
1112 b = t + inst.snapElements[ i ].height; |
1108 |
1113 |
1109 if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || |
1114 if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || |
1110 !$.contains( inst.snapElements[ i ].item.ownerDocument, |
1115 !$.contains( inst.snapElements[ i ].item.ownerDocument, |
1111 inst.snapElements[ i ].item ) ) { |
1116 inst.snapElements[ i ].item ) ) { |
1112 if ( inst.snapElements[ i ].snapping ) { |
1117 if ( inst.snapElements[ i ].snapping ) { |
1113 ( inst.options.snap.release && |
1118 if ( inst.options.snap.release ) { |
1114 inst.options.snap.release.call( |
1119 inst.options.snap.release.call( |
1115 inst.element, |
1120 inst.element, |
1116 event, |
1121 event, |
1117 $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } ) |
1122 $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } ) |
1118 ) ); |
1123 ); |
|
1124 } |
1119 } |
1125 } |
1120 inst.snapElements[ i ].snapping = false; |
1126 inst.snapElements[ i ].snapping = false; |
1121 continue; |
1127 continue; |
1122 } |
1128 } |
1123 |
1129 |
1184 } ).left; |
1190 } ).left; |
1185 } |
1191 } |
1186 } |
1192 } |
1187 |
1193 |
1188 if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) { |
1194 if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) { |
1189 ( inst.options.snap.snap && |
1195 if ( inst.options.snap.snap ) { |
1190 inst.options.snap.snap.call( |
1196 inst.options.snap.snap.call( |
1191 inst.element, |
1197 inst.element, |
1192 event, |
1198 event, |
1193 $.extend( inst._uiHash(), { |
1199 $.extend( inst._uiHash(), { |
1194 snapItem: inst.snapElements[ i ].item |
1200 snapItem: inst.snapElements[ i ].item |
1195 } ) ) ); |
1201 } ) ); |
|
1202 } |
1196 } |
1203 } |
1197 inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first ); |
1204 inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first ); |
1198 |
1205 |
1199 } |
1206 } |
1200 |
1207 |
1208 group = $.makeArray( $( o.stack ) ).sort( function( a, b ) { |
1215 group = $.makeArray( $( o.stack ) ).sort( function( a, b ) { |
1209 return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) - |
1216 return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) - |
1210 ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 ); |
1217 ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 ); |
1211 } ); |
1218 } ); |
1212 |
1219 |
1213 if ( !group.length ) { return; } |
1220 if ( !group.length ) { |
|
1221 return; |
|
1222 } |
1214 |
1223 |
1215 min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0; |
1224 min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0; |
1216 $( group ).each( function( i ) { |
1225 $( group ).each( function( i ) { |
1217 $( this ).css( "zIndex", min + i ); |
1226 $( this ).css( "zIndex", min + i ); |
1218 } ); |
1227 } ); |