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
This commit is contained in:
Ansis Brammanis
2015-04-02 16:48:43 -07:00
parent 68ae21d8f4
commit 466febd615

View File

@@ -15,9 +15,13 @@ CollisionFeature::CollisionFeature(const std::vector<Coordinate> &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<float>::infinity());