diff options
author | Anand Thakker <anandthakker@users.noreply.github.com> | 2018-05-23 09:54:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-23 09:54:49 -0400 |
commit | 464fefab18822fff692cdcd97524100f81a200df (patch) | |
tree | db450e5a102cf8d54010626a07d8060206d76ba7 /include/mbgl/style | |
parent | ed1f85700c9305048307cee0e56dcad4b78e9337 (diff) | |
download | qtlocation-mapboxgl-464fefab18822fff692cdcd97524100f81a200df.tar.gz |
Accept constant expressions in non-dds properties (#11960)
Closes #11940
Diffstat (limited to 'include/mbgl/style')
-rw-r--r-- | include/mbgl/style/conversion/property_value.hpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/include/mbgl/style/conversion/property_value.hpp b/include/mbgl/style/conversion/property_value.hpp index 3130661f61..dc1c32830f 100644 --- a/include/mbgl/style/conversion/property_value.hpp +++ b/include/mbgl/style/conversion/property_value.hpp @@ -29,11 +29,19 @@ struct Converter<PropertyValue<T>> { return {}; } - if (isFeatureConstant(**expression)) { - return { CameraFunction<T>(std::move(*expression)) }; - } else { + if (!isFeatureConstant(**expression)) { error = { "property expressions not supported" }; return {}; + } else if (!isZoomConstant(**expression)) { + return { CameraFunction<T>(std::move(*expression)) }; + } else { + auto literal = dynamic_cast<Literal*>(expression->get()); + assert(literal); + optional<T> constant = fromExpressionValue<T>(literal->getValue()); + if (!constant) { + return {}; + } + return PropertyValue<T>(*constant); } } else if (isObject(value)) { optional<CameraFunction<T>> function = convert<CameraFunction<T>>(value, error); |