-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Description
When I use CANVAS to render a Polygon, there is a case where the opacity is not well set. Its fine using SVG.
1- Fill opacity < 1
2. Stroke Opacity = 1
In this case, both fill and stroke opacity are set to the fill's one.
Current implementation:
Path.Canvas.js From Line 105
if (options.fill) {
if (options.fillOpacity < 1) {
ctx.globalAlpha = options.fillOpacity;
}
ctx.fill();
}
if (options.stroke) {
if (options.opacity < 1) {
ctx.globalAlpha = options.opacity;
}
ctx.stroke();
}
A simple fix is to add a else if for stroke:
if (options.stroke) {
if (options.opacity < 1) {
ctx.globalAlpha = options.opacity;
}else if (options.fill && options.fillOpacity !== 1) {
ctx.globalAlpha = 1;
}
ctx.stroke();
}
What do you think ? I'm a bit lazy to do a PR ;)
Metadata
Metadata
Assignees
Labels
No labels