[core] Mark allow-overlap symbols visible even outside of collision grid.
Fixes issue #12683.
This commit is contained in:
@@ -117,6 +117,25 @@ void Placement::placeLayerBucket(
|
||||
avoidEdges = collisionIndex.projectTileBoundaries(posMatrix);
|
||||
}
|
||||
|
||||
const bool textAllowOverlap = bucket.layout.get<style::TextAllowOverlap>();
|
||||
const bool iconAllowOverlap = bucket.layout.get<style::IconAllowOverlap>();
|
||||
// This logic is similar to the "defaultOpacityState" logic below in updateBucketOpacities
|
||||
// If we know a symbol is always supposed to show, force it to be marked visible even if
|
||||
// it wasn't placed into the collision index (because some or all of it was outside the range
|
||||
// of the collision grid).
|
||||
// There is a subtle edge case here we're accepting:
|
||||
// Symbol A has text-allow-overlap: true, icon-allow-overlap: true, icon-optional: false
|
||||
// A's icon is outside the grid, so doesn't get placed
|
||||
// A's text would be inside grid, but doesn't get placed because of icon-optional: false
|
||||
// We still show A because of the allow-overlap settings.
|
||||
// Symbol B has allow-overlap: false, and gets placed where A's text would be
|
||||
// On panning in, there is a short period when Symbol B and Symbol A will overlap
|
||||
// This is the reverse of our normal policy of "fade in on pan", but should look like any other
|
||||
// collision and hopefully not be too noticeable.
|
||||
// See https://github.com/mapbox/mapbox-gl-native/issues/12683
|
||||
const bool alwaysShowText = textAllowOverlap && (iconAllowOverlap || !bucket.hasIconData() || bucket.layout.get<style::IconOptional>());
|
||||
const bool alwaysShowIcon = iconAllowOverlap && (textAllowOverlap || !bucket.hasTextData() || bucket.layout.get<style::TextOptional>());
|
||||
|
||||
for (auto& symbolInstance : bucket.symbolInstances) {
|
||||
|
||||
if (seenCrossTileIDs.count(symbolInstance.crossTileID) == 0) {
|
||||
@@ -187,7 +206,7 @@ void Placement::placeLayerBucket(
|
||||
placements.erase(symbolInstance.crossTileID);
|
||||
}
|
||||
|
||||
placements.emplace(symbolInstance.crossTileID, JointPlacement(placeText, placeIcon, offscreen || bucket.justReloaded));
|
||||
placements.emplace(symbolInstance.crossTileID, JointPlacement(placeText || alwaysShowText, placeIcon || alwaysShowIcon, offscreen || bucket.justReloaded));
|
||||
seenCrossTileIDs.insert(symbolInstance.crossTileID);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user