Clear out gradients when setting default colors

This commit is contained in:
DD Liu 2020-08-31 01:56:30 -04:00
parent 740f0e6b2b
commit cf507eac06
2 changed files with 10 additions and 10 deletions

View file

@ -83,11 +83,7 @@ class OvalMode extends React.Component {
const strokeColor1 = this.props.colorState.strokeColor.primary;
let strokeColor2 = this.props.colorState.strokeColor.secondary;
let strokeGradient = this.props.colorState.strokeColor.gradientType;
if (strokeColor1 === MIXED ||
(strokeColor1 === null &&
(strokeColor2 === null || strokeColor2 === MIXED))) {
this.props.onChangeStrokeColor(DEFAULT_COLOR);
}
if (fillColor2 === MIXED) {
this.props.clearFillGradient();
fillColor2 = null;
@ -110,11 +106,15 @@ class OvalMode extends React.Component {
if (fillColorMissing && strokeColorMissing) {
this.props.onChangeFillColor(DEFAULT_COLOR);
this.props.clearFillGradient();
this.props.onChangeStrokeColor(null);
this.props.clearStrokeGradient();
} else if (fillColorMissing && !strokeColorMissing) {
this.props.onChangeFillColor(null);
this.props.clearFillGradient();
} else if (!fillColorMissing && strokeColorMissing) {
this.props.onChangeStrokeColor(null);
this.props.clearStrokeGradient();
}
}
render () {

View file

@ -78,11 +78,7 @@ class RectMode extends React.Component {
const strokeColor1 = this.props.colorState.strokeColor.primary;
let strokeColor2 = this.props.colorState.strokeColor.secondary;
let strokeGradient = this.props.colorState.strokeColor.gradientType;
if (strokeColor1 === MIXED ||
(strokeColor1 === null &&
(strokeColor2 === null || strokeColor2 === MIXED))) {
this.props.onChangeStrokeColor(DEFAULT_COLOR);
}
if (fillColor2 === MIXED) {
this.props.clearFillGradient();
fillColor2 = null;
@ -105,11 +101,15 @@ class RectMode extends React.Component {
if (fillColorMissing && strokeColorMissing) {
this.props.onChangeFillColor(DEFAULT_COLOR);
this.props.clearFillGradient();
this.props.onChangeStrokeColor(null);
this.props.clearStrokeGradient();
} else if (fillColorMissing && !strokeColorMissing) {
this.props.onChangeFillColor(null);
this.props.clearFillGradient();
} else if (!fillColorMissing && strokeColorMissing) {
this.props.onChangeStrokeColor(null);
this.props.clearStrokeGradient();
}
}
deactivateTool () {