load correct covering tiles in perspective view
port pointCoordinate from -js to convert screen points to tile coordinates correctly in perspective view.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <mbgl/storage/response.hpp>
|
||||
#include <mbgl/util/math.hpp>
|
||||
#include <mbgl/util/box.hpp>
|
||||
#include <mbgl/util/tile_coordinate.hpp>
|
||||
#include <mbgl/util/mapbox.hpp>
|
||||
#include <mbgl/storage/file_source.hpp>
|
||||
#include <mbgl/style/style_layer.hpp>
|
||||
@@ -332,14 +333,14 @@ std::forward_list<TileID> Source::coveringTiles(const TransformState& state) con
|
||||
|
||||
// Map four viewport corners to pixel coordinates
|
||||
box points = state.cornersToBox(z);
|
||||
const vec2<double>& center = points.center;
|
||||
const TileCoordinate center = state.pointCoordinate({ state.getWidth() / 2.0f, state.getHeight()/ 2.0f }).zoomTo(z);
|
||||
|
||||
std::forward_list<TileID> covering_tiles = tileCover(z, points, reparseOverscaled ? actualZ : z);
|
||||
|
||||
covering_tiles.sort([¢er](const TileID& a, const TileID& b) {
|
||||
// Sorts by distance from the box center
|
||||
return std::fabs(a.x - center.x) + std::fabs(a.y - center.y) <
|
||||
std::fabs(b.x - center.x) + std::fabs(b.y - center.y);
|
||||
return std::fabs(a.x - center.column) + std::fabs(a.y - center.row) <
|
||||
std::fabs(b.x - center.column) + std::fabs(b.y - center.row);
|
||||
});
|
||||
|
||||
return covering_tiles;
|
||||
|
||||
Reference in New Issue
Block a user