mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-22 21:42:30 -05:00
Force a stroke width on pen and line mode
This commit is contained in:
parent
b8aadc3c54
commit
ab3b4e4555
2 changed files with 17 additions and 1 deletions
|
@ -9,6 +9,7 @@ import {endPointHit, touching} from '../helper/snapping';
|
|||
import {drawHitPoint, removeHitPoint} from '../helper/guides';
|
||||
import {stylePath} from '../helper/style-path';
|
||||
import {changeStrokeColor} from '../reducers/stroke-color';
|
||||
import {changeStrokeWidth} from '../reducers/stroke-width';
|
||||
import {changeMode} from '../reducers/modes';
|
||||
import {clearSelectedItems} from '../reducers/selected-items';
|
||||
import {MIXED} from '../helper/style-path';
|
||||
|
@ -57,7 +58,11 @@ class LineMode extends React.Component {
|
|||
if (strokeColor === MIXED || strokeColor === null) {
|
||||
this.props.onChangeStrokeColor(LineMode.DEFAULT_COLOR);
|
||||
}
|
||||
|
||||
// Force a minimum stroke width
|
||||
console.log(this.props.colorState.strokeWidth)
|
||||
if (!this.props.colorState.strokeWidth) {
|
||||
this.props.onChangeStrokeWidth(1);
|
||||
}
|
||||
this.tool = new paper.Tool();
|
||||
|
||||
this.path = null;
|
||||
|
@ -248,6 +253,9 @@ const mapDispatchToProps = dispatch => ({
|
|||
},
|
||||
onChangeStrokeColor: strokeColor => {
|
||||
dispatch(changeStrokeColor(strokeColor));
|
||||
},
|
||||
onChangeStrokeWidth: strokeWidth => {
|
||||
dispatch(changeStrokeWidth(strokeWidth));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import bindAll from 'lodash.bindall';
|
|||
import Modes from '../modes/modes';
|
||||
|
||||
import {changeStrokeColor} from '../reducers/stroke-color';
|
||||
import {changeStrokeWidth} from '../reducers/stroke-width';
|
||||
import {changeMode} from '../reducers/modes';
|
||||
import {clearSelectedItems} from '../reducers/selected-items';
|
||||
import {MIXED} from '../helper/style-path';
|
||||
|
@ -52,6 +53,10 @@ class PenMode extends React.Component {
|
|||
if (strokeColor === MIXED || strokeColor === null) {
|
||||
this.props.onChangeStrokeColor(PenMode.DEFAULT_COLOR)
|
||||
}
|
||||
// Force a minimum stroke width
|
||||
if (!this.props.colorState.strokeWidth) {
|
||||
this.props.onChangeStrokeWidth(1);
|
||||
}
|
||||
this.tool = new PenTool(
|
||||
this.props.clearSelectedItems,
|
||||
this.props.onUpdateSvg
|
||||
|
@ -102,6 +107,9 @@ const mapDispatchToProps = dispatch => ({
|
|||
},
|
||||
onChangeStrokeColor: strokeColor => {
|
||||
dispatch(changeStrokeColor(strokeColor));
|
||||
},
|
||||
onChangeStrokeWidth: strokeWidth => {
|
||||
dispatch(changeStrokeWidth(strokeWidth));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue