Only pass the feature to the attribute getter

This commit is contained in:
Tim Schaub
2022-07-21 13:43:53 -07:00
parent bd9e73a534
commit 7e424be66b
8 changed files with 13 additions and 41 deletions

View File

@@ -18,8 +18,8 @@ class WebGLLayer extends Layer {
className: this.getClassName(),
fill: {
attributes: {
[DefaultAttributes.COLOR]: function (feature, properties) {
const color = asArray(properties.COLOR || '#eee');
[DefaultAttributes.COLOR]: function (feature) {
const color = asArray(feature.get('COLOR') || '#eee');
color[3] = 0.85;
return packColor(color);
},
@@ -30,8 +30,8 @@ class WebGLLayer extends Layer {
},
stroke: {
attributes: {
[DefaultAttributes.COLOR]: function (feature, properties) {
const color = [...asArray(properties.COLOR || '#eee')];
[DefaultAttributes.COLOR]: function (feature) {
const color = [...asArray(feature.get('COLOR') || '#eee')];
color.forEach((_, i) => (color[i] = Math.round(color[i] * 0.75))); // darken slightly
return packColor(color);
},