@@ -34,6 +34,8 @@ var jqyoui = angular.module('ngDragDrop', []).service('ngDragDropService', ['$ti
34
34
this . draggableScope = null ;
35
35
this . droppableScope = null ;
36
36
37
+ angular . element ( document ) . find ( 'head' ) . prepend ( '<style type="text/css">@charset "UTF-8";.angular-dragdrop-hide{display: none !important;}</style>' ) ;
38
+
37
39
this . callEventCallback = function ( scope , callbackName , event , ui ) {
38
40
if ( ! callbackName ) return ;
39
41
@@ -75,6 +77,7 @@ var jqyoui = angular.module('ngDragDrop', []).service('ngDragDropService', ['$ti
75
77
$droppableDraggable = null ,
76
78
droppableScope = this . droppableScope ,
77
79
draggableScope = this . draggableScope ,
80
+ $helper = null ,
78
81
promises = [ ] ;
79
82
80
83
dragModel = $draggable . ngattr ( 'ng-model' ) ;
@@ -115,11 +118,17 @@ var jqyoui = angular.module('ngDragDrop', []).service('ngDragDropService', ['$ti
115
118
116
119
$q . all ( promises ) . then ( angular . bind ( this , function ( ) {
117
120
if ( dragSettings . animate === true ) {
118
- this . move ( $draggable , $droppableDraggable . length > 0 ? $droppableDraggable : $droppable , null , 'fast' , dropSettings , null ) ;
121
+ // be nice with absolutely positioned brethren :-)
122
+ $helper = $draggable . clone ( ) ;
123
+ $helper . css ( { 'position' : 'absolute' } ) . css ( $draggable . offset ( ) ) ;
124
+ angular . element ( document ) . find ( 'body' ) . append ( $helper ) ;
125
+ $draggable . addClass ( 'angular-dragdrop-hide' ) ;
126
+
127
+ this . move ( $helper , $droppableDraggable . length > 0 ? $droppableDraggable : $droppable , null , 'fast' , dropSettings , function ( ) { $helper . remove ( ) ; } ) ;
119
128
this . move ( $droppableDraggable . length > 0 && ! dropSettings . multiple ? $droppableDraggable : [ ] , $draggable . parent ( '[jqyoui-droppable],[data-jqyoui-droppable]' ) , jqyoui . startXY , 'fast' , dropSettings , angular . bind ( this , function ( ) {
120
129
$timeout ( angular . bind ( this , function ( ) {
121
130
// Do not move this into move() to avoid flickering issue
122
- $draggable . css ( { 'position' : 'relative' , 'left' : '' , 'top' : '' } ) ;
131
+ $draggable . css ( { 'position' : 'relative' , 'left' : '' , 'top' : '' } ) . removeClass ( 'angular-dragdrop-hide' ) ;
123
132
// Angular v1.2 uses ng-hide to hide an element not display property
124
133
// so we've to manually remove display:none set in this.move()
125
134
$droppableDraggable . css ( { 'position' : 'relative' , 'left' : '' , 'top' : '' , 'display' : $droppableDraggable . css ( 'display' ) === 'none' ? '' : $droppableDraggable . css ( 'display' ) } ) ;
0 commit comments