[core] Added PrecisionPoint to represent pixel points
This commit is contained in:
@@ -100,7 +100,7 @@ public:
|
||||
void easeTo(CameraOptions options);
|
||||
|
||||
// Position
|
||||
void moveBy(double dx, double dy, const Duration& = Duration::zero());
|
||||
void moveBy(const PrecisionPoint&, const Duration& = Duration::zero());
|
||||
void setLatLng(LatLng latLng, vec2<double> point, const Duration& = Duration::zero());
|
||||
void setLatLng(LatLng latLng, const Duration& = Duration::zero());
|
||||
LatLng getLatLng() const;
|
||||
|
||||
@@ -3,10 +3,24 @@
|
||||
|
||||
#include <mbgl/util/vec.hpp>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class TileID;
|
||||
|
||||
struct PrecisionPoint {
|
||||
double x = 0;
|
||||
double y = 0;
|
||||
|
||||
inline PrecisionPoint(double x_ = 0, double y_ = 0)
|
||||
: x(x_), y(y_) {}
|
||||
|
||||
inline bool isValid() const {
|
||||
return !(std::isnan(x) || std::isnan(y));
|
||||
}
|
||||
};
|
||||
|
||||
struct LatLng {
|
||||
double latitude = 0;
|
||||
double longitude = 0;
|
||||
@@ -21,7 +35,7 @@ struct LatLng {
|
||||
// Constructs a LatLng object with the top left position of the specified tile.
|
||||
LatLng(const TileID& id);
|
||||
|
||||
vec2<double> project() const;
|
||||
PrecisionPoint project() const;
|
||||
};
|
||||
|
||||
struct ProjectedMeters {
|
||||
|
||||
Reference in New Issue
Block a user