Merge pull request #34 from maplibre/symbol-flicker-fix
Symbol Flicker Fix
This commit is contained in:
@@ -6,6 +6,10 @@ Mapbox welcomes participation and contributions from everyone. Please read [`Con
|
||||
|
||||
### Features
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Fixed an issue where symbols flickered when zooming out. [#16](https://github.com/maplibre/maplibre-gl-native/issues/16)
|
||||
|
||||
### Other
|
||||
|
||||
* mapbox-gl-js submodule has been replaced with maplibre-gl-js
|
||||
|
||||
@@ -17,6 +17,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
|
||||
### Bug Fixes
|
||||
|
||||
* Fixed an issue that caused a crash when custom location managers did not implement `MGLLocationManager.accuracyAuthorization`. (cherry pick from [#474](https://github.com/mapbox/mapbox-gl-native-ios/pull/474))
|
||||
* Fixed an issue where symbols flickered when zooming out. [#16](https://github.com/maplibre/maplibre-gl-native/issues/16)
|
||||
|
||||
### Other
|
||||
|
||||
|
||||
@@ -424,7 +424,8 @@ void RenderSymbolLayer::render(PaintParameters& parameters) {
|
||||
assert(bucket.paintProperties.find(getID()) != bucket.paintProperties.end());
|
||||
const auto& bucketPaintProperties = bucket.paintProperties.at(getID());
|
||||
|
||||
bucket.justReloaded = false;
|
||||
// Prevent a flickering issue when a symbol is moved.
|
||||
// bucket.justReloaded = false;
|
||||
|
||||
auto addRenderables = [&renderableSegments, &tile, renderData, &bucketPaintProperties, it = renderableSegments.begin()] (auto& segments, const SymbolType type) mutable {
|
||||
for (auto& segment : segments) {
|
||||
|
||||
@@ -241,9 +241,16 @@ void Placement::placeSymbolBucket(const BucketPlacementData& params, std::set<ui
|
||||
for (const SymbolInstance& symbol : getSortedSymbols(params, ctx.pixelRatio)) {
|
||||
if (seenCrossTileIDs.count(symbol.crossTileID) != 0u) continue;
|
||||
placeSymbol(symbol, ctx);
|
||||
seenCrossTileIDs.insert(symbol.crossTileID);
|
||||
|
||||
// Prevent a flickering issue while zooming out.
|
||||
if (symbol.crossTileID != SymbolInstance::invalidCrossTileID() && !ctx.getRenderTile().holdForFade()) {
|
||||
seenCrossTileIDs.insert(symbol.crossTileID);
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent a flickering issue when a symbol is moved.
|
||||
symbolBucket.justReloaded = false;
|
||||
|
||||
// As long as this placement lives, we have to hold onto this bucket's
|
||||
// matching FeatureIndex/data for querying purposes
|
||||
retainedQueryData.emplace(
|
||||
@@ -905,9 +912,10 @@ void Placement::updateBucketOpacities(SymbolBucket& bucket,
|
||||
// But we have to wait for placement if we potentially depend on a paired icon/text
|
||||
// with allow-overlap: false.
|
||||
// See https://github.com/mapbox/mapbox-gl-native/issues/12483
|
||||
// Prevent a flickering issue when showing a symbol allowing overlap.
|
||||
const JointOpacityState defaultOpacityState(
|
||||
textAllowOverlap && (iconAllowOverlap || !(bucket.hasIconData() || bucket.hasSdfIconData()) || bucket.layout->get<style::IconOptional>()),
|
||||
iconAllowOverlap && (textAllowOverlap || !bucket.hasTextData() || bucket.layout->get<style::TextOptional>()),
|
||||
bucket.justReloaded && textAllowOverlap && (iconAllowOverlap || !(bucket.hasIconData() || bucket.hasSdfIconData()) || bucket.layout->get<style::IconOptional>()),
|
||||
bucket.justReloaded && iconAllowOverlap && (textAllowOverlap || !bucket.hasTextData() || bucket.layout->get<style::TextOptional>()),
|
||||
true);
|
||||
|
||||
for (SymbolInstance& symbolInstance : bucket.symbolInstances) {
|
||||
|
||||
Reference in New Issue
Block a user