diff options
author | Anand Thakker <github@anandthakker.net> | 2018-05-21 14:20:48 -0400 |
---|---|---|
committer | Anand Thakker <github@anandthakker.net> | 2018-05-21 14:27:30 -0400 |
commit | 4704d0389c8e41c9ef821959ad91943c153e04bc (patch) | |
tree | 8b1a7c7e6b095572ce800698ab4044a5bdb77796 /include/mbgl/style/conversion/property_value.hpp | |
parent | ed4538bb30378de9a42647354d3d977465cdc45e (diff) | |
download | qtlocation-mapboxgl-upstream/backport-11960.tar.gz |
Accept constant expressions in non-dds propertiesupstream/backport-11960
Closes #11940
Diffstat (limited to 'include/mbgl/style/conversion/property_value.hpp')
-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); |