[gnome-system-tools/rendering-cleanup: 20/21] e-map: Add simplification API to zoom from a certain state
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-tools/rendering-cleanup: 20/21] e-map: Add simplification API to zoom from a certain state
- Date: Tue, 5 Oct 2010 16:40:53 +0000 (UTC)
commit b46cd8a408ab510c56786b08610772fd0003db8e
Author: Benjamin Otte <otte redhat com>
Date: Tue Oct 5 18:34:14 2010 +0200
e-map: Add simplification API to zoom from a certain state
src/time/e-map/e-map.c | 33 +++++++++++++++++----------------
1 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/src/time/e-map/e-map.c b/src/time/e-map/e-map.c
index 1e1667d..014a6e7 100644
--- a/src/time/e-map/e-map.c
+++ b/src/time/e-map/e-map.c
@@ -230,6 +230,20 @@ e_map_tween_new (EMap *view, guint msecs, double longitude_offset, double latitu
gtk_widget_queue_draw (GTK_WIDGET (view));
}
+static void
+e_map_tween_new_from (EMap *view, guint msecs, double longitude, double latitude, double zoom)
+{
+ double current_longitude, current_latitude;
+
+ e_map_get_current_location (view, ¤t_longitude, ¤t_latitude);
+
+ e_map_tween_new (view,
+ msecs,
+ longitude - current_longitude,
+ latitude - current_latitude,
+ zoom / e_map_get_magnification (view));
+}
+
/* ----------------- *
* Widget management *
* ----------------- */
@@ -858,20 +872,14 @@ e_map_zoom_to_location (EMap *map, gdouble longitude, gdouble latitude)
e_map_set_zoom (map, E_MAP_ZOOMED_IN);
center_at (map, longitude, latitude);
- /* need to reget location, centering might have clipped it */
- e_map_get_current_location (map, &longitude, &latitude);
- e_map_tween_new (map,
- 150,
- prevlong - longitude,
- prevlat - latitude,
- prevzoom / e_map_get_magnification (map));
+ e_map_tween_new_from (map, 150, prevlong, prevlat, prevzoom);
}
void
e_map_zoom_out (EMap *map)
{
- double longitude, latitude, actual_longitude, actual_latitude;
+ double longitude, latitude;
double prevzoom;
g_return_if_fail (map);
@@ -882,14 +890,7 @@ e_map_zoom_out (EMap *map)
e_map_set_zoom (map, E_MAP_ZOOMED_OUT);
center_at (map, longitude, latitude);
- /* need to reget location, centering might have clipped it */
- e_map_get_current_location (map, &actual_longitude, &actual_latitude);
-
- e_map_tween_new (map,
- 150,
- longitude - actual_longitude,
- latitude - actual_latitude,
- prevzoom / e_map_get_magnification (map));
+ e_map_tween_new_from (map, 150, longitude, latitude, prevzoom);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]