mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2025-01-09 14:12:13 -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} 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.broadBrushHelper = new BroadBrushHelper();
|
||||||
this.segmentBrushHelper = new SegmentBrushHelper();
|
this.segmentBrushHelper = new SegmentBrushHelper();
|
||||||
this.updateCallback = updateCallback;
|
this.updateCallback = updateCallback;
|
||||||
|
this.clearSelectedItems = clearSelectedItems;
|
||||||
|
|
||||||
// The following are stored to check whether these have changed and the cursor preview needs to be redrawn.
|
// The following are stored to check whether these have changed and the cursor preview needs to be redrawn.
|
||||||
this.strokeColor = null;
|
this.strokeColor = null;
|
||||||
|
|
|
@ -18,7 +18,7 @@ class BrushMode extends React.Component {
|
||||||
'deactivateTool',
|
'deactivateTool',
|
||||||
'onScroll'
|
'onScroll'
|
||||||
]);
|
]);
|
||||||
this.blob = new Blobbiness(this.props.onUpdateSvg);
|
this.blob = new Blobbiness(this.props.onUpdateSvg, this.props.clearSelectedItems);
|
||||||
}
|
}
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
if (this.props.isBrushModeActive) {
|
if (this.props.isBrushModeActive) {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import bindAll from 'lodash.bindall';
|
||||||
import Modes from '../modes/modes';
|
import Modes from '../modes/modes';
|
||||||
import Blobbiness from './blob/blob';
|
import Blobbiness from './blob/blob';
|
||||||
import {changeBrushSize} from '../reducers/eraser-mode';
|
import {changeBrushSize} from '../reducers/eraser-mode';
|
||||||
|
import {clearSelectedItems} from '../reducers/selected-items';
|
||||||
import EraserModeComponent from '../components/eraser-mode.jsx';
|
import EraserModeComponent from '../components/eraser-mode.jsx';
|
||||||
import {changeMode} from '../reducers/modes';
|
import {changeMode} from '../reducers/modes';
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ class EraserMode extends React.Component {
|
||||||
'deactivateTool',
|
'deactivateTool',
|
||||||
'onScroll'
|
'onScroll'
|
||||||
]);
|
]);
|
||||||
this.blob = new Blobbiness(this.props.onUpdateSvg);
|
this.blob = new Blobbiness(this.props.onUpdateSvg, this.props.clearSelectedItems);
|
||||||
}
|
}
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
if (this.props.isEraserModeActive) {
|
if (this.props.isEraserModeActive) {
|
||||||
|
@ -65,6 +66,7 @@ class EraserMode extends React.Component {
|
||||||
EraserMode.propTypes = {
|
EraserMode.propTypes = {
|
||||||
canvas: PropTypes.instanceOf(Element).isRequired,
|
canvas: PropTypes.instanceOf(Element).isRequired,
|
||||||
changeBrushSize: PropTypes.func.isRequired,
|
changeBrushSize: PropTypes.func.isRequired,
|
||||||
|
clearSelectedItems: PropTypes.func.isRequired,
|
||||||
eraserModeState: PropTypes.shape({
|
eraserModeState: PropTypes.shape({
|
||||||
brushSize: PropTypes.number.isRequired
|
brushSize: PropTypes.number.isRequired
|
||||||
}),
|
}),
|
||||||
|
@ -78,6 +80,9 @@ const mapStateToProps = state => ({
|
||||||
isEraserModeActive: state.scratchPaint.mode === Modes.ERASER
|
isEraserModeActive: state.scratchPaint.mode === Modes.ERASER
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
|
clearSelectedItems: () => {
|
||||||
|
dispatch(clearSelectedItems());
|
||||||
|
},
|
||||||
changeBrushSize: brushSize => {
|
changeBrushSize: brushSize => {
|
||||||
dispatch(changeBrushSize(brushSize));
|
dispatch(changeBrushSize(brushSize));
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue