Skip to content

Commit

Permalink
Make "Go To Work Zero" and "Go To Machine Zero" buttons configurable (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
cheton committed Aug 21, 2017
1 parent c26f52b commit 4fb3b0e
Show file tree
Hide file tree
Showing 20 changed files with 1,709 additions and 1,213 deletions.
61 changes: 61 additions & 0 deletions src/web/lib/combokeys.js
Expand Up @@ -6,6 +6,7 @@ import { preventDefault } from './dom-events';
const AXIS_X = 'x';
const AXIS_Y = 'y';
const AXIS_Z = 'z';
const AXIS_A = 'a';
const FORWARD = 1;
const BACKWARD = -1;
const OVERSHOOT_FACTOR = 10; // 10x
Expand Down Expand Up @@ -286,6 +287,66 @@ const commandKeys = [
},
preventDefault: false
},
{ // Jog A+
keys: ']',
cmd: 'JOG',
payload: {
axis: AXIS_A,
direction: FORWARD,
factor: 1
},
preventDefault: false
},
{ // Jog A+ (undershoot)
keys: 'alt+]',
cmd: 'JOG',
payload: {
axis: AXIS_A,
direction: FORWARD,
factor: UNDERSHOOT_FACTOR
},
preventDefault: false
},
{ // Jog A+ (overshoot)
keys: 'shift+]',
cmd: 'JOG',
payload: {
axis: AXIS_A,
direction: FORWARD,
factor: OVERSHOOT_FACTOR
},
preventDefault: false
},
{ // Jog A-
keys: '[',
cmd: 'JOG',
payload: {
axis: AXIS_A,
direction: BACKWARD,
factor: 1
},
preventDefault: false
},
{ // Jog A- (undershoot)
keys: 'alt+[',
cmd: 'JOG',
payload: {
axis: AXIS_A,
direction: BACKWARD,
factor: UNDERSHOOT_FACTOR
},
preventDefault: false
},
{ // Jog A- (overshoot)
keys: 'shift+[',
cmd: 'JOG',
payload: {
axis: AXIS_A,
direction: BACKWARD,
factor: OVERSHOOT_FACTOR
},
preventDefault: false
},
{ // Shuttle Zone -7
keys: ['ctrl', 'alt', 'shift', '7'].join('+'),
cmd: 'SHUTTLE',
Expand Down
2 changes: 2 additions & 0 deletions src/web/store/index.js
Expand Up @@ -51,6 +51,8 @@ export const defaultState = {
selectedDistance: '1',
customDistance: 10
},
wzero: 'G0 X0 Y0 Z0', // Go To Work Zero
mzero: 'G53 G0 X0 Y0 Z0', // Go To Machine Zero
shuttle: {
feedrateMin: 500,
feedrateMax: 2000,
Expand Down
5 changes: 5 additions & 0 deletions src/web/styles/bootstrap-override.styl
Expand Up @@ -15,6 +15,11 @@ label {
text-decoration: none;
}

// Tooltip
.tooltip-inner {
max-width: 240px;
}

// font-size
.btn,
.dropdown-header,
Expand Down
16 changes: 4 additions & 12 deletions src/web/widgets/Axes/Axes.jsx
@@ -1,29 +1,21 @@
import PropTypes from 'prop-types';
import React from 'react';
import Settings from './Settings';
import Toolbar from './Toolbar';
import DisplayPanel from './DisplayPanel';
import ControlPanel from './ControlPanel';
import {
MODAL_SETTINGS
} from './constants';

const Axes = (props) => {
const { state, actions } = props;
const { config, state, actions } = props;

return (
<div>
{state.modal.name === MODAL_SETTINGS &&
<Settings state={state} actions={actions} />
}
<Toolbar state={state} actions={actions} />
<DisplayPanel state={state} actions={actions} />
<ControlPanel state={state} actions={actions} />
<DisplayPanel config={config} state={state} actions={actions} />
<ControlPanel config={config} state={state} actions={actions} />
</div>
);
};

Axes.propTypes = {
config: PropTypes.object,
state: PropTypes.object,
actions: PropTypes.object
};
Expand Down
95 changes: 0 additions & 95 deletions src/web/widgets/Axes/AxesSettings.jsx

This file was deleted.

28 changes: 7 additions & 21 deletions src/web/widgets/Axes/ControlPanel.jsx
@@ -1,35 +1,21 @@
import React, { Component, PropTypes } from 'react';
import shallowCompare from 'react-addons-shallow-compare';
import JogPad from './JogPad';
import PropTypes from 'prop-types';
import React, { PureComponent } from 'react';
import Keypad from './Keypad';
import JogDistance from './JogDistance';
import MotionButtonGroup from './MotionButtonGroup';
import styles from './index.styl';

class ControlPanel extends Component {
class ControlPanel extends PureComponent {
static propTypes = {
config: PropTypes.object,
state: PropTypes.object,
actions: PropTypes.object
};

shouldComponentUpdate(nextProps, nextState) {
return shallowCompare(this, nextProps, nextState);
}
render() {
return (
<div className={styles.controlPanel}>
<div className="row no-gutters">
<div className="col-xs-6">
<JogPad {...this.props} />
</div>
<div className="col-xs-6">
<MotionButtonGroup {...this.props} />
</div>
</div>
<div className="row no-gutters">
<div className="col-xs-12">
<JogDistance {...this.props} />
</div>
</div>
<Keypad {...this.props} />
<JogDistance {...this.props} />
</div>
);
}
Expand Down

0 comments on commit 4fb3b0e

Please sign in to comment.