File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 88 moveForward ,
99 moveBackward ,
1010 resetSlider ,
11+ changeSlider ,
1112} from '../slices/mainSlice' ;
1213import { useDispatch , useSelector } from 'react-redux' ;
1314import { MainState , RootState , TravelContainerProps } from '../FrontendTypes' ;
@@ -40,6 +41,7 @@ function play( // function that will start/pause slider movement
4041 if ( playing ) {
4142 // if already playing, clicking the button will pause the slider
4243 dispatch ( pause ( ) ) ;
44+
4345 } else {
4446 let currentIndex = sliderIndex ; // the 'currentIndex' will be wherever the 'sliderIndex' is
4547 if ( currentIndex === snapshotsLength - 1 ) {
@@ -53,6 +55,7 @@ function play( // function that will start/pause slider movement
5355 // as long as we're not the last snapshot, increment slider up through our dispatch and increment index
5456 dispatch ( playForward ( true ) ) ;
5557 currentIndex += 1 ;
58+ dispatch ( changeSlider ( currentIndex ) ) ;
5659 } else {
5760 dispatch ( pause ( ) ) ; // pause the slider when we reach the end
5861 }
Original file line number Diff line number Diff line change @@ -88,7 +88,9 @@ export const mainSlice = createSlice({
8888 const { snapshots : newSnaps } = payload [ tab ] ;
8989 tabs [ tab ] = {
9090 ...payload [ tab ] ,
91- sliderIndex : newSnaps . length - 1 ,
91+ intervalId : tabs [ tab ] . intervalId ,
92+ playing : tabs [ tab ] . playing ,
93+ sliderIndex : tabs [ tab ] . sliderIndex ,
9294 seriesSavedStatus : false ,
9395 } ;
9496 }
You can’t perform that action at this time.
0 commit comments