@ -51,7 +51,9 @@ function ItemSet(body, options) {
onRemove : function ( item , callback ) {
onRemove : function ( item , callback ) {
callback ( item ) ;
callback ( item ) ;
} ,
} ,
onMoving : null , // onMoving is null by default for better performance (other on* functions do not support null)
onMoving : function ( item , callback ) {
callback ( item ) ;
} ,
margin : {
margin : {
item : {
item : {
@ -1127,22 +1129,15 @@ ItemSet.prototype._onDrag = function (event) {
newProps . group = group && group . groupId ;
newProps . group = group && group . groupId ;
}
}
if ( me . options . onMoving ) {
var itemData = util . extend ( { } , props . item . data , newProps ) ;
me . options . onMoving ( itemData , function ( itemData ) {
if ( itemData ) {
me . _updateItemProps ( props . item , itemData ) ;
}
} ) ;
}
else {
me . _updateItemProps ( props . item , newProps ) ;
}
// confirm moving the item
var itemData = util . extend ( { } , props . item . data , newProps ) ;
me . options . onMoving ( itemData , function ( itemData ) {
if ( itemData ) {
me . _updateItemProps ( props . item , itemData ) ;
}
} ) ;
} ) ;
} ) ;
// TODO: implement onMoving handler
this . stackDirty = true ; // force re-stacking of all items next redraw
this . stackDirty = true ; // force re-stacking of all items next redraw
this . body . emitter . emit ( 'change' ) ;
this . body . emitter . emit ( 'change' ) ;