Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Fix shape annotations disappearing after maxZoom-1
Browse files Browse the repository at this point in the history
Fixes #5138.
  • Loading branch information
brunoabinader committed Jun 21, 2016
1 parent 77f309e commit 0fe4651
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mbgl/annotation/shape_annotation_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void ShapeAnnotationImpl::updateTileData(const CanonicalTileID& tileID, Annotati
static const double baseTolerance = 4;

if (!shapeTiler) {
const uint64_t maxAmountOfTiles = 1 << maxZoom;
const uint64_t maxAmountOfTiles = std::pow(2, maxZoom);
const double tolerance = baseTolerance / (maxAmountOfTiles * util::EXTENT);

std::vector<geojsonvt::ProjectedFeature> features = {
Expand Down
10 changes: 10 additions & 0 deletions test/api/annotations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ TEST(Annotations, SymbolAnnotation) {
test.map.addAnnotationIcon("default_marker", namedMarker("default_marker.png"));
test.map.addAnnotation(SymbolAnnotation { Point<double>(0, 0), "default_marker" });
test.checkRendering("point_annotation");

// FIXME: https://github.com/mapbox/mapbox-gl-native/issues/5419
//test.map.setZoom(test.map.getMaxZoom());
//test.checkRendering("point_annotation");
}

TEST(Annotations, LineAnnotation) {
Expand All @@ -55,6 +59,9 @@ TEST(Annotations, LineAnnotation) {
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.addAnnotation(annotation);
test.checkRendering("line_annotation");

test.map.setZoom(test.map.getMaxZoom());
test.checkRendering("line_annotation_max_zoom");
}

TEST(Annotations, FillAnnotation) {
Expand All @@ -67,6 +74,9 @@ TEST(Annotations, FillAnnotation) {
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.addAnnotation(annotation);
test.checkRendering("fill_annotation");

test.map.setZoom(test.map.getMaxZoom());
test.checkRendering("fill_annotation_max_zoom");
}

TEST(Annotations, StyleSourcedShapeAnnotation) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0fe4651

Please sign in to comment.