]> err.no Git - mapper/commitdiff
Check for POI on button release.
authorKaj-Michael Lang <milang@tal.org>
Tue, 22 Jan 2008 23:15:24 +0000 (01:15 +0200)
committerKaj-Michael Lang <milang@tal.org>
Tue, 22 Jan 2008 23:15:24 +0000 (01:15 +0200)
src/map.c

index 0a375891cd14d914a3cb9e9dcb41690f40c706ce..194e5e6848ff652e1026dbb8d462cbf97ddd5ffa 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -1280,10 +1280,6 @@ return FALSE;
 static gboolean 
 map_cb_button_press(GtkWidget * widget, GdkEventButton * event)
 {
-gdouble lat, lon;
-guint poi_id;
-gint ux, uy;
-
 _cmenu_position_x = event->x + 0.5;
 _cmenu_position_y = event->y + 0.5;
 
@@ -1302,16 +1298,7 @@ case 1:
                return FALSE;
        }
 
-       ux=x2unit(_cmenu_position_x);
-       uy=y2unit(_cmenu_position_y);
-
-       unit2latlon(ux, uy, lat, lon);
-       if (map_poi_find_at_latlon(lat, lon, &poi_id)==TRUE) {
-               g_printf("POI: %d\n", poi_id);
-               g_idle_add_full(G_PRIORITY_HIGH_IDLE,(GSourceFunc)map_cb_show_poi_info_dialog, GINT_TO_POINTER(poi_id), NULL);
-       } else {
-               map_drag_start(event->x, event->y);
-       }
+       map_drag_start(event->x, event->y);
        return FALSE;
 break;
 case 2:
@@ -1330,6 +1317,10 @@ return FALSE;
 static gboolean 
 map_cb_button_release(GtkWidget *widget, GdkEventButton *event)
 {
+gdouble lat, lon;
+guint poi_id;
+gint ux, uy;
+
 g_printf("BtnRelease\n");
 switch (event->button) {
 case 1:
@@ -1348,12 +1339,20 @@ case 1:
        case MAP_MODE_SET_ROUTE_TO:
        break;
        default:
-               map_drag_stop(event->x, event->y);
+               ux=x2unit(_cmenu_position_x);
+               uy=y2unit(_cmenu_position_y);
+
+               unit2latlon(ux, uy, lat, lon);
+               if (map_poi_find_at_latlon(lat, lon, &poi_id)==TRUE) {
+                       g_printf("POI: %d\n", poi_id);
+                       g_idle_add_full(G_PRIORITY_HIGH_IDLE,(GSourceFunc)map_cb_show_poi_info_dialog, GINT_TO_POINTER(poi_id), NULL);
+               }
                if (map_data_needs_refresh==TRUE) {
                        map_data_needs_refresh=FALSE;
                        map_render_data();
                        g_idle_add_full(G_PRIORITY_HIGH_IDLE,(GSourceFunc)map_update_location_from_center, NULL, NULL);
                }
+               map_drag_stop(event->x, event->y);
        break;
        }
 break;