summaryrefslogtreecommitdiff
path: root/src/mbgl/text/placement.cpp
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-12-05 18:01:10 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-12-09 17:32:49 +0200
commit1829fb5e40d03ed053c019bdd324897e787431eb (patch)
tree83cbede1c49612a0535f531208157f2dcf747c36 /src/mbgl/text/placement.cpp
parentffd378c68e3bb47917468872cad03be7295e33fe (diff)
downloadqtlocation-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.cpp14
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