Skip to content

Commit 04e4fb7

Browse files
committed
1.4
1 parent 9c5fcf7 commit 04e4fb7

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

resources/assets/component.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,7 @@ class ComponentSortable {
544544

545545
resetListHeight(){
546546
this.items = Array.from(this.list.children);
547-
if(this.items.length<1){
548-
return;
549-
}
547+
if(this.items.length<1)return;
550548
if(this.items[this.items.length-1].offsetTop > this.list.offsetHeight){
551549
this.list_height = this.list.scrollHeight;
552550
}else {
@@ -556,6 +554,7 @@ class ComponentSortable {
556554

557555
dragStart(e) {
558556
if (this.animation) return;
557+
if(this.items.length<2)return;
559558
if (e.type === 'mousedown' && e.which !== 1) return;
560559
if (e.type === 'touchstart' && e.touches.length > 1) return;
561560

@@ -605,7 +604,7 @@ class ComponentSortable {
605604

606605
dragMove(e) {
607606
if (this.animation) return;
608-
607+
if(this.items.length<2)return;
609608
const top = this.startTop + this.getDragY(e) - this.startTouchY;
610609
const newPosition = Math.round((top / this.listHeight) * this.items.length);
611610

@@ -627,7 +626,7 @@ class ComponentSortable {
627626

628627
dragEnd(e) {
629628
this.animation = true;
630-
629+
if(this.items.length<2)return;
631630
this.item.style.transition = `all ${this.options.animationSpeed}ms ${this.options.animationEasing}`;
632631
this.item.style.transform = `translateY(${this.position * this.itemHeight}px)`;
633632

0 commit comments

Comments
 (0)