File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change 22
22
}
23
23
24
24
var sortingInProgress ;
25
+ var isDisabled = false ;
26
+
25
27
var ROOTS_MAP = Object . create ( null ) ;
26
28
// window.ROOTS_MAP = ROOTS_MAP; // for debug purposes
27
29
56
58
return sortingInProgress ;
57
59
} ;
58
60
61
+ if ( $attrs . svDisabled ) {
62
+ $scope . $watch ( $attrs . svDisabled , function ( disabled ) {
63
+ isDisabled = disabled === true ;
64
+ } ) ;
65
+ }
66
+
67
+ this . isDisabled = function ( ) {
68
+ return isDisabled ;
69
+ } ;
70
+
59
71
if ( $attrs . svGrid ) { // sv-grid determined explicite
60
72
isGrid = $attrs . svGrid === "true" ? true : $attrs . svGrid === "false" ? false : null ;
61
73
if ( isGrid === null )
361
373
handle . off ( 'mousedown touchstart' , onMousedown ) ;
362
374
} ) ;
363
375
364
- $attrs . $observe ( 'svDisabled' , function ( disabled ) {
365
- disabled = $scope . $eval ( disabled ) ;
366
- if ( ! disabled ) handle . on ( 'mousedown touchstart' , onMousedown ) ;
367
- else handle . off ( 'mousedown touchstart' , onMousedown ) ;
368
- } ) ;
369
-
376
+ handle . on ( 'mousedown touchstart' , onMousedown ) ;
370
377
$scope . $watch ( '$ctrl.handle' , function ( customHandle ) {
371
378
if ( customHandle ) {
372
379
handle . off ( 'mousedown touchstart' , onMousedown ) ;
397
404
function onMousedown ( e ) {
398
405
touchFix ( e ) ;
399
406
400
- if ( $controllers [ 1 ] . sortingInProgress ( ) ) return ;
407
+ if ( $controllers [ 1 ] . isDisabled ( ) || $controllers [ 1 ] . sortingInProgress ( ) ) return ;
401
408
if ( e . button != 0 && e . type === 'mousedown' ) return ;
402
409
403
410
moveExecuted = false ;
You can’t perform that action at this time.
0 commit comments