From a8ef2af353de195648578bf0d753703cb6f34905 Mon Sep 17 00:00:00 2001 From: Lauren Budorick Date: Wed, 26 Jul 2017 13:18:47 -0700 Subject: [core][android][macos][ios] Implement property functions for line-join, text-justify, text-anchor (#9583) --- src/mbgl/layout/symbol_layout.cpp | 46 ++------------------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) (limited to 'src/mbgl/layout') diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp index 956ba770dd..229b8f2ee2 100644 --- a/src/mbgl/layout/symbol_layout.cpp +++ b/src/mbgl/layout/symbol_layout.cpp @@ -180,47 +180,6 @@ bool SymbolLayout::hasSymbolInstances() const { void SymbolLayout::prepare(const GlyphMap& glyphMap, const GlyphPositions& glyphPositions, const ImageMap& imageMap, const ImagePositions& imagePositions) { - float horizontalAlign = 0.5; - float verticalAlign = 0.5; - - switch (layout.get()) { - case TextAnchorType::Top: - case TextAnchorType::Bottom: - case TextAnchorType::Center: - break; - case TextAnchorType::Right: - case TextAnchorType::TopRight: - case TextAnchorType::BottomRight: - horizontalAlign = 1; - break; - case TextAnchorType::Left: - case TextAnchorType::TopLeft: - case TextAnchorType::BottomLeft: - horizontalAlign = 0; - break; - } - - switch (layout.get()) { - case TextAnchorType::Left: - case TextAnchorType::Right: - case TextAnchorType::Center: - break; - case TextAnchorType::Bottom: - case TextAnchorType::BottomLeft: - case TextAnchorType::BottomRight: - verticalAlign = 1; - break; - case TextAnchorType::Top: - case TextAnchorType::TopLeft: - case TextAnchorType::TopRight: - verticalAlign = 0; - break; - } - - const float justify = layout.get() == TextJustifyType::Right ? 1 : - layout.get() == TextJustifyType::Left ? 0 : - 0.5; - const bool textAlongLine = layout.get() == AlignmentType::Map && layout.get() == SymbolPlacementType::Line; @@ -248,9 +207,8 @@ void SymbolLayout::prepare(const GlyphMap& glyphMap, const GlyphPositions& glyph /* maxWidth: ems */ layout.get() != SymbolPlacementType::Line ? layout.get() * oneEm : 0, /* lineHeight: ems */ layout.get() * oneEm, - /* horizontalAlign */ horizontalAlign, - /* verticalAlign */ verticalAlign, - /* justify */ justify, + /* anchor */ layout.evaluate(zoom, feature), + /* justify */ layout.evaluate(zoom, feature), /* spacing: ems */ util::i18n::allowsLetterSpacing(*feature.text) ? layout.get() * oneEm : 0.0f, /* translate */ Point(layout.evaluate(zoom, feature)[0] * oneEm, layout.evaluate(zoom, feature)[1] * oneEm), /* verticalHeight */ oneEm, -- cgit v1.2.1