summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorryanhamley <ryan.hamley@mapbox.com>2018-10-17 16:24:21 -0700
committerryanhamley <ryan.hamley@mapbox.com>2018-10-17 16:24:21 -0700
commita4a07f3f2f41f5063ce7e651d801a89b5350edbe (patch)
treeb1da62bddde5f5b503e04f828bb731cc9ff590fd
parentf0cabe327b3c4fa2a49eef6038f6a878ef1f7a30 (diff)
downloadqtlocation-mapboxgl-a4a07f3f2f41f5063ce7e651d801a89b5350edbe.tar.gz
Add comments
-rw-r--r--src/mbgl/text/collision_feature.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mbgl/text/collision_feature.cpp b/src/mbgl/text/collision_feature.cpp
index a101b14a09..c708f834da 100644
--- a/src/mbgl/text/collision_feature.cpp
+++ b/src/mbgl/text/collision_feature.cpp
@@ -37,6 +37,8 @@ CollisionFeature::CollisionFeature(const GeometryCoordinates& line,
bboxifyLabel(line, anchorPoint, anchor.segment, length, height, overscaling);
} else {
if (rotate) {
+ // Account for *-rotate in point collision boxes
+ // Doesn't account for icon-text-fit
const float rotateRadians = rotate * M_PI / 180.0;
const Point<float> tl = util::rotate(Point<float>(x1, y1), rotateRadians);
@@ -44,6 +46,9 @@ CollisionFeature::CollisionFeature(const GeometryCoordinates& line,
const Point<float> bl = util::rotate(Point<float>(x1, y2), rotateRadians);
const Point<float> br = util::rotate(Point<float>(x2, y2), rotateRadians);
+ // Collision features require an "on-axis" geometry,
+ // so take the envelope of the rotated geometry
+ // (may be quite large for wide labels rotated 45 degrees)
const float xMin = std::min({tl.x, tr.x, bl.x, br.x});
const float xMax = std::max({tl.x, tr.x, bl.x, br.x});
const float yMin = std::min({tl.y, tr.y, bl.y, br.y});