Expose filtered field

This commit is contained in:
IagoLast 2017-08-18 12:58:01 +02:00
parent a3538d9007
commit 72f93abf16
2 changed files with 7 additions and 1 deletions

View File

@ -229,6 +229,8 @@ CartoCSS.prototype = {
// serach the max index to know rendering order // serach the max index to know rendering order
lyr.index = _.max(props[v].map(function(a) { return a.index; }).concat(lyr.index)); lyr.index = _.max(props[v].map(function(a) { return a.index; }).concat(lyr.index));
lyr.constant = !_.any(props[v].map(function(a) { return !a.constant; })); lyr.constant = !_.any(props[v].map(function(a) { return !a.constant; }));
// True when the property is filtered.
lyr.filtered = props[v][0].filtered;
} }
} }

View File

@ -236,7 +236,11 @@ tree.Definition.prototype.toJS = function(env) {
} }
r.constant = rule.value.ev(env).is !== 'field'; r.constant = rule.value.ev(env).is !== 'field';
r.filtered = !!_if; var DEFAULT_FILTER = "(8388607 & (1 << ctx.zoom))";
r.filtered = false;
if (_if && _if !== DEFAULT_FILTER){
r.filtered = true;
}
shaderAttrs[rule.name].push(r); shaderAttrs[rule.name].push(r);
} else { } else {