@@ -121,16 +121,12 @@ class SnapControl extends Control {
121121 } ) ;
122122 }
123123
124- const nextPanel = targetAnchor . panel ;
125- const direction = ( posDelta === 0 || activeAnchor === targetAnchor ) ? DIRECTION . NONE : ( posDelta > 0 ? DIRECTION . NEXT : DIRECTION . PREV ) ;
126- const nextPosition = this . _getPosition ( nextPanel , direction ) ;
127-
128- this . _triggerIndexChangeEvent ( nextPanel , position , axesEvent ) ;
124+ this . _triggerIndexChangeEvent ( targetAnchor . panel , position , axesEvent ) ;
129125
130126 return this . _animateToPosition ( {
131- position : camera . clampToReachablePosition ( nextPosition ) ,
127+ position : camera . clampToReachablePosition ( targetAnchor . position ) ,
132128 duration,
133- newActivePanel : nextPanel ,
129+ newActivePanel : targetAnchor . panel ,
134130 axesEvent
135131 } ) ;
136132 }
@@ -143,15 +139,14 @@ class SnapControl extends Control {
143139 const currentPos = camera . position ;
144140
145141 const clampedPosition = camera . clampToReachablePosition ( position ) ;
146- const nearestAnchor = camera . findNearestAnchor ( clampedPosition ) ;
147142 const anchorAtPosition = camera . findAnchorIncludePosition ( clampedPosition ) ;
148143
149- if ( ! anchorAtCamera || ! anchorAtPosition || ! nearestAnchor ) {
144+ if ( ! anchorAtCamera || ! anchorAtPosition ) {
150145 throw new FlickingError ( ERROR . MESSAGE . POSITION_NOT_REACHABLE ( position ) , ERROR . CODE . POSITION_NOT_REACHABLE ) ;
151146 }
152147
153148 if ( ! isFinite ( count ) ) {
154- return nearestAnchor ;
149+ return anchorAtPosition ;
155150 }
156151
157152 const panelCount = flicking . panelCount ;
0 commit comments