Move the labels above the inputs for languages that don’t fix in the width of the sprite-info pane. Because of the different widths of everything I left aligned them. Examples, Abkhaz, Catalan, Greek. renamed the `rtl-locales` lib file as `locale-utils` as it’s doing more than rtl now. RTL should probably move into the scratch-l10n repo, but should the `wide-locales` setting? That seems like something that is gui specific. I don’t like having to hard code the specific languages that don’t fit, but there didn’t seem to be a better way to handle it right now.
65 lines
2.0 KiB
React
65 lines
2.0 KiB
React
import bindAll from 'lodash.bindall';
|
|
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
|
|
import DirectionComponent, {RotationStyles} from '../components/direction-picker/direction-picker.jsx';
|
|
|
|
class DirectionPicker extends React.Component {
|
|
constructor (props) {
|
|
super(props);
|
|
bindAll(this, [
|
|
'handleOpenPopover',
|
|
'handleClosePopover',
|
|
'handleClickLeftRight',
|
|
'handleClickDontRotate',
|
|
'handleClickAllAround'
|
|
]);
|
|
this.state = {
|
|
popoverOpen: false
|
|
};
|
|
}
|
|
handleOpenPopover () {
|
|
this.setState({popoverOpen: true});
|
|
}
|
|
handleClosePopover () {
|
|
this.setState({popoverOpen: false});
|
|
}
|
|
handleClickAllAround () {
|
|
this.props.onChangeRotationStyle(RotationStyles.ALL_AROUND);
|
|
}
|
|
handleClickLeftRight () {
|
|
this.props.onChangeRotationStyle(RotationStyles.LEFT_RIGHT);
|
|
}
|
|
handleClickDontRotate () {
|
|
this.props.onChangeRotationStyle(RotationStyles.DONT_ROTATE);
|
|
}
|
|
render () {
|
|
return (
|
|
<DirectionComponent
|
|
direction={this.props.direction}
|
|
disabled={this.props.disabled}
|
|
labelAbove={this.props.labelAbove}
|
|
popoverOpen={this.state.popoverOpen && !this.props.disabled}
|
|
rotationStyle={this.props.rotationStyle}
|
|
onChangeDirection={this.props.onChangeDirection}
|
|
onClickAllAround={this.handleClickAllAround}
|
|
onClickDontRotate={this.handleClickDontRotate}
|
|
onClickLeftRight={this.handleClickLeftRight}
|
|
onClosePopover={this.handleClosePopover}
|
|
onOpenPopover={this.handleOpenPopover}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
DirectionPicker.propTypes = {
|
|
direction: PropTypes.number,
|
|
disabled: PropTypes.bool,
|
|
labelAbove: PropTypes.bool,
|
|
onChangeDirection: PropTypes.func,
|
|
onChangeRotationStyle: PropTypes.func,
|
|
rotationStyle: PropTypes.string
|
|
};
|
|
|
|
export default DirectionPicker;
|