From bdd70165c893421bafc09513ab6ea1b741f6b97b Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Tue, 19 Dec 2017 10:47:12 -0500 Subject: [PATCH] Add missing code for updating stroke color from eyedropper --- src/containers/stroke-color-indicator.jsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/containers/stroke-color-indicator.jsx b/src/containers/stroke-color-indicator.jsx index 23043f87..ba675086 100644 --- a/src/containers/stroke-color-indicator.jsx +++ b/src/containers/stroke-color-indicator.jsx @@ -13,7 +13,8 @@ class StrokeColorIndicator extends React.Component { constructor (props) { super(props); bindAll(this, [ - 'handleChangeStrokeColor' + 'handleChangeStrokeColor', + 'handleCloseStrokeColor' ]); // 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.props.onChangeStrokeColor(newColor); } + handleCloseStrokeColor () { + if (!this.props.isEyeDropping) { + this.props.onCloseStrokeColor(); + } + } render () { return ( ); } @@ -45,6 +52,7 @@ class StrokeColorIndicator extends React.Component { const mapStateToProps = state => ({ disabled: state.scratchPaint.mode === Modes.BRUSH, + isEyeDropping: state.scratchPaint.color.eyeDropper.active, strokeColor: state.scratchPaint.color.strokeColor, strokeColorModalVisible: state.scratchPaint.modals.strokeColor }); @@ -63,7 +71,9 @@ const mapDispatchToProps = dispatch => ({ StrokeColorIndicator.propTypes = { disabled: PropTypes.bool.isRequired, + isEyeDropping: PropTypes.bool.isRequired, onChangeStrokeColor: PropTypes.func.isRequired, + onCloseStrokeColor: PropTypes.func.isRequired, onUpdateSvg: PropTypes.func.isRequired, strokeColor: PropTypes.string, strokeColorModalVisible: PropTypes.bool.isRequired