@@ -82,17 +82,11 @@ module.exports =
82
82
/******/
83
83
/******/
84
84
/******/ // Load entry module and return exports
85
- /******/ return __webpack_require__ ( __webpack_require__ . s = 1 ) ;
85
+ /******/ return __webpack_require__ ( __webpack_require__ . s = 0 ) ;
86
86
/******/ } )
87
87
/************************************************************************/
88
88
/******/ ( [
89
89
/* 0 */
90
- /***/ ( function ( module , exports ) {
91
-
92
- module . exports = require ( "lodash/throttle" ) ;
93
-
94
- /***/ } ) ,
95
- /* 1 */
96
90
/***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
97
91
98
92
"use strict" ;
@@ -918,15 +912,10 @@ Code related to auotplay features of the carousel
918
912
}
919
913
}
920
914
} ) ;
921
- // EXTERNAL MODULE: external "lodash/throttle"
922
- var throttle_ = __webpack_require__ ( 0 ) ;
923
- var throttle_default = /*#__PURE__*/ __webpack_require__ . n ( throttle_ ) ;
924
-
925
915
// CONCATENATED MODULE: ./src/concerns/dimensions.coffee
926
916
/*
927
917
Code related to measuring the size of the carousel after mounting
928
918
*/
929
-
930
919
/* harmony default export */ var dimensions_coffee = ( {
931
920
data : function ( ) {
932
921
return {
@@ -941,12 +930,11 @@ Code related to measuring the size of the carousel after mounting
941
930
// Add resize listening
942
931
mounted : function ( ) {
943
932
this . onResize ( ) ;
944
- this . onResizeThrottled = throttle_default ( ) ( this . onResize , 200 ) ;
945
- return window . addEventListener ( 'resize' , this . onResizeThrottled ) ;
933
+ return window . addEventListener ( 'resize' , this . onResize ) ;
946
934
} ,
947
935
// Cleanup listeners
948
936
beforeDestroy : function ( ) {
949
- return window . removeEventListener ( 'resize' , this . onResizeThrottled ) ;
937
+ return window . removeEventListener ( 'resize' , this . onResize ) ;
950
938
} ,
951
939
computed : {
952
940
// The width of a page of slides, which may be less than the carouselWidth
@@ -1724,14 +1712,15 @@ Code related to dealing with advancing between pages
1724
1712
}
1725
1713
} ,
1726
1714
watch : {
1727
- // Treat v-model input as a "goto" request. Immediately fire an input
1728
- // event if the index was not changed, like when an edge is reached, to
1729
- // update the parent component.
1715
+ // Treat v-model input as a "goto" request
1730
1716
value : function ( ) {
1731
- this . goto ( this . value ) ;
1732
-
1733
- if ( this . value !== this . boundedIndex ) {
1734
- return this . $emit ( 'input' , this . boundedIndex ) ;
1717
+ // If the value exceeds the bounds, immediately emit a new input event
1718
+ // with the corrected value
1719
+ if ( this . value !== this . applyIndexBoundaries ( this . value ) ) {
1720
+ return this . $emit ( 'input' , this . boundedIndex ) ; // Else if the incoming value is different than the current value
1721
+ // then tween to it
1722
+ } else if ( this . value !== this . boundedIndex ) {
1723
+ return this . goto ( this . value ) ;
1735
1724
}
1736
1725
} ,
1737
1726
// Emit events on index change
@@ -1779,14 +1768,21 @@ Code related to dealing with advancing between pages
1779
1768
} ,
1780
1769
// Tween to a specific index
1781
1770
tweenToIndex : function ( index ) {
1771
+ this . targetX = this . getXForIndex ( index ) ;
1772
+ return this . startTweening ( ) ;
1773
+ } ,
1774
+ // Jump to an index with no tween
1775
+ jumpToIndex : function ( index ) {
1776
+ return this . currentX = this . targetX = this . getXForIndex ( index ) ;
1777
+ } ,
1778
+ // Calculate the X value given an index
1779
+ getXForIndex : function ( index ) {
1782
1780
var x ; // Figure out the new x position
1783
1781
1784
1782
x = this . paginateBySlide ? index * this . slideWidth * - 1 : index * this . pageWidth * - 1 ; // Apply adjustments to x value and persist
1785
1783
1786
1784
x += this . makeIncompletePageOffset ( index ) ;
1787
- this . targetX = Math . round ( this . applyXBoundaries ( x ) ) ; // Start tweening
1788
-
1789
- return this . startTweening ( ) ;
1785
+ return Math . round ( this . applyXBoundaries ( x ) ) ;
1790
1786
} ,
1791
1787
// Creates a px value to represent adjustments that should be made to
1792
1788
// account for incommplete pages of slides when looping is enabled. Like
@@ -2038,7 +2034,7 @@ Code related to changing the slides per page at different viewport widths
2038
2034
watch : {
2039
2035
// Fix alignment of slides while resizing
2040
2036
pageWidth : function ( ) {
2041
- return this . tweenToIndex ( this . index ) ;
2037
+ return this . jumpToIndex ( this . index ) ;
2042
2038
} ,
2043
2039
// If resizing the browser leads to disabling, reset the slide to the first
2044
2040
// page. Like if a user had switched to the 2nd page on mobile and then
@@ -2212,9 +2208,7 @@ Code related to tweening the position of the track
2212
2208
// The actual left offset of the slides container
2213
2209
targetX : 0 ,
2214
2210
// Where we may be tweening the slide to
2215
- tweening : false ,
2216
- // If there is a current RAF based tween running
2217
- firstTween : true // Has the first tween been triggered
2211
+ tweening : false // If there is a current RAF based tween running
2218
2212
2219
2213
} ;
2220
2214
} ,
@@ -2229,8 +2223,7 @@ Code related to tweening the position of the track
2229
2223
this . $emit ( 'tween:start' , {
2230
2224
index : this . index
2231
2225
} ) ;
2232
- this . tweenToTarget ( ) ;
2233
- return this . firstTween = false ;
2226
+ return this . tweenToTarget ( ) ;
2234
2227
} else {
2235
2228
window . cancelAnimationFrame ( this . rafId ) ;
2236
2229
return this . $emit ( 'tween:end' , {
@@ -2264,12 +2257,8 @@ Code related to tweening the position of the track
2264
2257
} ,
2265
2258
// Tween the currentX to the targetX
2266
2259
tweenToTarget : function ( ) {
2267
- var dampening ; // If on the first tween and the first page was set to something other
2268
- // than 0 by v-model, then instantly jump to the final destination
2269
-
2270
- dampening = this . firstTween && this . value !== 0 ? 1 : this . tweenDampening ; // Apply tween math
2271
-
2272
- this . currentX = this . currentX + ( this . targetX - this . currentX ) * dampening ;
2260
+ // Apply tween math
2261
+ this . currentX = this . currentX + ( this . targetX - this . currentX ) * this . tweenDampening ;
2273
2262
2274
2263
if ( Math . abs ( this . targetX - this . currentX ) < 1 ) {
2275
2264
// Stops tweening
0 commit comments