@@ -43,12 +43,12 @@ var jqyoui = angular.module('ngDragDrop', []).service('ngDragDropService', ['$ti
43
43
callback = objExtract . callback ,
44
44
constructor = objExtract . constructor ,
45
45
args = [ event , ui ] . concat ( objExtract . args ) ;
46
-
46
+
47
47
// call either $scoped method i.e. $scope.dropCallback or constructor's method i.e. this.dropCallback.
48
48
// Removing scope.$apply call that was performance intensive (especially onDrag) and does not require it
49
49
// always. So call it within the callback if needed.
50
50
return ( scope [ callback ] || scope [ constructor ] [ callback ] ) . apply ( scope [ callback ] ? scope : scope [ constructor ] , args ) ;
51
-
51
+
52
52
function extract ( callbackName ) {
53
53
var atStartBracket = callbackName . indexOf ( '(' ) !== - 1 ? callbackName . indexOf ( '(' ) : callbackName . length ,
54
54
atEndBracket = callbackName . lastIndexOf ( ')' ) !== - 1 ? callbackName . lastIndexOf ( ')' ) : callbackName . length ,
@@ -184,7 +184,9 @@ var jqyoui = angular.module('ngDragDrop', []).service('ngDragDropService', ['$ti
184
184
fromPos = $fromEl [ dropSettings . containment || 'offset' ] ( ) ,
185
185
displayProperty = $toEl . css ( 'display' ) , // sometimes `display` is other than `block`
186
186
hadNgHideCls = $toEl . hasClass ( 'ng-hide' ) ,
187
- hadDNDHideCls = $toEl . hasClass ( 'angular-dragdrop-hide' ) ;
187
+ hadDNDHideCls = $toEl . hasClass ( 'angular-dragdrop-hide' ) ,
188
+ jqyouiOptions = this . draggableScope . $eval ( $fromEl . attr ( 'data-jqyoui-options' ) ) || { } ,
189
+ zIndexDragged = jqyouiOptions . zIndex != null ? jqyouiOptions . zIndex : 9999 ;
188
190
189
191
if ( toPos === null && $toEl . length > 0 ) {
190
192
if ( ( $toEl . attr ( 'jqyoui-draggable' ) || $toEl . attr ( 'data-jqyoui-draggable' ) ) !== undefined && $toEl . ngattr ( 'ng-model' ) !== undefined && $toEl . is ( ':visible' ) && dropSettings && dropSettings . multiple ) {
@@ -195,7 +197,7 @@ var jqyoui = angular.module('ngDragDrop', []).service('ngDragDropService', ['$ti
195
197
toPos . top += $toEl . outerHeight ( true ) ;
196
198
}
197
199
} else {
198
- // Angular v1.2 uses ng-hide to hide an element
200
+ // Angular v1.2 uses ng-hide to hide an element
199
201
// so we've to remove it in order to grab its position
200
202
if ( hadNgHideCls ) $toEl . removeClass ( 'ng-hide' ) ;
201
203
if ( hadDNDHideCls ) $toEl . removeClass ( 'angular-dragdrop-hide' ) ;
@@ -204,7 +206,7 @@ var jqyoui = angular.module('ngDragDrop', []).service('ngDragDropService', ['$ti
204
206
}
205
207
}
206
208
207
- $fromEl . css ( { 'position' : 'absolute' , 'z-index' : 9999 } )
209
+ $fromEl . css ( { 'position' : 'absolute' , 'z-index' : zIndexDragged || 9999 } )
208
210
. css ( fromPos )
209
211
. animate ( toPos , duration , function ( ) {
210
212
// Angular v1.2 uses ng-hide to hide an element
@@ -303,19 +305,20 @@ var jqyoui = angular.module('ngDragDrop', []).service('ngDragDropService', ['$ti
303
305
restrict : 'A' ,
304
306
link : function ( scope , elem , attrs ) {
305
307
var element = $ ( elem ) ;
306
- var dragSettings , jqyouiOptions , zIndex , killWatcher ;
308
+ var dragSettings , jqyouiOptions , zIndex , zIndexDragged , killWatcher ;
307
309
var updateDraggable = function ( newValue , oldValue ) {
308
310
if ( newValue ) {
309
311
dragSettings = scope . $eval ( element . attr ( 'jqyoui-draggable' ) || element . attr ( 'data-jqyoui-draggable' ) ) || { } ;
310
312
jqyouiOptions = scope . $eval ( attrs . jqyouiOptions ) || { } ;
313
+ zIndexDragged = jqyouiOptions . zIndex != null ? jqyouiOptions . zIndex : 9999 ;
311
314
element
312
315
. draggable ( { disabled : false } )
313
316
. draggable ( jqyouiOptions )
314
317
. draggable ( {
315
318
start : function ( event , ui ) {
316
319
ngDragDropService . draggableScope = scope ;
317
320
zIndex = $ ( jqyouiOptions . helper ? ui . helper : this ) . css ( 'z-index' ) ;
318
- $ ( jqyouiOptions . helper ? ui . helper : this ) . css ( 'z-index' , 9999 ) ;
321
+ $ ( jqyouiOptions . helper ? ui . helper : this ) . css ( 'z-index' , zIndexDragged ) ;
319
322
jqyoui . startXY = $ ( this ) [ dragSettings . containment || 'offset' ] ( ) ;
320
323
ngDragDropService . callEventCallback ( scope , dragSettings . onStart , event , ui ) ;
321
324
} ,
@@ -403,7 +406,7 @@ var jqyoui = angular.module('ngDragDrop', []).service('ngDragDropService', ['$ti
403
406
404
407
killWatcher = scope . $watch ( function ( ) { return scope . $eval ( attrs . drop ) ; } , updateDroppable ) ;
405
408
updateDroppable ( ) ;
406
-
409
+
407
410
element . on ( '$destroy' , function ( ) {
408
411
element . droppable ( { disabled : true } ) . droppable ( 'destroy' ) ;
409
412
} ) ;
0 commit comments