summaryrefslogtreecommitdiff
path: root/src/components/app/timeline
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-30 09:58:43 +0200
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-30 09:58:43 +0200
commit99ede1e1515b2dcee5cabbfab4fd5f4db675a59f (patch)
tree8ce94c61c471b8f9f5c2656a4e3c6936c45368ae /src/components/app/timeline
parent5ad02f9cb3a68010c25c5a5d835f61382b109491 (diff)
Don't allow un-pausing at end of simulation
Diffstat (limited to 'src/components/app/timeline')
-rw-r--r--src/components/app/timeline/PlayButtonComponent.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/components/app/timeline/PlayButtonComponent.js b/src/components/app/timeline/PlayButtonComponent.js
index 6ec70cc3..2b8e5328 100644
--- a/src/components/app/timeline/PlayButtonComponent.js
+++ b/src/components/app/timeline/PlayButtonComponent.js
@@ -1,7 +1,15 @@
import React from "react";
-const PlayButtonComponent = ({isPlaying, onPlay, onPause}) => (
- <div className="play-btn" onClick={() => isPlaying ? onPause() : onPlay()}>
+const PlayButtonComponent = ({isPlaying, currentTick, lastSimulatedTick, onPlay, onPause}) => (
+ <div className="play-btn" onClick={() => {
+ if (isPlaying) {
+ onPause();
+ } else {
+ if (currentTick !== lastSimulatedTick) {
+ onPlay();
+ }
+ }
+ }}>
{isPlaying ?
<span className="fa fa-pause"/> :
<span className="fa fa-play"/>