mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-23 05:52:42 -05:00
Merge pull request #229 from paulkaplan/fix-stroke-color-eyedropping
Add missing code for updating stroke color from eyedropper
This commit is contained in:
commit
01242aa1c1
1 changed files with 11 additions and 1 deletions
|
@ -13,7 +13,8 @@ class StrokeColorIndicator extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
super(props);
|
super(props);
|
||||||
bindAll(this, [
|
bindAll(this, [
|
||||||
'handleChangeStrokeColor'
|
'handleChangeStrokeColor',
|
||||||
|
'handleCloseStrokeColor'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Flag to track whether an svg-update-worthy change has been made
|
// Flag to track whether an svg-update-worthy change has been made
|
||||||
|
@ -33,11 +34,17 @@ class StrokeColorIndicator extends React.Component {
|
||||||
this._hasChanged = this._hasChanged || isDifferent;
|
this._hasChanged = this._hasChanged || isDifferent;
|
||||||
this.props.onChangeStrokeColor(newColor);
|
this.props.onChangeStrokeColor(newColor);
|
||||||
}
|
}
|
||||||
|
handleCloseStrokeColor () {
|
||||||
|
if (!this.props.isEyeDropping) {
|
||||||
|
this.props.onCloseStrokeColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<StrokeColorIndicatorComponent
|
<StrokeColorIndicatorComponent
|
||||||
{...this.props}
|
{...this.props}
|
||||||
onChangeStrokeColor={this.handleChangeStrokeColor}
|
onChangeStrokeColor={this.handleChangeStrokeColor}
|
||||||
|
onCloseStrokeColor={this.handleCloseStrokeColor}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -45,6 +52,7 @@ class StrokeColorIndicator extends React.Component {
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
disabled: state.scratchPaint.mode === Modes.BRUSH,
|
disabled: state.scratchPaint.mode === Modes.BRUSH,
|
||||||
|
isEyeDropping: state.scratchPaint.color.eyeDropper.active,
|
||||||
strokeColor: state.scratchPaint.color.strokeColor,
|
strokeColor: state.scratchPaint.color.strokeColor,
|
||||||
strokeColorModalVisible: state.scratchPaint.modals.strokeColor
|
strokeColorModalVisible: state.scratchPaint.modals.strokeColor
|
||||||
});
|
});
|
||||||
|
@ -63,7 +71,9 @@ const mapDispatchToProps = dispatch => ({
|
||||||
|
|
||||||
StrokeColorIndicator.propTypes = {
|
StrokeColorIndicator.propTypes = {
|
||||||
disabled: PropTypes.bool.isRequired,
|
disabled: PropTypes.bool.isRequired,
|
||||||
|
isEyeDropping: PropTypes.bool.isRequired,
|
||||||
onChangeStrokeColor: PropTypes.func.isRequired,
|
onChangeStrokeColor: PropTypes.func.isRequired,
|
||||||
|
onCloseStrokeColor: PropTypes.func.isRequired,
|
||||||
onUpdateSvg: PropTypes.func.isRequired,
|
onUpdateSvg: PropTypes.func.isRequired,
|
||||||
strokeColor: PropTypes.string,
|
strokeColor: PropTypes.string,
|
||||||
strokeColorModalVisible: PropTypes.bool.isRequired
|
strokeColorModalVisible: PropTypes.bool.isRequired
|
||||||
|
|
Loading…
Reference in a new issue