diff --git a/src/containers/blob/blob.js b/src/containers/blob/blob.js index 6a9b871e..22606723 100644 --- a/src/containers/blob/blob.js +++ b/src/containers/blob/blob.js @@ -27,11 +27,13 @@ class Blobbiness { /** * @param {function} updateCallback call when the drawing has changed to let listeners know + * @param {function} clearSelectedItems Callback to clear the set of selected items in the Redux state */ - constructor (updateCallback) { + constructor (updateCallback, clearSelectedItems) { this.broadBrushHelper = new BroadBrushHelper(); this.segmentBrushHelper = new SegmentBrushHelper(); this.updateCallback = updateCallback; + this.clearSelectedItems = clearSelectedItems; // The following are stored to check whether these have changed and the cursor preview needs to be redrawn. this.strokeColor = null; diff --git a/src/containers/brush-mode.jsx b/src/containers/brush-mode.jsx index 799ada60..b7027c14 100644 --- a/src/containers/brush-mode.jsx +++ b/src/containers/brush-mode.jsx @@ -18,7 +18,7 @@ class BrushMode extends React.Component { 'deactivateTool', 'onScroll' ]); - this.blob = new Blobbiness(this.props.onUpdateSvg); + this.blob = new Blobbiness(this.props.onUpdateSvg, this.props.clearSelectedItems); } componentDidMount () { if (this.props.isBrushModeActive) { diff --git a/src/containers/eraser-mode.jsx b/src/containers/eraser-mode.jsx index 62d5b4fe..423058c2 100644 --- a/src/containers/eraser-mode.jsx +++ b/src/containers/eraser-mode.jsx @@ -5,6 +5,7 @@ import bindAll from 'lodash.bindall'; import Modes from '../modes/modes'; import Blobbiness from './blob/blob'; import {changeBrushSize} from '../reducers/eraser-mode'; +import {clearSelectedItems} from '../reducers/selected-items'; import EraserModeComponent from '../components/eraser-mode.jsx'; import {changeMode} from '../reducers/modes'; @@ -16,7 +17,7 @@ class EraserMode extends React.Component { 'deactivateTool', 'onScroll' ]); - this.blob = new Blobbiness(this.props.onUpdateSvg); + this.blob = new Blobbiness(this.props.onUpdateSvg, this.props.clearSelectedItems); } componentDidMount () { if (this.props.isEraserModeActive) { @@ -65,6 +66,7 @@ class EraserMode extends React.Component { EraserMode.propTypes = { canvas: PropTypes.instanceOf(Element).isRequired, changeBrushSize: PropTypes.func.isRequired, + clearSelectedItems: PropTypes.func.isRequired, eraserModeState: PropTypes.shape({ brushSize: PropTypes.number.isRequired }), @@ -78,6 +80,9 @@ const mapStateToProps = state => ({ isEraserModeActive: state.scratchPaint.mode === Modes.ERASER }); const mapDispatchToProps = dispatch => ({ + clearSelectedItems: () => { + dispatch(clearSelectedItems()); + }, changeBrushSize: brushSize => { dispatch(changeBrushSize(brushSize)); },