Skip to content

Commit 95b0dd3

Browse files
committed
kias handleBar changes merged
2 parents 30d5747 + f6d2743 commit 95b0dd3

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/app/components/App.jsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,23 @@ class App extends Component {
172172

173173
// time travel bar change
174174
handleBarChange(e) {
175-
const { data } = this.state;
175+
const { data, isPlayingIndex } = this.state;
176176
const { id, action, state } = data[e.target.value];
177-
177+
// forward or past
178+
const currentIsPlayingIndex = e.target.value;
179+
const forward = currentIsPlayingIndex > isPlayingIndex;
178180
this.setState({
179181
id,
180182
action,
181183
state,
182-
isPlayingIndex: parseInt(e.target.value),
184+
isPlayingIndex: parseInt(currentIsPlayingIndex),
183185
});
186+
// Displays to screen
187+
if (forward) {
188+
this.toTheFuture();
189+
} else {
190+
this.toThePast();
191+
}
184192
}
185193

186194
// function to travel to the FUTURE

0 commit comments

Comments
 (0)