diff --git a/modules/ui/components/Window.jsx b/modules/ui/components/Window.jsx index 99cdc932..f4fae45f 100644 --- a/modules/ui/components/Window.jsx +++ b/modules/ui/components/Window.jsx @@ -16,8 +16,8 @@ export default class Window extends React.Component { } render() { - let {children, title, minimizable, onClose} = this.props; - return
+ let {initWidth, initLeft, initTop, children, title, minimizable, onClose, ...props} = this.props; + return
{title.toUpperCase()}
@@ -39,6 +39,17 @@ export default class Window extends React.Component { zIndex: 1 } } + + componentDidMount() { + if (this.props.onFocus) { + this.props.onFocus(this.el); + } else { + this.el.focus(); + } + } + + keepRef = el => this.el = el; + } Window.defaultProps = { diff --git a/web/app/cad/dom/actionInfo/ActionInfo.less b/web/app/cad/dom/actionInfo/ActionInfo.less index dac28d50..08db87a1 100644 --- a/web/app/cad/dom/actionInfo/ActionInfo.less +++ b/web/app/cad/dom/actionInfo/ActionInfo.less @@ -16,6 +16,7 @@ text-align: right; font-style: italic; color: @font-color-suppressed; + text-transform: capitalize; } .hint { diff --git a/web/app/cad/dom/components/wizard/Wizard.jsx b/web/app/cad/dom/components/wizard/Wizard.jsx index bbdc118c..eb34c8f9 100644 --- a/web/app/cad/dom/components/wizard/Wizard.jsx +++ b/web/app/cad/dom/components/wizard/Wizard.jsx @@ -39,7 +39,12 @@ export default class Wizard extends React.Component { render() { let {left, title, metadata} = this.props; - return + return {metadata.map(([name, type, , params], index) => { return @@ -61,6 +66,25 @@ export default class Wizard extends React.Component { ; } + onKeyDown = e => { + switch (e.keyCode) { + case 27 : + this.onClose(); + break; + case 13 : + this.onOK(); + break; + } + }; + + focusFirstInput = el => { + let toFocus = el.querySelector('input, select'); + if (!toFocus) { + toFocus = el; + } + toFocus.focus() + }; + onClose = () => { this.preview.dispose(); this.props.onCancel(); @@ -85,20 +109,20 @@ export default class Wizard extends React.Component { } }; - controlForType(name, type, params) { + controlForType(name, type, params, tabindex) { const onChange = val => { this.params[name] = val; this.preview.update(this.params); }; let initValue = this.params[name]; - let commonProps = {onChange, initValue}; + let commonProps = {onChange, initValue, tabindex}; if (type === 'number') { return } else if (type === 'face') { return } else if (type === 'choice') { return - {params.options.map(op => )} + {params.options.map(op => )} } else { return diff --git a/web/app/cad/keyboard/keymaps/default.js b/web/app/cad/keyboard/keymaps/default.js index 33f22652..b165f256 100644 --- a/web/app/cad/keyboard/keymaps/default.js +++ b/web/app/cad/keyboard/keymaps/default.js @@ -1,6 +1,7 @@ export default { 'CUT': 'c', 'EXTRUDE': 'e', + 'PLANE': 'p', 'ZoomIn': '+', 'ZoomOut': '-', 'menu.craft': 'shift+c',