summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layers/symbol_layer_impl.cpp
diff options
context:
space:
mode:
authorYoung Hahn <young@mapbox.com>2016-09-21 19:07:33 -0400
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-09-21 16:07:33 -0700
commit6a2ce352d1eec6dc166e351e06c6b10c633eb07c (patch)
tree58e5682522a544cd9db5c1052d538148565be9da /src/mbgl/style/layers/symbol_layer_impl.cpp
parent673d8f90f24a89871905e80ef1bfd7970e61dc6c (diff)
downloadqtlocation-mapboxgl-6a2ce352d1eec6dc166e351e06c6b10c633eb07c.tar.gz
Better handling for undefined icon|text-rotation-alignment (#6253)
* [core, ios, android] Use `auto` value for properties with calculated defaults * Fix render tests
Diffstat (limited to 'src/mbgl/style/layers/symbol_layer_impl.cpp')
-rw-r--r--src/mbgl/style/layers/symbol_layer_impl.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/mbgl/style/layers/symbol_layer_impl.cpp b/src/mbgl/style/layers/symbol_layer_impl.cpp
index 1039951f5e..e85f3a90f9 100644
--- a/src/mbgl/style/layers/symbol_layer_impl.cpp
+++ b/src/mbgl/style/layers/symbol_layer_impl.cpp
@@ -35,19 +35,29 @@ std::unique_ptr<SymbolLayout> SymbolLayer::Impl::createLayout(BucketParameters&
SymbolLayoutProperties layoutProperties = layout;
CalculationParameters p(parameters.tileID.overscaledZ);
- layoutProperties.symbolPlacement.calculate(p);
- if (layoutProperties.symbolPlacement.value == SymbolPlacementType::Line) {
- layoutProperties.iconRotationAlignment.value = AlignmentType::Map;
- layoutProperties.textRotationAlignment.value = AlignmentType::Map;
+ layoutProperties.recalculate(p);
+
+ if (layoutProperties.iconRotationAlignment.value == AlignmentType::Auto) {
+ if (layoutProperties.symbolPlacement.value == SymbolPlacementType::Line) {
+ layoutProperties.iconRotationAlignment.value = AlignmentType::Map;
+ } else {
+ layoutProperties.iconRotationAlignment.value = AlignmentType::Viewport;
+ }
+ }
+
+ if (layoutProperties.textRotationAlignment.value == AlignmentType::Auto) {
+ if (layoutProperties.symbolPlacement.value == SymbolPlacementType::Line) {
+ layoutProperties.textRotationAlignment.value = AlignmentType::Map;
+ } else {
+ layoutProperties.textRotationAlignment.value = AlignmentType::Viewport;
+ }
}
// If unspecified `text-pitch-alignment` inherits `text-rotation-alignment`
- if (layoutProperties.textPitchAlignment.value == AlignmentType::Undefined) {
+ if (layoutProperties.textPitchAlignment.value == AlignmentType::Auto) {
layoutProperties.textPitchAlignment.value = layoutProperties.textRotationAlignment.value;
}
- layoutProperties.recalculate(p);
-
layoutProperties.textSize.calculate(CalculationParameters(18));
float textMaxSize = layoutProperties.textSize;