@@ -494,11 +494,20 @@ $.widget("ui.sortable", $.extend($.ui.mouse, {
494494 } ,
495495 mouseDrag : function ( e ) {
496496
497-
498497 //Compute the helpers position
499498 this . position = this . generatePosition ( e ) ;
500499 this . positionAbs = this . convertPositionTo ( "absolute" ) ;
501500
501+ //Call the internal plugins
502+ $ . ui . plugin . call ( this , "sort" , [ e , this . ui ( ) ] ) ;
503+
504+ //Regenerate the absolute position used for position checks
505+ this . positionAbs = this . convertPositionTo ( "absolute" ) ;
506+
507+ //Set the helper's position
508+ this . helper [ 0 ] . style . left = this . position . left + 'px' ;
509+ this . helper [ 0 ] . style . top = this . position . top + 'px' ;
510+
502511 //Rearrange
503512 for ( var i = this . items . length - 1 ; i >= 0 ; i -- ) {
504513 var intersection = this . intersectsWithEdge ( this . items [ i ] ) ;
@@ -520,15 +529,12 @@ $.widget("ui.sortable", $.extend($.ui.mouse, {
520529 //Post events to containers
521530 this . contactContainers ( e ) ;
522531
523- //Call plugins and callbacks
524- this . propagate ( "sort" , e ) ;
525-
526- if ( ! this . options . axis || this . options . axis == "x" ) this . helper [ 0 ] . style . left = this . position . left + 'px' ;
527- if ( ! this . options . axis || this . options . axis == "y" ) this . helper [ 0 ] . style . top = this . position . top + 'px' ;
528-
529532 //Interconnect with droppables
530533 if ( $ . ui . ddmanager ) $ . ui . ddmanager . drag ( this , e ) ;
531534
535+ //Call callbacks
536+ this . element . triggerHandler ( "sort" , [ e , this . ui ( ) ] , this . options [ "sort" ] ) ;
537+
532538 return false ;
533539
534540 } ,
@@ -719,4 +725,15 @@ $.ui.plugin.add("sortable", "scroll", {
719725 }
720726} ) ;
721727
728+ $ . ui . plugin . add ( "sortable" , "axis" , {
729+ sort : function ( e , ui ) {
730+
731+ var i = $ ( this ) . data ( "sortable" ) ;
732+
733+ if ( ui . options . axis == "y" ) i . position . left = i . originalPosition . left ;
734+ if ( ui . options . axis == "x" ) i . position . top = i . originalPosition . top ;
735+
736+ }
737+ } ) ;
738+
722739} ) ( jQuery ) ;
0 commit comments