@@ -345,11 +345,7 @@ angular.module('ui.sortable', [])
345
345
// Save current drop position but only if this is not a second
346
346
// update that happens when moving between lists because then
347
347
// the value will be overwritten with the old value
348
-
349
- var wasMoved = ( 'dropindex' in ui . item . sortable ) &&
350
- ! ui . item . sortable . isCanceled ( ) ;
351
-
352
- if ( ! ui . item . sortable . received ) {
348
+ if ( ! ui . item . sortable . received ) {
353
349
ui . item . sortable . dropindex = getItemIndex ( ui . item ) ;
354
350
var droptarget = ui . item . closest ( '[ui-sortable], [data-ui-sortable], [x-ui-sortable]' ) ;
355
351
ui . item . sortable . droptarget = droptarget ;
@@ -383,25 +379,21 @@ angular.module('ui.sortable', [])
383
379
// it's safe to clear the restored nodes since:
384
380
// update is currently running and
385
381
// stop is not called for the target list.
386
- if ( ui . item . sortable . received ) {
382
+ if ( ui . item . sortable . received ) {
387
383
savedNodes = null ;
388
384
}
389
385
390
386
// If received is true (an item was dropped in from another list)
391
387
// then we add the new item to this list otherwise wait until the
392
388
// stop event where we will know if it was a sort or item was
393
389
// moved here from another list
394
- if ( ui . item . sortable . received && ! ui . item . sortable . isCanceled ( ) ) {
390
+ if ( ui . item . sortable . received && ! ui . item . sortable . isCanceled ( ) ) {
395
391
scope . $apply ( function ( ) {
396
392
ngModel . $modelValue . splice ( ui . item . sortable . dropindex , 0 ,
397
393
ui . item . sortable . moved ) ;
398
394
} ) ;
395
+ scope . $emit ( 'ui-sortable:moved' , ui ) ;
399
396
}
400
-
401
- if ( wasMoved && ! ui . item . sortable . received ) {
402
- scope . $emit ( 'sortable:wasMoved' ) ;
403
- }
404
-
405
397
} ;
406
398
407
399
callbacks . stop = function ( e , ui ) {
@@ -418,6 +410,7 @@ angular.module('ui.sortable', [])
418
410
ui . item . sortable . dropindex , 0 ,
419
411
ngModel . $modelValue . splice ( ui . item . sortable . index , 1 ) [ 0 ] ) ;
420
412
} ) ;
413
+ scope . $emit ( 'ui-sortable:moved' , ui ) ;
421
414
} else if ( ! wasMoved &&
422
415
! angular . equals ( element . contents ( ) . toArray ( ) , savedNodes . toArray ( ) ) ) {
423
416
// if the item was not moved
0 commit comments