Skip to content

Commit

Permalink
Fix bug breaking transparency in fill layers with property functions
Browse files Browse the repository at this point in the history
fixes #2846
  • Loading branch information
Lucas Wojciechowski committed Aug 10, 2016
1 parent a7b4512 commit aea196e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions js/render/draw_fill.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ function draw(painter, source, layer, coords) {
var gl = painter.gl;
gl.enable(gl.STENCIL_TEST);

var color = layer.paint['fill-color'];
var image = layer.paint['fill-pattern'];
var opacity = layer.paint['fill-opacity'];
var isOutlineColorDefined = layer.getPaintProperty('fill-outline-color');
var isOpaque = (
!layer.paint['fill-pattern'] &&
layer.isPaintValueFeatureConstant('fill-color') &&
layer.isPaintValueFeatureConstant('fill-opacity') &&
layer.paint['fill-color'] === 1 &&
layer.paint['fill-opacity'] === 1
);

// Draw fill
if (image ? !painter.isOpaquePass : painter.isOpaquePass === (color[3] === 1 && opacity === 1)) {
if (painter.isOpaquePass === isOpaque) {
// Once we switch to earcut drawing we can pull most of the WebGL setup
// outside of this coords loop.
painter.setDepthSublayer(1);
Expand All @@ -27,6 +30,7 @@ function draw(painter, source, layer, coords) {
painter.lineWidth(2);
painter.depthMask(false);

var isOutlineColorDefined = layer.getPaintProperty('fill-outline-color');
if (isOutlineColorDefined || !layer.paint['fill-pattern']) {
if (isOutlineColorDefined) {
// If we defined a different color for the fill outline, we are
Expand Down

0 comments on commit aea196e

Please sign in to comment.