Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradient outlines more fixes #1243

Merged
merged 9 commits into from
Aug 31, 2020
14 changes: 13 additions & 1 deletion src/helper/style-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like a function which retrieves color state from shapes should not modify those shapes' colors directly

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
Expand Down