summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/components/app/timeline/PlayButtonComponent.js12
-rw-r--r--src/containers/app/timeline/PlayButtonContainer.js2
2 files changed, 12 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"/>
diff --git a/src/containers/app/timeline/PlayButtonContainer.js b/src/containers/app/timeline/PlayButtonContainer.js
index 3db5302c..1003b69c 100644
--- a/src/containers/app/timeline/PlayButtonContainer.js
+++ b/src/containers/app/timeline/PlayButtonContainer.js
@@ -5,6 +5,8 @@ import PlayButtonComponent from "../../../components/app/timeline/PlayButtonComp
const mapStateToProps = state => {
return {
isPlaying: state.isPlaying,
+ currentTick: state.currentTick,
+ lastSimulatedTick: state.lastSimulatedTick,
};
};