@@ -160,20 +160,16 @@ export class ESLMultiCarouselRenderer extends ESLCarouselRenderer {
160160 const slideSize = this . slideSize + this . gap ;
161161 // calculate offset to move to
162162 const shiftCount = Math . abs ( offset ) % slideSize >= slideSize / 4 ? 1 : 0 ;
163- const stageOffset = offset < 0 ? - shiftCount * slideSize : ( shiftCount - 1 ) * slideSize - this . gap ;
163+ const stageOffset = offset < 0 ? - shiftCount * slideSize : ( shiftCount - 1 ) * slideSize ;
164164
165165 this . $carousel . toggleAttribute ( 'animating' , true ) ;
166166 this . setTransformOffset ( stageOffset ) ;
167167 await promisifyEvent ( this . $area , 'transitionend' ) . catch ( resolvePromise ) ;
168168 }
169169
170- // clear animation
171- this . $carousel . toggleAttribute ( 'animating' , false ) ;
172- this . setTransformOffset ( 0 ) ;
173- this . $slides . forEach ( ( el ) => el . toggleAttribute ( 'visible' , false ) ) ;
174-
175170 const sign = offset < 0 ? 1 : - 1 ;
176- const count = Math . abs ( offset ) % this . slideSize >= this . slideSize / 4 ?
171+ const slideSize = this . slideSize + this . gap ;
172+ const count = Math . abs ( offset ) % slideSize >= slideSize / 4 ?
177173 Math . ceil ( Math . abs ( offset ) / this . slideSize ) : Math . floor ( Math . abs ( offset ) / this . slideSize ) ;
178174 const nextIndex = this . $carousel . activeIndex + count * sign ;
179175
@@ -189,6 +185,11 @@ export class ESLMultiCarouselRenderer extends ESLCarouselRenderer {
189185
190186 this . setActive ( this . currentIndex ) ;
191187
188+ // clear animation
189+ this . $carousel . toggleAttribute ( 'animating' , false ) ;
190+ this . setTransformOffset ( 0 ) ;
191+ this . $slides . forEach ( ( el ) => el . toggleAttribute ( 'visible' , false ) ) ;
192+
192193 if ( activeIndex !== this . currentIndex ) {
193194 this . $carousel . dispatchEvent ( ESLCarouselSlideEvent . create ( 'AFTER' , {
194195 direction,
0 commit comments