mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2025-01-08 13:42:00 -05:00
Change transparent fills to black and white when a gradient is added
This commit is contained in:
parent
b45faec330
commit
c62093febe
1 changed files with 8 additions and 5 deletions
|
@ -298,17 +298,20 @@ const applyGradientTypeToSelection = function (gradientType, applyToStroke, text
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!hasGradient && applyToStroke) {
|
||||
const noStrokeOriginally = item.strokeWidth === 0 || !itemColor ||
|
||||
if (!hasGradient) {
|
||||
const noColorOriginally = !itemColor ||
|
||||
(itemColor.gradient &&
|
||||
itemColor.gradient.stops &&
|
||||
itemColor.gradient.stops.length === 2 &&
|
||||
itemColor.gradient.stops[0].color.alpha === 0 &&
|
||||
itemColor.gradient.stops[1].color.alpha === 0);
|
||||
const addingStroke = applyToStroke && item.strokeWidth === 0;
|
||||
const hasGradientNow = itemColor1 || itemColor2;
|
||||
if (noStrokeOriginally && hasGradientNow) {
|
||||
// Make outline visible
|
||||
item.strokeWidth = 1;
|
||||
if ((noColorOriginally || addingStroke) && hasGradientNow) {
|
||||
if (applyToStroke) {
|
||||
// Make outline visible
|
||||
item.strokeWidth = 1;
|
||||
}
|
||||
// Make the gradient black to white
|
||||
itemColor1 = 'black';
|
||||
itemColor2 = 'white';
|
||||
|
|
Loading…
Reference in a new issue