change max_angle_delta to max_angle

This commit is contained in:
Konstantin Käfer
2014-08-04 18:57:53 +02:00
parent 056b4a988c
commit 9f99f0bb60
3 changed files with 7 additions and 7 deletions

View File

@@ -66,7 +66,7 @@ public:
TextJustifyType justify = TextJustifyType::Center;
TextHorizontalAlignType horizontal_align = TextHorizontalAlignType::Center;
TextVerticalAlignType vertical_align = TextVerticalAlignType::Center;
float max_angle_delta = 45.0f /* degrees */;
float max_angle = 45.0f /* degrees */;
float rotate = 0.0f;
float slant = 0.0f;
float padding = 2.0f;

View File

@@ -908,7 +908,7 @@ void StyleParser::parseRender(JSVal value, std::shared_ptr<StyleLayer> &layer) {
parseRenderProperty<TextJustifyTypeClass>(value, render.text.justify, "text-justify");
parseRenderProperty<TextHorizontalAlignTypeClass>(value, render.text.horizontal_align, "text-horizontal-align");
parseRenderProperty<TextVerticalAlignTypeClass>(value, render.text.vertical_align, "text-vertical-align");
parseRenderProperty(value, render.text.max_angle_delta, "text-max-angle");
parseRenderProperty(value, render.text.max_angle, "text-max-angle");
parseRenderProperty(value, render.text.rotate, "text-rotate");
parseRenderProperty(value, render.text.slant, "text-slant");
parseRenderProperty(value, render.text.padding, "text-padding");

View File

@@ -28,7 +28,7 @@ typedef std::vector<GlyphInstance> GlyphInstances;
void getSegmentGlyphs(std::back_insert_iterator<GlyphInstances> glyphs, Anchor &anchor,
float offset, const std::vector<Coordinate> &line, int segment,
int8_t direction, float maxAngleDelta) {
int8_t direction, float maxAngle) {
const bool upsideDown = direction < 0;
if (offset < 0)
@@ -60,7 +60,7 @@ void getSegmentGlyphs(std::back_insert_iterator<GlyphInstances> glyphs, Anchor &
// Don't place around sharp corners
float angleDiff = std::fmod((angle - prevAngle), (2.0f * M_PI));
if (prevAngle && std::fabs(angleDiff) > maxAngleDelta) {
if (prevAngle && std::fabs(angleDiff) > maxAngle) {
anchor.scale = prevscale;
break;
}
@@ -202,7 +202,7 @@ Placement Placement::getGlyphs(Anchor &anchor, const vec2<float> &origin, const
const GlyphPositions &face, float boxScale, bool horizontal,
const std::vector<Coordinate> &line,
const StyleBucketSymbol &props) {
const float maxAngleDelta = props.text.max_angle_delta * M_PI / 180;
const float maxAngle = props.text.max_angle * M_PI / 180;
const float rotate = props.text.rotate * M_PI / 180;
const float padding = props.text.padding;
const bool alongLine = props.text.rotation_alignment != RotationAlignmentType::Viewport;
@@ -233,10 +233,10 @@ Placement Placement::getGlyphs(Anchor &anchor, const vec2<float> &origin, const
GlyphInstances glyphInstances;
if (anchor.segment >= 0 && alongLine) {
getSegmentGlyphs(std::back_inserter(glyphInstances), anchor, x, line, anchor.segment, 1,
maxAngleDelta);
maxAngle);
if (keepUpright)
getSegmentGlyphs(std::back_inserter(glyphInstances), anchor, x, line,
anchor.segment, -1, maxAngleDelta);
anchor.segment, -1, maxAngle);
} else {
glyphInstances.emplace_back(GlyphInstance{anchor});