-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
offset implemented, added offset to defaultVid
- Loading branch information
Showing
5 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React, { Component } from 'react'; | ||
|
||
class Offset extends Component { | ||
constructor() { | ||
super() | ||
this.decrease = this.decrease.bind(this); | ||
this.increase = this.increase.bind(this); | ||
this.onKeyDown = this.onKeyDown.bind(this); | ||
} | ||
render() { | ||
return ( | ||
<div className="offset"> | ||
<button | ||
onClick={this.decrease} | ||
>-</button> | ||
<input | ||
type="textbox" | ||
value={this.props.offset} | ||
onKeyDown={this.onKeyDown} | ||
></input> | ||
<button | ||
onClick={this.increase} | ||
>+</button> | ||
</div> | ||
) | ||
} | ||
decrease() { | ||
this.props.setOffset(this.props.offset-0.1); | ||
} | ||
increase() { | ||
this.props.setOffset(this.props.offset+0.1); | ||
} | ||
onKeyDown(e) { | ||
switch(e.keyCode){ | ||
case 38://up | ||
case 39://right | ||
this.increase(); | ||
break; | ||
case 40://down | ||
case 37://left | ||
this.decrease(); | ||
break; | ||
default: | ||
} | ||
} | ||
} | ||
|
||
export default Offset | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters