src/mbgl/text/cross_tile_symbol_index.cpp
void CrossTileSymbolLayerIndex::handleWrapJump(float newLng) {
    const int wrapDelta = std::round((newLng - lng) / 360);
    if (wrapDelta != 0) {
        std::map<uint8_t, std::map<OverscaledTileID,TileLayerIndex>> newIndexes;
        for (auto& zoomIndex : indexes) {
            std::map<OverscaledTileID,TileLayerIndex> newZoomIndex;
            for (auto& index : zoomIndex.second) {
                // change the tileID's wrap and move its index
                index.second.coord = index.second.coord.unwrapTo(index.second.coord.wrap + wrapDelta);
                newZoomIndex.emplace(index.second.coord, std::move(index.second));
            }
            newIndexes.emplace(zoomIndex.first, std::move(newZoomIndex));
        }

        indexes = std::move(newIndexes);
    }

    lng = newLng;
}
/*
 * Sometimes when a user pans across the antimeridian the longitude value gets wrapped.
 * To prevent labels from flashing out and in we adjust the tileID values in the indexes
 * so that they match the new wrapped version of the map.
 */
Sometimes when a user pans across the antimeridian the longitude value gets wrapped.
To prevent labels from flashing out and in we adjust the tileID values in the indexes
so that they match the new wrapped version of the map.
Sometimes when a user pans across the antimeridian the longitude value gets wrapped . To prevent labels from flashing out and in we adjust the tileID values in the indexes so that they match the new wrapped version of the map .
void CrossTileSymbolLayerIndex::handleWrapJump(float newLng) {
    const int wrapDelta = std::round((newLng - lng) / 360);
    if (wrapDelta != 0) {
        std::map<uint8_t, std::map<OverscaledTileID,TileLayerIndex>> newIndexes;
        for (auto& zoomIndex : indexes) {
            std::map<OverscaledTileID,TileLayerIndex> newZoomIndex;
            for (auto& index : zoomIndex.second) {
                index.second.coord = index.second.coord.unwrapTo(index.second.coord.wrap + wrapDelta);
                newZoomIndex.emplace(index.second.coord, std::move(index.second));
            }
            newIndexes.emplace(zoomIndex.first, std::move(newZoomIndex));
        }
        indexes = std::move(newIndexes);
    }
    lng = newLng;
}
void CrossTileSymbolLayerIndex :: handleWrapJump ( float newLng ) { const int wrapDelta = std :: round ( ( newLng - lng ) / 360 ) ; if ( wrapDelta != 0 ) { std :: map < uint8_t , std :: map < OverscaledTileID , TileLayerIndex > > newIndexes ; for ( auto & zoomIndex : indexes ) { std :: map < OverscaledTileID , TileLayerIndex > newZoomIndex ; for ( auto & index : zoomIndex . second ) { index . second . coord = index . second . coord . unwrapTo ( index . second . coord . wrap + wrapDelta ) ; newZoomIndex . emplace ( index . second . coord , std :: move ( index . second ) ) ; } newIndexes . emplace ( zoomIndex . first , std :: move ( newZoomIndex ) ) ; } indexes = std :: move ( newIndexes ) ; } lng = newLng ; }
Sometimes when a user pans across the antimeridian the longitude value gets wrapped.
Sometimes when a user pans across the antimeridian the longitude value gets wrapped .
// change the tileID's wrap and move its index