mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-22 21:42:30 -05:00
clear more of the state when you switch costumes. you shouldnt retain the same selected items
This commit is contained in:
parent
7e1e8d96ac
commit
cc920e8969
1 changed files with 12 additions and 1 deletions
|
@ -10,9 +10,10 @@ import {undoSnapshot, clearUndoState} from '../reducers/undo';
|
|||
import {isGroup, ungroupItems} from '../helper/group';
|
||||
import {setupLayers} from '../helper/layer';
|
||||
import {deleteSelection, getSelectedLeafItems} from '../helper/selection';
|
||||
import {clearSelectedItems, setSelectedItems} from '../reducers/selected-items';
|
||||
import {pan, resetZoom, zoomOnFixedPoint} from '../helper/view';
|
||||
import {clearHoveredItem} from '../reducers/hover';
|
||||
|
||||
import {setSelectedItems} from '../reducers/selected-items';
|
||||
|
||||
import styles from './paper-canvas.css';
|
||||
|
||||
|
@ -47,6 +48,8 @@ class PaperCanvas extends React.Component {
|
|||
}
|
||||
}
|
||||
this.props.clearUndo();
|
||||
this.props.clearSelectedItems();
|
||||
this.props.clearHoveredItem();
|
||||
if (newProps.svg) {
|
||||
// Store the zoom/pan and restore it after importing a new SVG
|
||||
const oldZoom = paper.project.view.zoom;
|
||||
|
@ -156,6 +159,8 @@ class PaperCanvas extends React.Component {
|
|||
|
||||
PaperCanvas.propTypes = {
|
||||
canvasRef: PropTypes.func,
|
||||
clearHoveredItem: PropTypes.func.isRequired,
|
||||
clearSelectedItems: PropTypes.func.isRequired,
|
||||
clearUndo: PropTypes.func.isRequired,
|
||||
mode: PropTypes.oneOf(Object.values(Modes)),
|
||||
onUpdateSvg: PropTypes.func.isRequired,
|
||||
|
@ -178,6 +183,12 @@ const mapDispatchToProps = dispatch => ({
|
|||
},
|
||||
setSelectedItems: () => {
|
||||
dispatch(setSelectedItems(getSelectedLeafItems()));
|
||||
},
|
||||
clearSelectedItems: () => {
|
||||
dispatch(clearSelectedItems());
|
||||
},
|
||||
clearHoveredItem: () => {
|
||||
dispatch(clearHoveredItem());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue