implement alwaysVisible
This commit is contained in:
@@ -74,7 +74,7 @@ PlacementProperty Collision::place(const PlacedGlyphs &placed_glyphs,
|
||||
const CollisionAnchor &anchor,
|
||||
float minPlacementScale,
|
||||
float maxPlacementScale, float padding,
|
||||
bool horizontal) {
|
||||
bool horizontal, bool alwaysVisible) {
|
||||
|
||||
float minScale = std::numeric_limits<float>::infinity();
|
||||
for (const PlacedGlyph &placed_glyph : placed_glyphs) {
|
||||
@@ -111,8 +111,9 @@ PlacementProperty Collision::place(const PlacedGlyphs &placed_glyphs,
|
||||
|
||||
// Calculate the minimum scale the entire label can be shown without
|
||||
// collisions
|
||||
float scale = getPlacementScale(glyphs, minPlacementScale,
|
||||
maxPlacementScale, padding);
|
||||
float scale = alwaysVisible ? minPlacementScale
|
||||
: getPlacementScale(glyphs, minPlacementScale,
|
||||
maxPlacementScale, padding);
|
||||
|
||||
// Return if the label can never be placed without collision
|
||||
if (scale < 0 || scale == std::numeric_limits<float>::infinity()) {
|
||||
|
||||
@@ -304,7 +304,7 @@ void Placement::addFeature(TextBucket& bucket,
|
||||
line, maxAngleDelta, rotate);
|
||||
PlacementProperty place =
|
||||
collision.place(glyphs, anchor, anchor.scale, maxPlacementScale,
|
||||
padding, horizontal);
|
||||
padding, horizontal, info.alwaysVisible);
|
||||
if (place) {
|
||||
bucket.addGlyphs(glyphs, place.zoom, place.rotationRange,
|
||||
zoom - zOffset);
|
||||
|
||||
Reference in New Issue
Block a user