[core] fix circle querying for scale and alignment
This fixes circle querying for cases where either
circle-pitch-alignment=map
or
circle-pitch-scaling=viewport
This commit is contained in:
committed by
Ansis Brammanis
parent
f7d20a5871
commit
f86fe44dbd
@@ -421,4 +421,17 @@ float TransformState::getCameraToTileDistance(const UnwrappedTileID& tileID) con
|
||||
return projectedCenter[3];
|
||||
}
|
||||
|
||||
float TransformState::maxPitchScaleFactor() const {
|
||||
if (size.isEmpty()) {
|
||||
return {};
|
||||
}
|
||||
auto latLng = screenCoordinateToLatLng({ 0, static_cast<float>(getSize().height) });
|
||||
mat4 mat = coordinatePointMatrix(getZoom());
|
||||
Point<double> pt = Projection::project(latLng, scale) / double(util::tileSize);
|
||||
vec4 p = {{ pt.x, pt.y, 0, 1 }};
|
||||
vec4 topPoint;
|
||||
matrix::transformMat4(topPoint, p, mat);
|
||||
return topPoint[3] / getCameraToCenterDistance();
|
||||
}
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
Reference in New Issue
Block a user