Skip to content

Commit 7bd715d

Browse files
committed
closes #34
1 parent ecedb85 commit 7bd715d

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
@@ -174,15 +174,23 @@ class App extends Component {
174174

175175
// time travel bar change
176176
handleBarChange(e) {
177-
const { data } = this.state;
177+
const { data, isPlayingIndex } = this.state;
178178
const { id, action, state } = data[e.target.value];
179-
179+
// forward or past
180+
const currentIsPlayingIndex = e.target.value;
181+
const forward = currentIsPlayingIndex > isPlayingIndex;
180182
this.setState({
181183
id,
182184
action,
183185
state,
184-
isPlayingIndex: parseInt(e.target.value),
186+
isPlayingIndex: parseInt(currentIsPlayingIndex),
185187
});
188+
// Displays to screen
189+
if (forward) {
190+
this.toTheFuture();
191+
} else {
192+
this.toThePast();
193+
}
186194
}
187195

188196
// function to travel to the FUTURE

0 commit comments

Comments
 (0)