altosdroid: Use AltosMap set_zoom_centre
authorKeith Packard <keithp@keithp.com>
Sun, 21 Jun 2015 16:36:20 +0000 (09:36 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 23 Jun 2015 04:04:43 +0000 (21:04 -0700)
This keeps the center of the zoom gesture pinned to the screen.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosdroid/src/org/altusmetrum/AltosDroid/AltosMapView.java

index 1572bf337f848e1fb8026bfcc8da40404c5d25ed..65cc0b958be6e9d63c2443c2c3e52ddf85d87e8c 100644 (file)
@@ -115,12 +115,13 @@ public class AltosMapView extends View implements ScaleGestureDetector.OnScaleGe
 
        public boolean onScale(ScaleGestureDetector detector) {
                float   f = detector.getScaleFactor();
+
                if (f <= 0.8) {
-                       tab.map.set_zoom(tab.map.get_zoom() - 1);
+                       tab.map.set_zoom_centre(tab.map.get_zoom() - 1, new AltosPointInt((int) detector.getFocusX(), (int) detector.getFocusY()));
                        return true;
                }
                if (f >= 1.2) {
-                       tab.map.set_zoom(tab.map.get_zoom() + 1);
+                       tab.map.set_zoom_centre(tab.map.get_zoom() + 1, new AltosPointInt((int) detector.getFocusX(), (int) detector.getFocusY()));
                        return true;
                }
                return false;