Skip to content
Snippets Groups Projects
Commit b681e630 authored by DD's avatar DD
Browse files

toggle turbo mode on shift click the green flag

parent 075216f5
Branches
Tags
No related merge requests found
......@@ -11,18 +11,24 @@ class GreenFlag extends React.Component {
super(props);
bindAll(this, [
'handleClick',
'handleKeyDown',
'handleKeyUp',
'onProjectRunStart',
'onProjectRunStop'
]);
this.state = {projectRunning: false};
this.state = {projectRunning: false, shiftKeyDown: false};
}
componentDidMount () {
this.props.vm.addListener('PROJECT_RUN_START', this.onProjectRunStart);
this.props.vm.addListener('PROJECT_RUN_STOP', this.onProjectRunStop);
document.addEventListener('keydown', this.handleKeyDown);
document.addEventListener('keyup', this.handleKeyUp);
}
componentWillUnmount () {
this.props.vm.removeListener('PROJECT_RUN_START', this.onProjectRunStart);
this.props.vm.removeListener('PROJECT_RUN_STOP', this.onProjectRunStop);
document.removeEventListener('keydown', this.handleKeyDown);
document.removeEventListener('keyup', this.handleKeyUp);
}
onProjectRunStart () {
this.setState({projectRunning: true});
......@@ -30,9 +36,19 @@ class GreenFlag extends React.Component {
onProjectRunStop () {
this.setState({projectRunning: false});
}
handleKeyDown (e) {
this.setState({shiftKeyDown: e.shiftKey});
}
handleKeyUp (e) {
this.setState({shiftKeyDown: e.shiftKey});
}
handleClick (e) {
e.preventDefault();
this.props.vm.greenFlag();
if (this.state.shiftKeyDown) {
this.props.vm.setTurboMode(!this.props.vm.runtime.turboMode);
} else {
this.props.vm.greenFlag();
}
}
render () {
const {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment