[core] Hold on to tile yStretch value for rendering old symbolBuckets while waiting for new ones.

This commit is contained in:
Chris Loer
2017-06-06 09:01:17 -07:00
committed by Ansis Brammanis
parent a432a289a3
commit a0e37fe35b
2 changed files with 10 additions and 2 deletions

View File

@@ -42,7 +42,8 @@ GeometryTile::GeometryTile(const OverscaledTileID& id_,
parameters.pixelRatio),
glyphManager(parameters.glyphManager),
imageManager(parameters.imageManager),
placementThrottler(Milliseconds(300), [this] { invokePlacement(); }) {
placementThrottler(Milliseconds(300), [this] { invokePlacement(); }),
lastYStretch(1.0f) {
}
GeometryTile::~GeometryTile() {
@@ -143,6 +144,9 @@ void GeometryTile::onPlacement(PlacementResult result) {
if (result.iconAtlasImage) {
iconAtlasImage = std::move(*result.iconAtlasImage);
}
if (collisionTile.get()) {
lastYStretch = collisionTile->yStretch;
}
observer->onTileChanged(*this);
}
@@ -265,7 +269,10 @@ void GeometryTile::querySourceFeatures(
}
float GeometryTile::yStretch() const {
return collisionTile->yStretch;
// collisionTile gets reset in onLayout but we don't clear the symbolBuckets
// until a new placement result comes along, so keep the yStretch value in
// case we need to render them.
return lastYStretch;
}
} // namespace mbgl

View File

@@ -122,6 +122,7 @@ private:
std::unique_ptr<CollisionTile> collisionTile;
util::Throttler placementThrottler;
float lastYStretch;
public:
optional<gl::Texture> glyphAtlasTexture;