mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2025-03-15 23:50:01 -04: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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasGradient && applyToStroke) {
|
if (!hasGradient) {
|
||||||
const noStrokeOriginally = item.strokeWidth === 0 || !itemColor ||
|
const noColorOriginally = !itemColor ||
|
||||||
(itemColor.gradient &&
|
(itemColor.gradient &&
|
||||||
itemColor.gradient.stops &&
|
itemColor.gradient.stops &&
|
||||||
itemColor.gradient.stops.length === 2 &&
|
itemColor.gradient.stops.length === 2 &&
|
||||||
itemColor.gradient.stops[0].color.alpha === 0 &&
|
itemColor.gradient.stops[0].color.alpha === 0 &&
|
||||||
itemColor.gradient.stops[1].color.alpha === 0);
|
itemColor.gradient.stops[1].color.alpha === 0);
|
||||||
|
const addingStroke = applyToStroke && item.strokeWidth === 0;
|
||||||
const hasGradientNow = itemColor1 || itemColor2;
|
const hasGradientNow = itemColor1 || itemColor2;
|
||||||
if (noStrokeOriginally && hasGradientNow) {
|
if ((noColorOriginally || addingStroke) && hasGradientNow) {
|
||||||
// Make outline visible
|
if (applyToStroke) {
|
||||||
item.strokeWidth = 1;
|
// Make outline visible
|
||||||
|
item.strokeWidth = 1;
|
||||||
|
}
|
||||||
// Make the gradient black to white
|
// Make the gradient black to white
|
||||||
itemColor1 = 'black';
|
itemColor1 = 'black';
|
||||||
itemColor2 = 'white';
|
itemColor2 = 'white';
|
||||||
|
|
Loading…
Reference in a new issue