Skip to content
This repository was archived by the owner on Feb 24, 2023. It is now read-only.

Commit 631529b

Browse files
author
Łukasz Florczak
committed
MouseOver event fix
1 parent e2ae5ce commit 631529b

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/Agile.vue

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,18 @@
279279
},
280280
281281
handleMouseOver (element) {
282-
if ((element === 'dot' && this.settings.pauseOnDotsHover) || (element === 'track' && this.settings.pauseOnHover)) {
283-
this.disableAutoplayMode()
282+
if (this.settings.autoplay) {
283+
if ((element === 'dot' && this.settings.pauseOnDotsHover) || (element === 'track' && this.settings.pauseOnHover)) {
284+
this.disableAutoplayMode()
285+
}
284286
}
285287
},
286288
287289
handleMouseOut (element) {
288-
if ((element === 'dot' && this.settings.pauseOnDotsHover) || (element === 'track' && this.settings.pauseOnHover)) {
289-
this.enableAutoplayMode()
290+
if (this.settings.autoplay) {
291+
if ((element === 'dot' && this.settings.pauseOnDotsHover) || (element === 'track' && this.settings.pauseOnHover)) {
292+
this.enableAutoplayMode()
293+
}
290294
}
291295
},
292296
@@ -529,8 +533,6 @@
529533
530534
watch: {
531535
show () {
532-
console.log(this.show)
533-
534536
this.getWidth()
535537
this.reload()
536538
},
@@ -540,26 +542,24 @@
540542
},
541543
542544
dragDistance () {
543-
if (!this.mouseDown) {
544-
return false
545-
}
545+
if (this.mouseDown) {
546+
if (this.dragDistance > this.swipeDistance) {
547+
if (!this.settings.infinite && this.currentSlide === 0) {
548+
return
549+
}
546550
547-
if (this.dragDistance > this.swipeDistance) {
548-
if (!this.settings.infinite && this.currentSlide === 0) {
549-
return
551+
this.prevSlide()
552+
this.handleMouseUp()
550553
}
551554
552-
this.prevSlide()
553-
this.handleMouseUp()
554-
}
555+
if (this.dragDistance < -1 * this.swipeDistance) {
556+
if (!this.settings.infinite && this.currentSlide === this.slidesCount - 1) {
557+
return
558+
}
555559
556-
if (this.dragDistance < -1 * this.swipeDistance) {
557-
if (!this.settings.infinite && this.currentSlide === this.slidesCount - 1) {
558-
return
560+
this.nextSlide()
561+
this.handleMouseUp()
559562
}
560-
561-
this.nextSlide()
562-
this.handleMouseUp()
563563
}
564564
}
565565
}

0 commit comments

Comments
 (0)