File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 8
8
moveForward ,
9
9
moveBackward ,
10
10
resetSlider ,
11
+ changeSlider ,
11
12
} from '../slices/mainSlice' ;
12
13
import { useDispatch , useSelector } from 'react-redux' ;
13
14
import { MainState , RootState , TravelContainerProps } from '../FrontendTypes' ;
@@ -40,6 +41,7 @@ function play( // function that will start/pause slider movement
40
41
if ( playing ) {
41
42
// if already playing, clicking the button will pause the slider
42
43
dispatch ( pause ( ) ) ;
44
+
43
45
} else {
44
46
let currentIndex = sliderIndex ; // the 'currentIndex' will be wherever the 'sliderIndex' is
45
47
if ( currentIndex === snapshotsLength - 1 ) {
@@ -53,6 +55,7 @@ function play( // function that will start/pause slider movement
53
55
// as long as we're not the last snapshot, increment slider up through our dispatch and increment index
54
56
dispatch ( playForward ( true ) ) ;
55
57
currentIndex += 1 ;
58
+ dispatch ( changeSlider ( currentIndex ) ) ;
56
59
} else {
57
60
dispatch ( pause ( ) ) ; // pause the slider when we reach the end
58
61
}
Original file line number Diff line number Diff line change @@ -88,7 +88,10 @@ export const mainSlice = createSlice({
88
88
const { snapshots : newSnaps } = payload [ tab ] ;
89
89
tabs [ tab ] = {
90
90
...payload [ tab ] ,
91
- sliderIndex : newSnaps . length - 1 ,
91
+ intervalId : tabs [ tab ] . intervalId ,
92
+ playing : tabs [ tab ] . playing ,
93
+ //sliderIndex: newSnaps.length - 1,
94
+ sliderIndex : tabs [ tab ] . sliderIndex ,
92
95
seriesSavedStatus : false ,
93
96
} ;
94
97
}
You can’t perform that action at this time.
0 commit comments