diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-12-05 18:01:10 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-12-09 17:32:49 +0200 |
commit | 1829fb5e40d03ed053c019bdd324897e787431eb (patch) | |
tree | 83cbede1c49612a0535f531208157f2dcf747c36 /src/mbgl/text/placement.cpp | |
parent | ffd378c68e3bb47917468872cad03be7295e33fe (diff) | |
download | qtlocation-mapboxgl-1829fb5e40d03ed053c019bdd324897e787431eb.tar.gz |
[core] Placement::commit() handles absence of previuos placement
Diffstat (limited to 'src/mbgl/text/placement.cpp')
-rw-r--r-- | src/mbgl/text/placement.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp index 639ed7e1de..2566ba4274 100644 --- a/src/mbgl/text/placement.cpp +++ b/src/mbgl/text/placement.cpp @@ -101,6 +101,7 @@ Placement::Placement(const TransformState& state_, placementZoom(state_.getZoom()), collisionGroups(crossSourceCollisions), prevPlacement(std::move(prevPlacement_)) { + assert(prevPlacement || mapMode != MapMode::Continuous); if (prevPlacement) { prevPlacement->get()->prevPlacement = nullopt; // Only hold on to one placement back } @@ -533,13 +534,22 @@ void Placement::placeBucket( } void Placement::commit(TimePoint now, const double zoom) { - assert(getPrevPlacement()); commitTime = now; + if (!getPrevPlacement()) { + assert(mapMode != MapMode::Continuous); + fadeStartTime = commitTime; + for (auto& jointPlacement : placements) { + opacities.emplace( + jointPlacement.first, + JointOpacityState( + jointPlacement.second.text, jointPlacement.second.icon, jointPlacement.second.skipFade)); + } + return; + } bool placementChanged = false; prevZoomAdjustment = getPrevPlacement()->zoomAdjustment(zoom); - float increment = getPrevPlacement()->symbolFadeChange(commitTime); // add the opacities from the current placement, and copy their current values from the previous placement |