|
|
@@ -179,6 +179,7 @@ impl OrthograficView {
|
|
179
|
179
|
pub fn from_mercator_view(merc: &MercatorView) -> Self {
|
|
180
|
180
|
let latlon = merc.center.to_latlon_rad();
|
|
181
|
181
|
let zoom_delta = (1.0 / latlon.lat.cos()).log2();
|
|
|
182
|
+
|
|
182
|
183
|
OrthograficView {
|
|
183
|
184
|
viewport_size: merc.viewport_size,
|
|
184
|
185
|
tile_size: merc.tile_size,
|
|
|
@@ -481,8 +482,8 @@ impl OrthograficView {
|
|
481
|
482
|
|
|
482
|
483
|
/// Move the center of the viewport by approx. (`delta_x`, `delta_y`) in screen coordinates.
|
|
483
|
484
|
pub fn move_pixel(&mut self, delta_x: f64, delta_y: f64) {
|
|
484
|
|
- //TODO Do something more sophisticated
|
|
485
|
|
- let scale = f64::powf(2.0, -self.zoom) / f64::from(self.tile_size);
|
|
|
485
|
+ let latlon = self.center.to_latlon_rad();
|
|
|
486
|
+ let scale = f64::powf(2.0, -self.zoom) / (f64::from(self.tile_size) * latlon.lat.cos());
|
|
486
|
487
|
self.center.x += delta_x * scale;
|
|
487
|
488
|
self.center.y += delta_y * scale;
|
|
488
|
489
|
self.center.normalize_xy();
|