File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -544,9 +544,7 @@ class ComponentSortable {
544
544
545
545
resetListHeight ( ) {
546
546
this . items = Array . from ( this . list . children ) ;
547
- if ( this . items . length < 1 ) {
548
- return ;
549
- }
547
+ if ( this . items . length < 1 ) return ;
550
548
if ( this . items [ this . items . length - 1 ] . offsetTop > this . list . offsetHeight ) {
551
549
this . list_height = this . list . scrollHeight ;
552
550
} else {
@@ -556,6 +554,7 @@ class ComponentSortable {
556
554
557
555
dragStart ( e ) {
558
556
if ( this . animation ) return ;
557
+ if ( this . items . length < 2 ) return ;
559
558
if ( e . type === 'mousedown' && e . which !== 1 ) return ;
560
559
if ( e . type === 'touchstart' && e . touches . length > 1 ) return ;
561
560
@@ -605,7 +604,7 @@ class ComponentSortable {
605
604
606
605
dragMove ( e ) {
607
606
if ( this . animation ) return ;
608
-
607
+ if ( this . items . length < 2 ) return ;
609
608
const top = this . startTop + this . getDragY ( e ) - this . startTouchY ;
610
609
const newPosition = Math . round ( ( top / this . listHeight ) * this . items . length ) ;
611
610
@@ -627,7 +626,7 @@ class ComponentSortable {
627
626
628
627
dragEnd ( e ) {
629
628
this . animation = true ;
630
-
629
+ if ( this . items . length < 2 ) return ;
631
630
this . item . style . transition = `all ${ this . options . animationSpeed } ms ${ this . options . animationEasing } ` ;
632
631
this . item . style . transform = `translateY(${ this . position * this . itemHeight } px)` ;
633
632
You can’t perform that action at this time.
0 commit comments