Do not display trailing zeroes for integer angles.

Angles that aren't an integral number of degrees are extremely
rare, and the label is often in a tight space, which warrants
special-casing this.
This commit is contained in:
whitequark 2016-04-16 01:13:06 +00:00
parent 7a01c840d3
commit bcb484e941

View File

@ -52,7 +52,11 @@ double Constraint::EllipticalInterpolation(double rx, double ry, double theta) {
std::string Constraint::Label(void) { std::string Constraint::Label(void) {
std::string result; std::string result;
if(type == ANGLE) { if(type == ANGLE) {
if(valA == floor(valA)) {
result = ssprintf("%.0f°", valA);
} else {
result = ssprintf("%.2f°", valA); result = ssprintf("%.2f°", valA);
}
} else if(type == LENGTH_RATIO) { } else if(type == LENGTH_RATIO) {
result = ssprintf("%.3f:1", valA); result = ssprintf("%.3f:1", valA);
} else if(type == COMMENT) { } else if(type == COMMENT) {