Skip to content

Commit

Permalink
Ensure fills with transparent colors and patterns are rendered as exp…
Browse files Browse the repository at this point in the history
…ected (#3120)

* Ensure fills with transparent colors and patterns are rendered as expected

* Remove all opacity checking from StyleLayer#isHidden
  • Loading branch information
lucaswoj authored Sep 2, 2016
1 parent 8ff54c4 commit 900abd5
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 31 deletions.
2 changes: 0 additions & 2 deletions js/style/style_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,6 @@ StyleLayer.prototype = util.inherit(Evented, {
if (this.minzoom && zoom < this.minzoom) return true;
if (this.maxzoom && zoom >= this.maxzoom) return true;
if (this.layout['visibility'] === 'none') return true;
if (this.isPaintValueFeatureConstant(this.type + '-opacity') && this.paint[this.type + '-opacity'] === 0) return true;
if (this.isPaintValueFeatureConstant(this.type + '-color') && this.paint[this.type + '-color'] && this.paint[this.type + '-color'][3] === 0) return true;

return false;
},
Expand Down
18 changes: 0 additions & 18 deletions js/style/style_layer/fill_style_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,6 @@ FillStyleLayer.prototype = util.inherit(StyleLayer, {
} else {
return StyleLayer.prototype.isPaintValueZoomConstant.call(this, name);
}
},

isHidden: function(zoom) {
if (this.minzoom && zoom < this.minzoom) return true;
if (this.maxzoom && zoom >= this.maxzoom) return true;
if (this.layout['visibility'] === 'none') return true;

var isFillHidden = (
(this.isPaintValueFeatureConstant('fill-opacity') && this.paint['fill-opacity'] === 0) ||
(this.isPaintValueFeatureConstant('fill-color') && this.paint['fill-color'][3] === 0)
);

var isOutlineHidden = (
this.isPaintValueFeatureConstant('fill-outline-color') &&
this.paint['fill-outline-color'][3] === 0
);

return isFillHidden && isOutlineHidden;
}

});
Expand Down
10 changes: 0 additions & 10 deletions js/style/style_layer/symbol_style_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ module.exports = SymbolStyleLayer;

SymbolStyleLayer.prototype = util.inherit(StyleLayer, {

isHidden: function() {
if (StyleLayer.prototype.isHidden.apply(this, arguments)) return true;

var isTextHidden = this.paint['text-opacity'] === 0 || !this.layout['text-field'];
var isIconHidden = this.paint['icon-opacity'] === 0 || !this.layout['icon-image'];
if (isTextHidden && isIconHidden) return true;

return false;
},

getLayoutValue: function(name, globalProperties, featureProperties) {
if (name === 'text-rotation-alignment' &&
this.getLayoutValue('symbol-placement', globalProperties, featureProperties) === 'line' &&
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"jsdom": "^9.4.2",
"json-loader": "^0.5.4",
"lodash": "^4.13.1",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#35efbce663a0f13d37d34afac799e33178ee610a",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#333cf135f5358f48abd608a62787045a5f6fac0c",
"memory-fs": "^0.3.0",
"minifyify": "^7.0.1",
"npm-run-all": "^3.0.0",
Expand Down

0 comments on commit 900abd5

Please sign in to comment.