mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-22 21:42:30 -05:00
Add missing clearSelectedItems function to blob
This commit is contained in:
parent
e4f1a5ad28
commit
aa2b70f1e7
3 changed files with 10 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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));
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue