don't treat negative values as placement failure

This commit is contained in:
Konstantin Käfer
2014-03-24 17:15:54 +01:00
parent 8b573f9fa2
commit 5c11bcf5c0
2 changed files with 8 additions and 4 deletions

View File

@@ -99,7 +99,12 @@ struct PlacementProperty {
explicit PlacementProperty(float zoom, const PlacementRange &rotationRange)
: zoom(zoom), rotationRange(rotationRange) {}
float zoom = -1.0f;
inline operator bool() const {
return !isnan(zoom) && zoom != std::numeric_limits<float>::infinity() &&
rotationRange[0] != rotationRange[1];
}
float zoom = std::numeric_limits<float>::infinity();
PlacementRange rotationRange = {{0.0f, 0.0f}};
};

View File

@@ -305,10 +305,9 @@ void Placement::addFeature(TextBucket& bucket,
PlacementProperty place =
collision.place(glyphs, anchor, anchor.scale, maxPlacementScale,
padding, horizontal);
if (place.zoom >= 0.0f) {
if (place) {
bucket.addGlyphs(glyphs, place.zoom, place.rotationRange,
zoom - zOffset);
zoom - zOffset);
}
}
}