diff options
Diffstat (limited to 'src/mbgl/style/expression')
-rw-r--r-- | src/mbgl/style/expression/compound_expression.cpp | 9 | ||||
-rw-r--r-- | src/mbgl/style/expression/parsing_context.cpp | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/mbgl/style/expression/compound_expression.cpp b/src/mbgl/style/expression/compound_expression.cpp index f8c2376cb3..2e823ff43d 100644 --- a/src/mbgl/style/expression/compound_expression.cpp +++ b/src/mbgl/style/expression/compound_expression.cpp @@ -352,6 +352,15 @@ std::unordered_map<std::string, CompoundExpressionRegistry::Definition> initiali return *(params.colorRampParameter); }); + define("line-progress", [](const EvaluationContext& params) -> Result<double> { + if (!params.colorRampParameter) { + return EvaluationError { + "The 'line-progress' expression is unavailable in the current evaluation context." + }; + } + return *(params.colorRampParameter); + }); + define("has", [](const EvaluationContext& params, const std::string& key) -> Result<bool> { if (!params.feature) { return EvaluationError { diff --git a/src/mbgl/style/expression/parsing_context.cpp b/src/mbgl/style/expression/parsing_context.cpp index ef17caed33..3fe50aa1e4 100644 --- a/src/mbgl/style/expression/parsing_context.cpp +++ b/src/mbgl/style/expression/parsing_context.cpp @@ -69,7 +69,8 @@ bool isConstant(const Expression& expression) { } return isFeatureConstant(expression) && - isGlobalPropertyConstant(expression, std::array<std::string, 2>{{"zoom", "heatmap-density"}}); + isGlobalPropertyConstant(expression, std::array<std::string, 2>{{"zoom", "heatmap-density"}}) && + isGlobalPropertyConstant(expression, std::array<std::string, 2>{{"zoom", "line-progress"}}); } using namespace mbgl::style::conversion; |