From 544d833b5399e69f18432f9d87a861f11a344655 Mon Sep 17 00:00:00 2001 From: DD Liu Date: Fri, 21 Aug 2020 11:23:54 -0400 Subject: [PATCH] Remove transparent to transparent gradients. Hide the second color of stroke width 0 gradients again. --- src/helper/style-path.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/helper/style-path.js b/src/helper/style-path.js index 469dbfce..7d6504bf 100644 --- a/src/helper/style-path.js +++ b/src/helper/style-path.js @@ -465,11 +465,23 @@ const getColorsFromSelection = function (selectedItems, bitmapMode) { let strokeColorString = primary; const strokeColor2String = secondary; - const strokeGradientType = gradientType; + let strokeGradientType = gradientType; + + if (strokeGradientType !== GradientTypes.SOLID && + item.strokeColor.gradient.stops.length === 2 && + item.strokeColor.gradient.stops[0].color.alpha === 0 && + item.strokeColor.gradient.stops[1].color.alpha === 0) { + // Clear the gradient if both colors are transparent + item.strokeColor = null; + strokeGradientType = GradientTypes.SOLID; + } // If the item's stroke width is 0, pretend the stroke color is null if (!item.strokeWidth) { strokeColorString = null; + // Hide the second color. This way if you choose a second color, remove + // the gradient, and re-add it, your second color selection is preserved. + strokeGradientType = GradientTypes.SOLID; } // Stroke color is fill color in bitmap