Skip to content

Commit

Permalink
fixed 0 frames problem in intro, and rounding up when doing conversio…
Browse files Browse the repository at this point in the history
…n of FPS to milliseconds - MR
  • Loading branch information
marungo committed Mar 22, 2018
1 parent 3b1f25d commit 6802928
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/components/intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class Intro extends React.Component {
<div id="intro">
<form onSubmit={this.handleIntroSubmit}>
<label>How many levels? &nbsp;</label><input type="number" min={1} max={20} name="numLevels" value={this.state.numLevels} placeholder={this.state.numLevels} onChange={this.handleInputChange}/><br/>
<label>How many frames per second is your video? &nbsp; </label><input type="number" min={0} max={100} name="numFrames" value={this.state.numFrames} placeholder={this.state.numFrames} onChange={this.handleInputChange}/><br/>
<label>How many frames per second is your video? &nbsp; </label><input type="number" min={1} max={100} name="numFrames" value={this.state.numFrames} placeholder={this.state.numFrames} onChange={this.handleInputChange}/><br/>
<Button bsStyle="primary" type="submit">Start Configuring!</Button>
</form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/utilities/exportHelperFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const convertToMilliseconds = (value, numFrames) => {
const valuesArray = value.split(".");
const numMillisecondsPerFrame = 1000/Number(numFrames);
const frame = Number(valuesArray[1])-1; // convert to a 0-indexed format
const milliseconds = ("000" + Math.round(frame*numMillisecondsPerFrame)).slice(-3);
const milliseconds = ("000" + Math.ceil(frame*numMillisecondsPerFrame)).slice(-3);

return valuesArray[0] + "." + milliseconds;
}
Expand Down

0 comments on commit 6802928

Please sign in to comment.