From fe9d4636586d7451aa7e5a7ecbee62b67720032a Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Fri, 19 Jul 2019 13:39:46 +0200 Subject: [core] Do not try to place a center anchor beyond the center of the line Once the algorithm finds the center of the line, if placement is not possible, do not place the anchor. Previous code was trying to continue place the label beyond the center of the segment. Fixes #15139. --- src/mbgl/text/get_anchors.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mbgl/text/get_anchors.cpp b/src/mbgl/text/get_anchors.cpp index 160ee21edf..c38e181181 100644 --- a/src/mbgl/text/get_anchors.cpp +++ b/src/mbgl/text/get_anchors.cpp @@ -166,6 +166,8 @@ optional getCenterAnchor(const GeometryCoordinates& line, if (!angleWindowSize || checkMaxAngle(line, anchor, labelLength, angleWindowSize, maxAngle)) { return anchor; } + + return nullopt; } prevDistance += segmentDistance; -- cgit v1.2.1