summaryrefslogtreecommitdiff
path: root/src/mbgl/text/placement.hpp
diff options
context:
space:
mode:
authorAnsis Brammanis <ansis@mapbox.com>2019-08-19 19:32:31 -0400
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-08-20 13:34:22 +0300
commit7d9b54a573a196d9120226c17d8dc30384f207b8 (patch)
treee8c00ba743e20ad1ed6976dfbbfca810f3388377 /src/mbgl/text/placement.hpp
parentad1d48af987dd43ec8c8dd298d8ef1962ac0b695 (diff)
downloadqtlocation-mapboxgl-7d9b54a573a196d9120226c17d8dc30384f207b8.tar.gz
[core] make symbols fade out faster while zooming out
Zooming outcan make symbols overlap quickly. The area previously covered by the viewport is covered by a lot of colliding labels while the surrounding area has no labels. This difference produces an unwanted effect. This reduces that effect by: - reducing the fade duration while zooming out - doing placement more frequently while zooming out
Diffstat (limited to 'src/mbgl/text/placement.hpp')
-rw-r--r--src/mbgl/text/placement.hpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mbgl/text/placement.hpp b/src/mbgl/text/placement.hpp
index 722a4a0926..2349fd3785 100644
--- a/src/mbgl/text/placement.hpp
+++ b/src/mbgl/text/placement.hpp
@@ -102,14 +102,14 @@ class Placement {
public:
Placement(const TransformState&, MapMode, style::TransitionOptions, const bool crossSourceCollisions, std::unique_ptr<Placement> prevPlacementOrNull = nullptr);
void placeLayer(const RenderLayer&, const mat4&, bool showCollisionBoxes);
- void commit(TimePoint);
+ void commit(TimePoint, const double zoom);
void updateLayerBuckets(const RenderLayer&, const TransformState&, bool updateOpacities);
float symbolFadeChange(TimePoint now) const;
bool hasTransitions(TimePoint now) const;
const CollisionIndex& getCollisionIndex() const;
- bool stillRecent(TimePoint now) const;
+ bool stillRecent(TimePoint now, const float zoom) const;
void setRecent(TimePoint now);
void setStale();
@@ -125,6 +125,7 @@ private:
void updateBucketOpacities(SymbolBucket&, const TransformState&, std::set<uint32_t>&);
void markUsedJustification(SymbolBucket&, style::TextVariableAnchorType, const SymbolInstance&, style::TextWritingModeType orientation);
void markUsedOrientation(SymbolBucket&, style::TextWritingModeType, const SymbolInstance&);
+ float zoomAdjustment(const float zoom) const;
CollisionIndex collisionIndex;
@@ -133,6 +134,8 @@ private:
TimePoint fadeStartTime;
TimePoint commitTime;
+ float placementZoom;
+ float prevZoomAdjustment = 0;
std::unordered_map<uint32_t, JointPlacement> placements;
std::unordered_map<uint32_t, JointOpacityState> opacities;