summaryrefslogtreecommitdiffstats
path: root/gps.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-27 16:57:48 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-27 16:57:48 -0800
commit075aba8f7da8139c1dced48e5c0b8ea60cc7ae8f (patch)
tree5a635aaebe2e363300003afbdebdb637a39d1e3d /gps.c
parentae64abfbca2eb2c28a3875b1cb8ec098e660729a (diff)
downloadsubsurface-075aba8f7da8139c1dced48e5c0b8ea60cc7ae8f.tar.gz
Fix the zooming bug in the map window
There are more events than scroll_up and scroll_down - and because of this we could end up with target_lat and target_lon being uninitialized. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gps.c')
-rw-r--r--gps.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/gps.c b/gps.c
index 267b85084..c3af0522f 100644
--- a/gps.c
+++ b/gps.c
@@ -59,6 +59,7 @@ static gboolean scroll_cb(GtkWidget *widget, GdkEventScroll *event, gpointer dat
osm_gps_map_point_get_degrees(target, &target_lat, &target_lon);
osm_gps_map_zoom_in(map);
+ osm_gps_map_set_center(map, target_lat, target_lon);
} else if (event->direction == GDK_SCROLL_DOWN) {
if(zoom == min_zoom)
return TRUE;
@@ -70,13 +71,8 @@ static gboolean scroll_cb(GtkWidget *widget, GdkEventScroll *event, gpointer dat
osm_gps_map_point_get_degrees(target, &target_lat, &target_lon);
osm_gps_map_zoom_out(map);
+ osm_gps_map_set_center(map, target_lat, target_lon);
}
-
- /* There is no OSM interface to do this afaik. Hack something together */
- /* set_map_pt_at_xy(map, pt, event->x, event->y); */
-
- osm_gps_map_set_center(map, target_lat, target_lon);
-
/* don't allow the insane default handler to get its hands on this event */
return TRUE;
}