summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-04-11 17:07:25 +0300
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-04-14 12:33:13 -0700
commit2f4d162debd7e4accfc0b20360058304dce40801 (patch)
tree276894e2ccfa67874dbe6ecf263330d6b35007ad /src
parent8877452ec36d01a753221998f31b67700e595d54 (diff)
downloadqtlocation-mapboxgl-2f4d162debd7e4accfc0b20360058304dce40801.tar.gz
[core] Tighten geo.hpp ctors
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/map/map.cpp12
-rw-r--r--src/mbgl/map/transform.cpp4
-rw-r--r--src/mbgl/util/geo.cpp4
3 files changed, 10 insertions, 10 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 19b1222f0e..fde466054c 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -600,8 +600,8 @@ CameraOptions Map::cameraForLatLngs(const std::vector<LatLng>& latLngs, const Ed
if (width > 0 || height > 0) {
double scaleX = double(getSize().width) / width;
double scaleY = double(getSize().height) / height;
- scaleX -= (padding.left + padding.right) / width;
- scaleY -= (padding.top + padding.bottom) / height;
+ scaleX -= (padding.left() + padding.right()) / width;
+ scaleY -= (padding.top() + padding.bottom()) / height;
minScale = util::min(scaleX, scaleY);
}
double zoom = getZoom() + util::log2(minScale);
@@ -610,12 +610,12 @@ CameraOptions Map::cameraForLatLngs(const std::vector<LatLng>& latLngs, const Ed
// Calculate the center point of a virtual bounds that is extended in all directions by padding.
ScreenCoordinate centerPixel = nePixel + swPixel;
ScreenCoordinate paddedNEPixel = {
- padding.right / minScale,
- padding.top / minScale,
+ padding.right() / minScale,
+ padding.top() / minScale,
};
ScreenCoordinate paddedSWPixel = {
- padding.left / minScale,
- padding.bottom / minScale,
+ padding.left() / minScale,
+ padding.bottom() / minScale,
};
centerPixel = centerPixel + paddedNEPixel - paddedSWPixel;
centerPixel /= 2.0;
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp
index 67729f7fe2..f9a687480c 100644
--- a/src/mbgl/map/transform.cpp
+++ b/src/mbgl/map/transform.cpp
@@ -200,8 +200,8 @@ void Transform::flyTo(const CameraOptions &camera, const AnimationOptions &anima
/// w₀: Initial visible span, measured in pixels at the initial scale.
/// Known henceforth as a <i>screenful</i>.
- double w0 = std::max(state.size.width - padding.left - padding.right,
- state.size.height - padding.top - padding.bottom);
+ double w0 = std::max(state.size.width - padding.left() - padding.right(),
+ state.size.height - padding.top() - padding.bottom());
/// w₁: Final visible span, measured in pixels with respect to the initial
/// scale.
double w1 = w0 / state.zoomScale(zoom - startZoom);
diff --git a/src/mbgl/util/geo.cpp b/src/mbgl/util/geo.cpp
index 1244a975a4..f38aba20c4 100644
--- a/src/mbgl/util/geo.cpp
+++ b/src/mbgl/util/geo.cpp
@@ -34,8 +34,8 @@ LatLngBounds::LatLngBounds(const CanonicalTileID& id)
ScreenCoordinate EdgeInsets::getCenter(uint16_t width, uint16_t height) const {
return {
- (width - left - right) / 2.0f + left,
- (height - top - bottom) / 2.0f + top,
+ (width - left() - right()) / 2.0 + left(),
+ (height - top() - bottom()) / 2.0 + top(),
};
}