mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2025-05-16 16:11:08 -04:00
Vector gradient (#558)
This commit is contained in:
parent
9be50ffaf6
commit
4ba79cacbb
39 changed files with 1092 additions and 99 deletions
src/containers
|
@ -9,6 +9,7 @@ import {changeFillColor, DEFAULT_COLOR} from '../reducers/fill-color';
|
|||
import {changeMode} from '../reducers/modes';
|
||||
import {clearSelectedItems} from '../reducers/selected-items';
|
||||
import {clearSelection} from '../helper/selection';
|
||||
import {clearGradient} from '../reducers/selection-gradient-type';
|
||||
|
||||
import BitLineModeComponent from '../components/bit-line-mode/bit-line-mode.jsx';
|
||||
import BitLineTool from '../helper/bit-tools/line-tool';
|
||||
|
@ -33,7 +34,7 @@ class BitLineMode extends React.Component {
|
|||
if (this.tool && nextProps.bitBrushSize !== this.props.bitBrushSize) {
|
||||
this.tool.setLineSize(nextProps.bitBrushSize);
|
||||
}
|
||||
|
||||
|
||||
if (nextProps.isBitLineModeActive && !this.props.isBitLineModeActive) {
|
||||
this.activateTool();
|
||||
} else if (!nextProps.isBitLineModeActive && this.props.isBitLineModeActive) {
|
||||
|
@ -45,6 +46,7 @@ class BitLineMode extends React.Component {
|
|||
}
|
||||
activateTool () {
|
||||
clearSelection(this.props.clearSelectedItems);
|
||||
this.props.clearGradient();
|
||||
// Force the default line color if fill is MIXED or transparent
|
||||
let color = this.props.color;
|
||||
if (!color || color === MIXED) {
|
||||
|
@ -76,6 +78,7 @@ class BitLineMode extends React.Component {
|
|||
|
||||
BitLineMode.propTypes = {
|
||||
bitBrushSize: PropTypes.number.isRequired,
|
||||
clearGradient: PropTypes.func.isRequired,
|
||||
clearSelectedItems: PropTypes.func.isRequired,
|
||||
color: PropTypes.string,
|
||||
handleMouseDown: PropTypes.func.isRequired,
|
||||
|
@ -93,6 +96,9 @@ const mapDispatchToProps = dispatch => ({
|
|||
clearSelectedItems: () => {
|
||||
dispatch(clearSelectedItems());
|
||||
},
|
||||
clearGradient: () => {
|
||||
dispatch(clearGradient());
|
||||
},
|
||||
handleMouseDown: () => {
|
||||
dispatch(changeMode(Modes.BIT_LINE));
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue