scratch-paint/src/containers/stroke-color-indicator.jsx

23 lines
821 B
React
Raw Normal View History

2017-09-07 17:59:14 -04:00
import {connect} from 'react-redux';
import {changeStrokeColor} from '../reducers/stroke-color';
import StrokeColorIndicatorComponent from '../components/stroke-color-indicator.jsx';
import {applyStrokeColorToSelection} from '../helper/style-path';
2017-10-05 15:41:22 -04:00
import {performSnapshot} from '../helper/undo';
import {undoSnapshot} from '../reducers/undo';
2017-09-07 17:59:14 -04:00
const mapStateToProps = state => ({
strokeColor: state.scratchPaint.color.strokeColor
});
const mapDispatchToProps = dispatch => ({
onChangeStrokeColor: strokeColor => {
2017-10-05 15:41:22 -04:00
applyStrokeColorToSelection(strokeColor, undoSnapshot);
performSnapshot(snapshot => dispatch(undoSnapshot(snapshot)));
2017-09-07 17:59:14 -04:00
dispatch(changeStrokeColor(strokeColor));
}
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(StrokeColorIndicatorComponent);