diff options
author | Chris Loer <chris.loer@gmail.com> | 2017-11-10 16:02:11 -0800 |
---|---|---|
committer | Chris Loer <chris.loer@mapbox.com> | 2017-11-17 10:05:15 -0800 |
commit | 4f0e5374c37d1138e958857022f542cd0dc47e59 (patch) | |
tree | f51b04a8067568c4184ed35f28518f957d7098d6 /src/mbgl/text/placement.hpp | |
parent | 22c07596a0c1e2cca12df730be4448bbe79be13d (diff) | |
download | qtlocation-mapboxgl-4f0e5374c37d1138e958857022f542cd0dc47e59.tar.gz |
[core] Skip fade animation for placed symbols that are currently offscreen.
Don't mark items that are outside the collision grid range as placed.
Requires new ignore because GL JS issue #5654 allows insertion of symbols outside the CollisionIndex range, and those symbols can cascade in to affect items within the viewport.
Diffstat (limited to 'src/mbgl/text/placement.hpp')
-rw-r--r-- | src/mbgl/text/placement.hpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/mbgl/text/placement.hpp b/src/mbgl/text/placement.hpp index 78bfc0a4d8..4d5fad06a1 100644 --- a/src/mbgl/text/placement.hpp +++ b/src/mbgl/text/placement.hpp @@ -14,7 +14,7 @@ namespace mbgl { class OpacityState { public: - OpacityState(bool placed); + OpacityState(bool placed, bool offscreen); OpacityState(const OpacityState& prevOpacityState, float increment, bool placed); bool isHidden() const; float opacity; @@ -23,18 +23,26 @@ namespace mbgl { class JointOpacityState { public: - JointOpacityState(bool placedIcon, bool placedText); + JointOpacityState(bool placedIcon, bool placedText, bool offscreen); JointOpacityState(const JointOpacityState& prevOpacityState, float increment, bool placedIcon, bool placedText); bool isHidden() const; OpacityState icon; OpacityState text; }; - class PlacementPair { + class JointPlacement { public: - PlacementPair(bool text_, bool icon_) : text(text_), icon(icon_) {} - bool text; - bool icon; + JointPlacement(bool text_, bool icon_, bool offscreen_) + : text(text_), icon(icon_), offscreen(offscreen_) + {} + + const bool text; + const bool icon; + // offscreen = outside viewport, but within CollisionIndex::viewportPadding px of the edge + // Because these symbols aren't onscreen yet, we can skip the "fade in" animation, + // and if a subsequent viewport change brings them into view, they'll be fully + // visible right away. + const bool offscreen; }; class Placement { @@ -72,7 +80,7 @@ namespace mbgl { MapMode mapMode; TimePoint commitTime; - std::unordered_map<uint32_t, PlacementPair> placements; + std::unordered_map<uint32_t, JointPlacement> placements; std::unordered_map<uint32_t, JointOpacityState> opacities; TimePoint recentUntil; |