diff options
Diffstat (limited to 'src/mbgl/style')
-rw-r--r-- | src/mbgl/style/layers/layer_properties.hpp.ejs | 8 | ||||
-rw-r--r-- | src/mbgl/style/paint_property.hpp | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/mbgl/style/layers/layer_properties.hpp.ejs b/src/mbgl/style/layers/layer_properties.hpp.ejs index a485621ac6..6ec92703f1 100644 --- a/src/mbgl/style/layers/layer_properties.hpp.ejs +++ b/src/mbgl/style/layers/layer_properties.hpp.ejs @@ -37,7 +37,13 @@ public: <% if (/-pattern$/.test(property.name) || property.name === 'line-dasharray') { -%> PaintProperty<<%- propertyType(property) %>, CrossFadedPropertyEvaluator> <%- camelizeWithLeadingLowercase(property.name) %> { <%- defaultValue(property) %> }; <% } else if (property.name === 'fill-outline-color') { -%> - PaintProperty<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %> { { 0, 0, 0, -1 } }; + PaintProperty<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %> { {} }; +<% } else if (property.name.endsWith('color') && defaultValue(property) === '{ 0, 0, 0, 0 }') { -%> + PaintProperty<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %> { {} }; +<% } else if (property.name.endsWith('color') && defaultValue(property) === '{ 0, 0, 0, 1 }') { -%> + PaintProperty<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %> { Color::black() }; +<% } else if (property.name.endsWith('color') && defaultValue(property) === '{ 1, 1, 1, 1 }') { -%> + PaintProperty<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %> { Color::white() }; <% } else { -%> PaintProperty<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %> { <%- defaultValue(property) %> }; <% } -%> diff --git a/src/mbgl/style/paint_property.hpp b/src/mbgl/style/paint_property.hpp index 332ec051dc..6da1ed53b4 100644 --- a/src/mbgl/style/paint_property.hpp +++ b/src/mbgl/style/paint_property.hpp @@ -44,7 +44,9 @@ public: } const PropertyValue<T>& get() const { - return isUndefined() ? values.at(ClassID::Fallback) : values.at(ClassID::Default); + static const PropertyValue<T> staticValue; + const auto it = values.find(ClassID::Default); + return it == values.end() ? staticValue : it->second; } void set(const PropertyValue<T>& value_, const optional<std::string>& klass) { |