From 9b0376e58ee9c7b3a94b816158b41eb8dcaf2090 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Thu, 9 Apr 2015 12:05:16 -0700 Subject: [PATCH] fix angle of icons along lines fixes https://github.com/mapbox/mapbox-gl-native/issues/1242 --- src/mbgl/text/placement.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp index 6a142cdf6..8a221e16f 100644 --- a/src/mbgl/text/placement.cpp +++ b/src/mbgl/text/placement.cpp @@ -146,8 +146,8 @@ Placement Placement::getIcon(Anchor &anchor, const Rect &image, float float angle = layout.icon.rotate * M_PI / 180.0f; if (anchor.segment >= 0 && layout.icon.rotation_alignment != RotationAlignmentType::Viewport) { - const Coordinate &next = line[anchor.segment]; - angle += -std::atan2(next.x - anchor.x, next.y - anchor.y) + M_PI / 2; + const Coordinate &prev = line[anchor.segment]; + angle += std::atan2(anchor.y - prev.y, anchor.x - prev.x); } if (angle) {