Fixes mask brush preview color

This commit is contained in:
psychedelicious 2022-11-24 14:31:39 +11:00 committed by blessedcoolant
parent c8c1b3e217
commit 473869b8ed

View File

@ -28,24 +28,11 @@ const canvasBrushPreviewSelector = createSelector(
stageScale, stageScale,
} = canvas; } = canvas;
let fill = '';
if (layer === 'mask') {
fill = rgbaColorToString({ ...maskColor, a: 0.5 });
} else if (tool === 'colorPicker') {
fill = rgbaColorToString(colorPickerColor);
} else {
fill = rgbaColorToString(brushColor);
}
return { return {
cursorPosition, cursorPosition,
width, width,
height, height,
radius: brushSize / 2, radius: brushSize / 2,
colorPickerSize: COLOR_PICKER_SIZE / stageScale,
colorPickerOffset: COLOR_PICKER_SIZE / 2 / stageScale,
colorPickerCornerRadius: COLOR_PICKER_SIZE / 5 / stageScale,
colorPickerOuterRadius: COLOR_PICKER_SIZE / stageScale, colorPickerOuterRadius: COLOR_PICKER_SIZE / stageScale,
colorPickerInnerRadius: colorPickerInnerRadius:
(COLOR_PICKER_SIZE - COLOR_PICKER_STROKE_RADIUS + 1) / stageScale, (COLOR_PICKER_SIZE - COLOR_PICKER_STROKE_RADIUS + 1) / stageScale,
@ -53,6 +40,7 @@ const canvasBrushPreviewSelector = createSelector(
brushColorString: rgbaColorToString(brushColor), brushColorString: rgbaColorToString(brushColor),
colorPickerColorString: rgbaColorToString(colorPickerColor), colorPickerColorString: rgbaColorToString(colorPickerColor),
tool, tool,
layer,
shouldShowBrush, shouldShowBrush,
shouldDrawBrushPreview: shouldDrawBrushPreview:
!( !(
@ -83,12 +71,10 @@ const IAICanvasToolPreview = (props: GroupConfig) => {
radius, radius,
maskColorString, maskColorString,
tool, tool,
layer,
shouldDrawBrushPreview, shouldDrawBrushPreview,
dotRadius, dotRadius,
strokeWidth, strokeWidth,
colorPickerSize,
colorPickerOffset,
colorPickerCornerRadius,
brushColorString, brushColorString,
colorPickerColorString, colorPickerColorString,
colorPickerInnerRadius, colorPickerInnerRadius,
@ -124,7 +110,7 @@ const IAICanvasToolPreview = (props: GroupConfig) => {
x={cursorPosition ? cursorPosition.x : width / 2} x={cursorPosition ? cursorPosition.x : width / 2}
y={cursorPosition ? cursorPosition.y : height / 2} y={cursorPosition ? cursorPosition.y : height / 2}
radius={radius} radius={radius}
fill={brushColorString} fill={layer === 'mask' ? maskColorString : brushColorString}
globalCompositeOperation={ globalCompositeOperation={
tool === 'eraser' ? 'destination-out' : 'source-over' tool === 'eraser' ? 'destination-out' : 'source-over'
} }