From 7a03d734fd8a62ebac93c998a6336b619f4cc3e1 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Fri, 23 Oct 2015 11:01:56 -0700 Subject: [PATCH] [core] Respect source layer z-order for style-sourced annotations --- src/mbgl/annotation/shape_annotation_impl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp index 4f1863874..45b25f45e 100644 --- a/src/mbgl/annotation/shape_annotation_impl.cpp +++ b/src/mbgl/annotation/shape_annotation_impl.cpp @@ -27,6 +27,7 @@ void ShapeAnnotationImpl::updateStyle(Style& style) { return; std::unique_ptr layer; + std::string beforeLayerID = AnnotationManager::PointLayerID; if (shape.properties.is()) { layer = createLineLayer(); @@ -49,7 +50,9 @@ void ShapeAnnotationImpl::updateStyle(Style& style) { layer->styles.emplace(ClassID::Default, std::move(paintProperties)); } else { - const StyleLayer* sourceLayer = style.getLayer(shape.properties.get()); + beforeLayerID = shape.properties.get(); + + const StyleLayer* sourceLayer = style.getLayer(beforeLayerID); if (!sourceLayer) return; switch (sourceLayer->type) { @@ -73,7 +76,7 @@ void ShapeAnnotationImpl::updateStyle(Style& style) { layer->bucket->source = AnnotationManager::SourceID; layer->bucket->source_layer = layer->id; - style.addLayer(std::move(layer), AnnotationManager::PointLayerID); + style.addLayer(std::move(layer), beforeLayerID); } std::unique_ptr ShapeAnnotationImpl::createLineLayer() {