From 34a5bf665e519130140f7a23ef175df3ee831039 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 6 Apr 2015 12:35:16 -0700 Subject: [PATCH] fix bboxify where first box should be placed after anchor -js: e99ed95aaba5e79c322733b32e03518b12203a79 --- src/mbgl/text/collision_feature.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mbgl/text/collision_feature.cpp b/src/mbgl/text/collision_feature.cpp index 181875139..2a61e0b10 100644 --- a/src/mbgl/text/collision_feature.cpp +++ b/src/mbgl/text/collision_feature.cpp @@ -45,7 +45,7 @@ void CollisionFeature::bboxifyLabel(const std::vector &line, float anchorDistance = firstBoxOffset; // move backwards along the line to the first segment the label appears on - while (anchorDistance > -labelLength / 2) { + do { index--; // there isn't enough room for the label after the beginning of the line @@ -54,7 +54,7 @@ void CollisionFeature::bboxifyLabel(const std::vector &line, anchorDistance -= util::dist(line[index], p); p = line[index]; - } + } while (anchorDistance > -labelLength / 2); float segmentLength = util::dist(line[index], line[index + 1]);