@@ -66,8 +66,17 @@ export default {
6666 }
6767 } ,
6868 computed : {
69+ rtlDir ( ) {
70+ return this . $q . i18n . rtl ? - 1 : 1
71+ } ,
72+ arrowIcon ( ) {
73+ const ico = [ this . $q . icon . carousel . left , this . $q . icon . carousel . right ]
74+ return this . $q . i18n . rtl
75+ ? ico . reverse ( )
76+ : ico
77+ } ,
6978 trackPosition ( ) {
70- return cssTransform ( `translateX(${ this . position } %)` )
79+ return cssTransform ( `translateX(${ this . rtlDir * this . position } %)` )
7180 } ,
7281 infiniteLeft ( ) {
7382 return this . infinite && this . slidesNumber > 1 && this . positionSlide < 0
@@ -204,7 +213,7 @@ export default {
204213 this . __cleanup ( )
205214 }
206215
207- let delta = ( event . direction === 'left' ? - 1 : 1 ) * event . distance . x
216+ let delta = this . rtlDir * ( event . direction === 'left' ? - 1 : 1 ) * event . distance . x
208217
209218 if (
210219 ( this . infinite && this . slidesNumber < 2 ) ||
@@ -221,13 +230,14 @@ export default {
221230
222231 const
223232 pos = this . initialPosition + delta / this . $refs . track . offsetWidth * 100 ,
224- slidePos = ( event . direction === 'left' ? this . slide + 1 : this . slide - 1 )
233+ slidePos = this . slide + this . rtlDir * ( event . direction === 'left' ? 1 : - 1 )
225234
226235 if ( this . position !== pos ) {
227236 this . position = pos
228237 }
229238 if ( this . positionSlide !== slidePos ) {
230239 this . positionSlide = slidePos
240+ console . log ( slidePos )
231241 }
232242
233243 if ( event . isFinal ) {
@@ -371,13 +381,13 @@ export default {
371381 ] ) ,
372382 this . arrows ? h ( QBtn , {
373383 staticClass : 'q-carousel-left-arrow absolute' ,
374- props : { color : this . color , icon : this . $q . icon . carousel . left , fabMini : true , flat : true } ,
384+ props : { color : this . color , icon : this . arrowIcon [ 0 ] , fabMini : true , flat : true } ,
375385 directives : [ { name : 'show' , value : this . canGoToPrevious } ] ,
376386 on : { click : this . previous }
377387 } ) : null ,
378388 this . arrows ? h ( QBtn , {
379389 staticClass : 'q-carousel-right-arrow absolute' ,
380- props : { color : this . color , icon : this . $q . icon . carousel . right , fabMini : true , flat : true } ,
390+ props : { color : this . color , icon : this . arrowIcon [ 1 ] , fabMini : true , flat : true } ,
381391 directives : [ { name : 'show' , value : this . canGoToNext } ] ,
382392 on : { click : this . next }
383393 } ) : null ,
0 commit comments