Revert "[core] Do not clear custom layers upon style switch"
This reverts commit 8ec875b87c.
This commit is contained in:
@@ -70,9 +70,7 @@ Style::Style(FileSource& fileSource_, float pixelRatio)
|
||||
|
||||
void Style::setJSON(const std::string& json, const std::string&) {
|
||||
sources.clear();
|
||||
layers.erase(std::remove_if(layers.begin(), layers.end(), [](const auto& layer) {
|
||||
return !layer->template is<CustomLayer>();
|
||||
}), layers.end());
|
||||
layers.clear();
|
||||
classes.clear();
|
||||
|
||||
StyleParser parser;
|
||||
|
||||
@@ -90,8 +90,4 @@ TEST(CustomLayer, Basic) {
|
||||
}, new TestLayer());
|
||||
|
||||
test::checkImage("test/fixtures/custom_layer/basic", test::render(map));
|
||||
|
||||
// Custom layer should be preserved when switching styles
|
||||
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), "");
|
||||
test::checkImage("test/fixtures/custom_layer/basic", test::render(map));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user