translate as a text bucket property

When used, text is translated before being checked for collisions.
This commit is contained in:
Ansis Brammanis
2014-05-30 03:50:25 -04:00
parent 41c310c762
commit 7c653895c6
4 changed files with 21 additions and 13 deletions

View File

@@ -108,11 +108,18 @@ BucketDescription StyleParser::parseBucket(JSVal value) {
} else {
throw Style::exception("alignment must be a string");
}
} else if (name == "translate") {
if (value.IsArray()) {
bucket.geometry.translate.x = value[(rapidjson::SizeType)0].GetDouble() * 24;
bucket.geometry.translate.y = value[(rapidjson::SizeType)1].GetDouble() * -24;
} else {
throw Style::exception("translate must be a string");
}
} else if (name == "verticalAlignment") {
if (value.IsString()) {
bucket.geometry.vertical_alignment = verticalAlignmentType({ value.GetString(), value.GetStringLength() });
} else {
throw Style::exception("alignment must be a string");
throw Style::exception("verticalAlignment must be a string");
}
} else if (name == "lineHeight") {
if (value.IsNumber()) {