From 466febd615a9d58994ec851aa57c794947e09f11 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Thu, 2 Apr 2015 16:48:43 -0700 Subject: [PATCH] don't create infinitely many boxes for zero or negative height symbols line-height or padding can make the height of a shaped object <= 0. In these cases either create no boxes, or create boxes with a minimum height to avoid creating too many of them. -js: 9e78c02d8b22b60a08fdb28fd29eef1642f62d94 --- src/mbgl/text/collision_feature.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mbgl/text/collision_feature.cpp b/src/mbgl/text/collision_feature.cpp index f44e48c35..181875139 100644 --- a/src/mbgl/text/collision_feature.cpp +++ b/src/mbgl/text/collision_feature.cpp @@ -15,9 +15,13 @@ CollisionFeature::CollisionFeature(const std::vector &line, const An const float x2 = right * boxScale + padding; if (alongLine) { - const float height = y2 - y1; + float height = y2 - y1; const float length = x2 - x1; + if (height <= 0.0f) return; + + height = std::max(10.0f * boxScale, height); + bboxifyLabel(line, anchor, length, height); } else { boxes.emplace_back(anchor, x1, y1, x2, y2, std::numeric_limits::infinity());