Add GradientToolsModes for shouldShowGradientTools

This means that gradient tools will also be enabled for the stroke color
indicator even in fill and bitmap modes, but that's okay because the
stroke color indicator will be disabled or hidden in those modes anyway.
This commit is contained in:
adroitwhiz 2020-07-06 17:27:46 -04:00
parent 6ab7b4c67d
commit 696e35582c
3 changed files with 19 additions and 18 deletions

View file

@ -7,7 +7,7 @@ import {changeGradientType} from '../reducers/fill-mode-gradient-type';
import {openFillColor, closeFillColor} from '../reducers/modals'; import {openFillColor, closeFillColor} from '../reducers/modals';
import {getSelectedLeafItems} from '../helper/selection'; import {getSelectedLeafItems} from '../helper/selection';
import {setSelectedItems} from '../reducers/selected-items'; import {setSelectedItems} from '../reducers/selected-items';
import Modes from '../lib/modes'; import Modes, {GradientToolsModes} from '../lib/modes';
import {isBitmap} from '../lib/format'; import {isBitmap} from '../lib/format';
import makeColorIndicator from './color-indicator.jsx'; import makeColorIndicator from './color-indicator.jsx';
@ -33,15 +33,7 @@ const mapStateToProps = state => ({
gradientType: state.scratchPaint.color.fillColor.gradientType, gradientType: state.scratchPaint.color.fillColor.gradientType,
isEyeDropping: state.scratchPaint.color.eyeDropper.active, isEyeDropping: state.scratchPaint.color.eyeDropper.active,
mode: state.scratchPaint.mode, mode: state.scratchPaint.mode,
shouldShowGradientTools: state.scratchPaint.mode === Modes.SELECT || shouldShowGradientTools: state.scratchPaint.mode in GradientToolsModes,
state.scratchPaint.mode === Modes.RESHAPE ||
state.scratchPaint.mode === Modes.FILL ||
state.scratchPaint.mode === Modes.RECT ||
state.scratchPaint.mode === Modes.OVAL ||
state.scratchPaint.mode === Modes.BIT_SELECT ||
state.scratchPaint.mode === Modes.BIT_RECT ||
state.scratchPaint.mode === Modes.BIT_OVAL ||
state.scratchPaint.mode === Modes.BIT_FILL,
textEditTarget: state.scratchPaint.textEditTarget textEditTarget: state.scratchPaint.textEditTarget
}); });

View file

@ -8,7 +8,7 @@ import {changeStrokeGradientType} from '../reducers/stroke-style';
import {openStrokeColor, closeStrokeColor} from '../reducers/modals'; import {openStrokeColor, closeStrokeColor} from '../reducers/modals';
import {getSelectedLeafItems} from '../helper/selection'; import {getSelectedLeafItems} from '../helper/selection';
import {setSelectedItems} from '../reducers/selected-items'; import {setSelectedItems} from '../reducers/selected-items';
import Modes from '../lib/modes'; import Modes, {GradientToolsModes} from '../lib/modes';
import {isBitmap} from '../lib/format'; import {isBitmap} from '../lib/format';
import makeColorIndicator from './color-indicator.jsx'; import makeColorIndicator from './color-indicator.jsx';
@ -36,12 +36,7 @@ const mapStateToProps = state => ({
gradientType: state.scratchPaint.color.strokeColor.gradientType, gradientType: state.scratchPaint.color.strokeColor.gradientType,
isEyeDropping: state.scratchPaint.color.eyeDropper.active, isEyeDropping: state.scratchPaint.color.eyeDropper.active,
mode: state.scratchPaint.mode, mode: state.scratchPaint.mode,
shouldShowGradientTools: state.scratchPaint.mode === Modes.SELECT || shouldShowGradientTools: state.scratchPaint.mode in GradientToolsModes,
state.scratchPaint.mode === Modes.RESHAPE ||
state.scratchPaint.mode === Modes.RECT ||
state.scratchPaint.mode === Modes.OVAL ||
state.scratchPaint.mode === Modes.BIT_RECT ||
state.scratchPaint.mode === Modes.BIT_OVAL,
textEditTarget: state.scratchPaint.textEditTarget textEditTarget: state.scratchPaint.textEditTarget
}); });

View file

@ -26,8 +26,22 @@ const VectorModes = keyMirror(vectorModesObj);
const BitmapModes = keyMirror(bitmapModesObj); const BitmapModes = keyMirror(bitmapModesObj);
const Modes = keyMirror({...vectorModesObj, ...bitmapModesObj}); const Modes = keyMirror({...vectorModesObj, ...bitmapModesObj});
const GradientToolsModes = keyMirror({
FILL: null,
SELECT: null,
RESHAPE: null,
OVAL: null,
RECT: null,
BIT_OVAL: null,
BIT_RECT: null,
BIT_SELECT: null,
BIT_FILL: null
});
export { export {
Modes as default, Modes as default,
VectorModes, VectorModes,
BitmapModes BitmapModes,
GradientToolsModes
}; };