Kaynağa Gözat

map_view: Fix zoom calculation for pixel snapping

Johannes Hofmann 7 yıl önce
ebeveyn
işleme
18111f53e8
1 değiştirilmiş dosya ile 2 ekleme ve 4 silme
  1. 2
    4
      src/map_view.rs

+ 2
- 4
src/map_view.rs Dosyayı Görüntüle

@@ -101,10 +101,8 @@ impl MapView {
101 101
         let tile_screen_size = f64::powf(2.0, self.zoom - f64::from(uzoom)) * f64::from(self.tile_size);
102 102
 
103 103
         if snap_to_pixel {
104
-            // only snap to pixel if apparent zoom is integer
105
-            let apparent_zoom = self.zoom + self.tile_zoom_offset;
106
-            let apparent_zoom_int = (apparent_zoom + 0.5).floor();
107
-            if (apparent_zoom - apparent_zoom_int).abs() < 1e-10 {
104
+            // only snap to pixel if zoom has integral value
105
+            if (self.zoom - (self.zoom + 0.5).floor()).abs() < 1e-10 {
108 106
                 top_left_tile_screen_coord.snap_to_pixel();
109 107
             }
110 108
         }